Phrase triggering questions

I’m using the Program mode.

  1. It seems like the Zxx command only overrides the phrase being played instead of actually changing the “clicked” phrase. Is there a reason for this? Because of this you have to insert Zxx everywhere when you want to change the note but keep the phrase instead of just when you want to change the phrase that should play (or Z00 to stop using phrases).

  2. I found PhraseMate and found the Live monitoring of pattern setting which could work as a workaround for this problem, but when enabling it and adding a note under a note that has a Zxx command (for example Z03) it adds a Z01 command instead. I thought this would monitor and copy the command of the previous phrase used in the active track but I guess that’s not the case?

  3. Finally I tested the MIDI program change method of changing the phrase (M2 xx yy) and saw that it actually changed the “clicked” phrase unlike Zxx which is great because it’s the behavior I wanted, but I also noticed it behaved a bit strange. It seems like it doesn’t affect the note where you add the effect but instead any note after that.

So for example instead of “Change to phrase 2 - Play note” it is “Play note - Change to phrase 2” which doesn’t seem right to me. Is this a limitation of MIDI or a bug? For example this happens when I start trigger playback from the middle of a pattern (so playing from the beginning but with the cursor in the middle of the pattern): (see image)

My file has M2 0 02 at the top of the file. The next note has M2 0 03. The cursor was after the M2 0 03, so it started playback from the beginning with M2 0 03 active, then on the second note in the pattern changing to M2 0 02 which was the command of the previous note. Then on the next note (without any command) it returns to M2 0 03 which was the actual command of the previous note so this part is at least expected. The phrases getting selected are correct (first phrase 2 - then phrase 3 - finally phrase 3 again) but the playback is wrong.

Is this how it’s supposed to work or am I missing something?

It’s probably not too hard to edit PhraseMate to get the behavior I want but I don’t really know the Renoise API. Right now it sets the phrase to the selected phrase (at elseif fx_col.is_empty then

– no zxx - add selected) but I would like to replace that which does this:

(pseudo code)

  1. if_col.is_empty then

  2. loop through the effects in the current pattern.

  3. iffx_col.number_string = “0Z” and fx_col.line_index < current_editcursor_line_index set closest_phrase_variable to fx_col.amount_value

  4. end loop

  5. setfx_col.amount_value of current note to closest_phrase if it exists, otherwise 00

So basically loop through the current pattern, if a 0Z was found save the amount_value (aka phrase) to closest_phrase if the line index was less than the current line index and then use that when inserting the new note. Any idea how to do this?

  1. It seems like the Zxx command only overrides the phrase being played instead of actually changing the “clicked” phrase. Is there a reason for this? Because of this you have to insert Zxx everywhere when you want to change the note but keep the phrase instead of just when you want to change the phrase that should play (or Z00 to stop using phrases).

That’s true, a Zxx command is associated with a note.
I found myself in the same situation as you, as I use phrases a lot and often forget to “lock” the phrase using the Zxx command. Hence the PhraseMate tool.

  1. Finally I tested the MIDI program change method of changing the phrase (M2 xx yy) and saw that it actually changed the “clicked” phrase unlike Zxx which is great because it’s the behavior I wanted, but I also noticed it behaved a bit strange. It seems like it doesn’t affect the note where you add the effect but instead any note after that.

Also true, the program change (MIDI) command affects all notes arriving after the command.
I think it makes sense, because the program change is something you’re likely to record in realtime. You can’t press two buttons at the exact same time :slight_smile:

PhraseMate deals with Zxx commands, but I’m also not completely satisfied with how it works.
The thing I’m mostly missing is a “batch-apply” which inserts Zxx commands across the pattern/song/whatever, using the currently selected phrase.

Perhaps your idea is possible too - but I’m not sure what you mean by “closest phrase”?

Perhaps your idea is possible too - but I’m not sure what you mean by “closest phrase”?

Closest phrase just means it looks at the previous note in the pattern, checks if it has a Zxx command, if it does have one it checks the actual phrase value and that is then the closest phrase. Meaning when you enter a new note you use the same phrase as the previous note (in the pattern) that had a phrase which to me makes more sense then the “enter active phrase” thing.

I guess the name doesn’t make too much sense, closest phrase implies it could also check after the note being entered and if a note is found that is closer than the previous note it could use that phrase instead. But I think it’s more reliable to just use the previous phrase used in the pattern, that way you basically always get what you want. Having a key that switches the Zxx command to use the phrase of the next note with a Zxx command could be useful though.

The name doesn’t matter too much as long as it does what I want it to. :ph34r:

Kind of got it working, got a bunch of errors before so not sure everything is working but anyway, you should get a better idea of what I want to do.

Added to PhraseMate.lua in the handle_modified_line function:

local closest_phrase = nil

local pattern_iter = renoise.song().pattern_iterator

local pattern_index = renoise.song().selected_pattern_index

for pos,line in pattern_iter:lines_in_pattern(pattern_index) do

for _,fx_col in pairs(line.effect_columns) do

if _ == renoise.song().transport.edit_pos then

break

end

local has_zxx_command = (fx_col.number_string == “0Z”)

if has_zxx_command then

closest_phrase = fx_col.amount_value

end

end

end

– no zxx - add selected

fx_col.number_string = “0Z”

if closest_phrase == nil then

fx_col.amount_value = “00”

else

fx_col.amount_value = closest_phrase

end

I guess the error is that it stops working when there’s not an 0Z command somewhere in the pattern.