New Tool (3.1): PhraseMate

I just committedsomething. According to the tests, I’ve fixed the issue - would be great if you could confirm this?

Here’s a link to the raw file (xScale.lua)

Yes, you fixed the particular case, I can confirm, and I couldn’t find any issue so far. Thanks!

Okay so I’m back to playing with this, and it’s definitely really cool :slight_smile:

A couple things that I think are problems…

  1. When I collect patterns to phrases (scope: “track in song”), the resulting phrases don’t respect LPB automation. e.g. if I have a ZL08 command in the master track as the first line of a pattern, the phrase gets its LPB set to 4 instead of 8. Same when writing, if a phrase has LPB 8 and is written to a pattern that is LPB 4, I think it needs to create multiple columns with delay offsets to maintain the timing.
  2. If I write to a selection that already contains a Zxx command, PhraseMate keeps it there instead of overwriting / deleting it. I think a picture will help…

8032 Screen Shot 2018-04-25 at 8.59.01 PM.png

The first track is the note with the Zxx command. The second track is what I get when I write a phrase to selection with mix-paste disabled, insert Z00 disabled. The third track is with insert Z00 enabled, mix-paste still disabled. I think the Z04 that we see there should be removed in the first case, and overwritten in the second case. The current behavior makes sense to me if I were to enable mix-paste.

Now for the feature request that would make PhraseMate the most ridiculously useful tool ever for me :slight_smile:

Render phrase(s) to pattern.

Here’s how it works (and I can do it manually with PhraseMate today!!)

  1. Select an area to write the phrase to

  2. Choose the phrase that corresponds to the Zxx command

  3. Write phrase to selection

  4. Transpose selection to match the original note with Zxx command

Again, a picture probably helps here…

8033 phrasemate-unroll.gif

So you can see what I want to do is, insert phrases into the pattern to get the sound I want, then write the phrase data back into the pattern so I can manipulate it again.

What I would LOVE to do is select an area in the pattern or matrix that has phrase notes entered, run a command, and have it automatically do all those steps that I did above.

Hi Pat,

I didn’t have plans to put out a new release any time soon, but:

When I collect patterns to phrases (scope: “track in song”), the resulting phrases don’t respect LPB automation. e.g. if I have a ZL08 command in the master track as the first line of a pattern, the phrase gets its LPB set to 4 instead of 8. Same when writing, if a phrase has LPB 8 and is written to a pattern that is LPB 4, I think it needs to create multiple columns with delay offsets to maintain the timing.

This indeed doesn’t happen - and probably should. It will add a lot of additional processing time, though, since the tool will have to examine all tracks (hm, but I just got an idea here…)
In any case, I would implement it so that, when reading from the pattern, the phrase is set to the highest LPB which was encountered during scanning (preserve fidelity and avoid creating extra columns).

On output - heh, well there is no guarantee that things will sound the same if the phrase LPB is higher than the song. So the tool should probably warn you when “compacting” things like that.

  • If I write to a selection that already contains a Zxx command, PhraseMate keeps it there instead of overwriting / deleting it

I believe the tool isn’t even aware of local Zxx commands (sample effect columns), so there’s definitely room for improvement here.
I like your thinking here, makes sense I think.

Now for the feature request

Yep, that justs needs to work like that - totally agree.

I didn’t have plans to put out a new release any time soon

I’m not sure if you’re saying that now you’re thinking about a new release based on my ideas :slight_smile: or that you’re still not planning to.

In any case, I’m happy to try helping with these. Part of my intention with that post was to 1) confirm these are things that you want to address and 2)talk through ideas for how to do it. I didn’t want to spend a ton of time trying to figure this stuff out if you felt it didn’t fit with the PhraseMate vision.

My basic plan is to start with a naive implementation that works only with my specific cases – I’ll talk about those later.

This indeed doesn’t happen - and probably should. It will add a lot of additional processing time, though, since the tool will have to examine all tracks (hm, but I just got an idea here…)

In any case, I would implement it so that, when reading from the pattern, the phrase is set to the highest LPB which was encountered during scanning (preserve fidelity and avoid creating extra columns).

I took a quick stab at this last night, and it seems like PhraseMate doesn’t know the current LPB at any given pattern, does it? Like Renoise isn’t calculating and reporting the song LPB at a specific position.

The way I use LPB, I have one command per pattern in the master track. So a first pass at this (for me) is reading the first line of the pattern on the master track to see if there’s a ZL command on it. If so, use that value as the phrase LPB.

On output - heh, well there is no guarantee that things will sound the same if the phrase LPB is higher than the song. So the tool should probably warn you when “compacting” things like that.

Yeah I see how this is a bit tricky. I thought it would work similarly to inserting triplets, but I think the problem is that the note OFF won’t be accurate. Even if you time all the note ONs correctly using delay, the OFF won’t take place until the next line, right?

Perhaps PhraseMate can insert ZL commands to change LPB, and add lines to the pattern to fit the higher LPB phrase data? That seems like it could get dicey quick. Maybe I just need to split my patterns at the LPB switch points?

I believe the tool isn’t even aware of local Zxx commands (sample effect columns), so there’s definitely room for improvement here.

I like your thinking here, makes sense I think.

Well this is strange because it doesn’t seem to behave the same way for me right now as what I reported earlier. I’ll have to keep an eye on it and see if I can figure out what’s going on.

Yep, that justs needs to work like that - totally agree.

Okay tell me what you think about these first passes at the three pieces:

Transposition

  1. Read the phrase base note

  2. Read the note that triggers the Zxx command

  3. Calculate the offset between them

  4. Apply that offset to the notes being written to the pattern

Render current phrase

  1. Look backwards from the current line until we find a Zxx command

  2. Look forward until there’s an OFF or a different note

  3. Write phrase to pattern using those start and end points

Auto-render multiple phrases

  1. User selects a range

  2. Repeat the “render current phrase” process for each phrase found in the range

btw this is the error I get when trying to run PhraseMate from git:

'/Users/padillac/Library/Preferences/Renoise/V3.1.1/Scripts/Tools/com.renoise.PhraseMate.xrnx/main.lua' failed in one of its notifiers.
The notifier will be disabled to prevent further errors.

Please contact the author (danoise [bjorn.nesby@gmail.com]) for assistance...

./source/cLib/classes/cProcessSlicer.lua:118: ./source/PhraseMate.lua:883: variable 'xPatternSelection' is not declared
stack traceback:
  [C]: in function 'error'
  ./source/cLib/classes/cProcessSlicer.lua:118: in function <./source/cLib/classes/cProcessSlicer.lua:105>

Easy enough fix: add

cLib.require (_xlibroot..'xPatternSelection')

to main.lua

Well I added basic auto-capture and transpose, it makes the process a LOT faster! I’m going to use it for a bit, see if there are any problems, and then look into adding multiple / track auto-capture – or maybe that’s something danoise can figure out :slight_smile:

(also, you can see in the screen cap that it’s incorrectly keeping the Zxx command in the effects column again… not sure what’s going on there)

changes on GitHub:https://github.com/renoise/xrnx/pull/136

8034 phrasemate-auto-capture.gif

I’m not sure if you’re saying that now you’re thinking about a new release based on my ideas smile.png or that you’re still not planning to.

Eh, I see now I wasn’t being clear. I just wanted to share my thoughts, as I currently don’t have much time to spare.
But what you’ve done - very cool smile.png I hope my code has been readable enough.

I took a quick stab at this last night, and it seems like PhraseMate doesn’t know the current LPB at any given pattern, does it? Like Renoise isn’t calculating and reporting the song LPB at a specific position.
The way I use LPB, I have one command per pattern in the master track. So a first pass at this (for me) is reading the first line of the pattern on the master track to see if there’s a ZL command on it. If so, use that value as the phrase LPB.

Yeah, that would work for your particular way of doing things, but is hardly a generic solution.
That “idea” that I mentioned basically involved asking Renoise to play a very brief segment of the song in order to determine the LPB. It’s a hackish solution, but much bettern than having to (worst case, but potentially) checking each and every line in the entire song.
With solid proof of the starting points LPB, we need only to parse the lines in the actual region being turned into a phrase.

Would definitely be nice to a method for determining this sort of thing via the API!

Perhaps PhraseMate can insert ZL commands to change LPB, and add lines to the pattern to fit the higher LPB phrase data? That seems like it could get dicey quick. Maybe I just need to split my patterns at the LPB switch points?

Seems a bit like creative workarounds to me. I would really prefer that it tries its best to conserve the song as-is, warning you when there’s the possibility of “data loss” (the changes might be subtle, but it’s hard for the tool to know).

Okay tell me what you think about these first passes at the three pieces:

Transposition

  1. Read the phrase base note
  2. Read the note that triggers the Zxx command
  3. Calculate the offset between them
  4. Apply that offset to the notes being written to the pattern

Figuring out the offset, yep.

Render current phrase

  1. Look backwards from the current line until we find a Zxx command
  2. Look forward until there’s an OFF or a different note
  3. Write phrase to pattern using those start and end points

Yep - looking forward/backwards can be achieved with xNoteCapture, using a custom callback function.
There is also xRule, but it’s probably overkill for this particular scenario.

Also, in case the user has selected a scale, this needs to be applied to the notes being written.
Otherwise the rendered notes can end up sounding different than when playing through the phrase.

btw this is the error I get when trying to run PhraseMate from git:

Ah yes, the repository is not the stable version. But I believe the only changes I’ve done to PhraseMate, compared to the last release, are refactoring some parts into xLib/cLib classes.

But what you’ve done - very cool I hope my code has been readable enough.

Totally! I feel like I’m making a mess of things – I’m not familiar with all the tools that Renoise / xLib provide, but I’m getting there. But the fact that I’ve been able to add this functionality so quickly is a testament to all the work you’ve done, so thank you.

Seems a bit like creative workarounds to me. I would really prefer that it tries its best to conserve the song as-is, warning you when there’s the possibility of “data loss” (the changes might be subtle, but it’s hard for the tool to know).

Agreed. I was thinking maybe at first it just puts up an alert box saying the phrase LPB doesn’t match the pattern LPB, and skips rendering that phrase. Just leave the note + Zxx command in there when LPB doesn’t match.

Yep - looking forward/backwards can be achieved with xNoteCapture, using a custom callback function.

Super cool, I used it to add “auto-capture current phrase” so I don’t even need to make a selection. It just looks to see if there’s a phrase command on the current line or a previous line, and write the phrase data to the pattern until the next note ON / OFF event stops the phrase. That certainly matches my way of working more.

Thank you!

Request: “Explode pitches to phrases”. Converts a selection to phrases, separated by “pitch class” and converted to C, so we can re-use and trigger chords/arp-figures with Z01, Z02, Z03…

I’ve been dabbling with my own tool for this (“phrase voicer”), but it kind of fits into phrasemate, doesn’t it?

Extra bonus for ad-hoc converting from/to Axx-arpeggios :slight_smile:

Problem when these assigned to hotkeys:
“Write phrase to selection in pattern” & “write phrase to track”
They work from the menu though. But fail when triggered by keycommand.

com.renoise.PhraseMate.xrnx/’ failed to execute in one of its key binding functions.

no static ‘apply_phrase_to_selection’ in class ‘PhraseMate’
stack traceback:
[C]: ?
main.lua:261: in function main.lua:258

1 Like

I have an issue trying to get 1 phrase created from multiple instruments. IDK if I’m just missing something obvious or if this is a bug. I would like to be able to combine all of the instrument samples into one phrase (this would involve merging them into a kit I assume?) This is very difficult to do manually since I do not know the original file location of these samples. Right now, I am only able to merge 1:1 phrases across instruments (i.e. each instrument gets its own phrase). Thanks a bunch!



You can use Combine Instruments tool to merge samples into a kit

Create a track with matching number of columns to the number of sample tracks you have (in your case 5)
Copy the column from the original track of the sample, into a free column of your new track (eg. kickldk14 to column 1, hatldk10 to column2 and so on)
Match the notes of the columns according to the notes of samples in the drum kit eg. C-3, D-3, F#3, G#3, A#3

You can also quickly change the sample number for all notes in a track with Convert Instrument Number tool

Screenshot 2024-03-03 at 21.21.45

1 Like

This worked! Thanks so much.

1 Like

Is there an upgrade for renoise 3.4.3 ? The phrase to section copy method doesn’t seem compatible with the new version.

EDIT: I was able to bypass this error by selecting “adjust settings” on the column and then “write to track”