New Tool (2.8): Notes to Envelop

Transfers note position, delay, pitch, volume and pan to the selected instrument’s envelopes.
I made it in response to this request (thanks Djeroek!) but thought it worked better as a standalone tool, just assign it to a key and of you go .

Reads from first note column of the selected track and writes to the selected instrument
If it doesn’t get it right first time try transposing the track data up or down an octave

Wicked, thanks! :drummer:

handy mcmandy ,niceone

Thanks!

You can pretty much program instrument envelopes using the pattern editor which I’m finding very handy… next version will handle note offs

Hello Afta8, could you please point me to some info on how to program instrument envelopes using pattern editor?

Yeah sure, it’s simple really.

  1. Program the pattern editor.
  2. Select the instrument you want the envelope written to.
  3. Make sure the track with the pattern is selected.
  4. Run the tool.

This should copy the pattern to the instruments envelope.

I have made another tool that makes it easier to program melodies directly to the instrument envelope, you may prefer it. Check it out here: New Tool (2.8): ReSeq

10 minute hack so I don’t know if it will help to get this tool to work with Renoise 3.1. The script is fixed to operate on modulation set 1, with a volume/pan/pitch envelope.

As usual I haven’t tested it so no guarantee folks, see if it installs first :slight_smile:

(See below)

10 minute hack so I don’t know if it will help to get this tool to work with Renoise 3.1. The script is fixed to operate on modulation set 1, with a volume/pan/pitch envelope.

As usual I haven’t tested it so no guarantee folks, see if it installs first :slight_smile:

Oy, thanks for taking the time on this one!

After creating an envelope device and putting some notes inside the pattern editor the tool translates them to pitch values, only thing that is off at the moment is translating the time in between notes. All the notes are cropped within a very short timespan, instead of spread across the right amount of beats sounding like a 1:1 conversion of what is happening in the pattern editor.

It doesn’t matter if you manually create an envelope device with plenty room, running the tool will always paste in 725 ms = 1.127 beats worth of envelope time.

The original tool did take into account the time between note-events, hope this is easily solvable? :slight_smile:

Yeah, you are right Djeroek. I was kinda hoping that the original mathematics from 2.8 would’ve held up, but it looks like the way in which the point time is worked out may have changed. I’d have to have a think about that though, and I can’t promise anything. It was a nice little 10 minute try though :slight_smile:

Hmm, well, errr, interesting Djeroek…(3 hours later and about as many cups of coffee…)

I’ll leave what I got here (probably for posterity sake as I’m not sure it is worth anything really in its current form…)

To try and keep this concise…The problem I have is with this constant

renoise.SampleEnvelopeModulationDevice.MAX_NUMBER_OF_POINTS

Which I believe is set at 6144. And this function:

-- Add a new point value (or replace any existing value) at time. 
renoise.song().instruments[].sample_modulation_sets[].devices[]:add_point_at(time, value)

The problem I have is you can’t call that above function with a value greater than 6144 (6.144 seconds) as the time parameter. So you can’t add a point to the envelope say at 8 seconds.

Well at that point I got a bit fed up :unsure:

So sorry about that Djeroek, unfortunately I didn’t quite live up to ‘legend’ status :slight_smile:

Edit: Oops, I forgot about the delay column :slight_smile:

Second Edit: Also see post #21 below for a variation…

still legend for picking this up :wink: , 6.144 seconds will be enough for most instrument build-noodling I am doing at the moment so I’m very happy with this, thanks again!

I think 6144 was the old pre-3.1 limit, right, 16.38 seconds seems to be the current limit, strange more time can’t be accessed through the api?

I think 6144 was the old pre-3.1 limit, right, 16.38 seconds seems to be the current limit, strange more time can’t be accessed through the api?

Strange indeed sir. I do know that you can’t call that function with a time value greater than 6144. Bug? Oversight? That I don’t know :unsure:

Slightly interesting. If you however go via the GUI it does give a max time span of 16.38 seconds…But wait!..What is the upper time span if you work in beats? I get 64 beats…

Attachment 6664 not found.

I’ve added two points at the start and end of the envelope.

Now click the ‘time icon’ to put it back into ms time mode…I get…

Attachment 6665 not found.

It’s now showing a max time span of 38.4 seconds?

Make of it what you will Djeroek :wacko:

Slightly interesting.

Indeed

Indeed

Ah, I’m not nowhere near as a clever or confident as yourself/dblue/Ledger/afta8 at programming/music/mathematics/people sir. I have to be very very careful what I say is buggy/strange or not, hence the word ‘slightly’ :slight_smile:

@4Tey, nice one for picking this up :yeah:

Not sure what the issue is with the point settings, will try to find time to dig into it, I haven’t yet had the chance to get into the API for 3.1

Not sure what the issue is with the point settings, will try to find time to dig into it, I haven’t yet had the chance to get into the API for 3.1

Hi afta8, no trouble :slight_smile:

Just quickly, this function:

-- Add a new point value (or replace any existing value) at time. 
renoise.song().instruments[].sample_modulation_sets[].devices[]:add_point_at(time, value)

If I call that with a value greater than MAX_NUMBER_OF_POINTS (which is set at 6144 (6.144 seconds) ) I get:

>>> renoise.song().instruments[1].sample_modulation_sets[1].devices[1]:add_point_at(6145,0)
*** std::logic_error: 'envelope.point: invalid point time. time must be >= 1 and <= MAX_NUMBER_OF_POINTS'

So it is next to impossible to add a point to the envelope up to 16.38 seconds. Also to complicate the issue, via the GUI you can kinda add points to the envelope up to 38.4 seconds of time :wacko:

Anyway that’s more a Taktik thing (which we won’t go into because, well, Taktik certainly isn’t :smiley: )

(The following is assuming the current download in Post #10…)

Now to bore you to death with silly technical nonsense afta8 :slight_smile:

Watching Djeroek run your 2.8 version of this tool was painful, so I figured I’d try and help the man out a little (hope you don’t mind :slight_smile: ) So 10-15 minutes later I put in a For loop that crudely scans for a Volume/Pan/Pitch envelope device in modulation set 1 (See lines 46-56 of main.lua). Works okay, well for what Djeroek needs for his experiments anyway, but naturally it isn’t amazingly solid and bullet proof. You would probably have some sort of GUI where the user can select the target envelope device(s) or something of that nature.

Now unfortunately I was kinda hoping that your math would hold up, wishful thinking on my part. I never programmed 2.8 envelopes but I assume it worked in ‘ticks’ (looking at your math.) It works in milliseconds now, so I had to think about how to calculate this. Luckily you wrapped your calculation part in a local function, I’ve modified it to now read (lines 126-135):

-- Function to return an envelope time position for a given pattern line number and delay value
  local function env_tick(line, delay)
    local line_ticks = ((((line-1)/lpb)/bpm)*60000)+1
    local delay_ticks = ((((1/lpb)/bpm)*60000)/256)*delay   
    if line_ticks > renoise.SampleEnvelopeModulationDevice.MAX_NUMBER_OF_POINTS then
      line_ticks = 0
      return line_ticks
    else
      return line_ticks + delay_ticks
    end
  end

Now I don’t know, I just came up with that quickly (but you would probably do it better and differently than that.)

That’s about it modification wise. The only other thing is line 152, which at the moment reads:

note = ((note-1)%24+1)/24 -- Convert note pitch to envelope value

That is your original conversion from a Renoise note to a pitch value. Thing is you could probably do that better now, as Renoise caters for up to 96 semitones (8 octaves) on its pitch envelope? Something to think about :slight_smile: Also I haven’t verified if the volume or pan calculation works correctly in Renoise 3.1.

My God, that is a boring read :smiley:

Thanks 4Tey, don’t mind at all you hacking this, I’m away from my studio at the moment so not much use in fixing this right now anyway!

If I remember correct in 2.8 envelopes were in ticks but this also meant that they were beat synced so specifying envelope times in seconds wouldn’t make much sense for this tool.

The simplest solution would be if envelope times in v3.1 could be set in ticks or beats… If I could look at this right I would probably be looking at how to switch envelopes into beat sync mode and then trying to set envelope points so that they correspond to the line/beat of the source pattern.

The simplest solution would be if envelope times in v3.1 could be set in ticks or beats… If I could look at this right I would probably be looking at how to switch envelopes into beat sync mode and then trying to set envelope points so that they correspond to the line/beat of the source pattern.

Yes indeed, I think this will switch the envelope into your preferred ‘beat times’ mode afta8:

-- When true, the device has one of more time parameters, which can be switched to operate
-- in synced or unsynced mode (see tempo_synced)
renoise.song().instruments[].sample_modulation_sets[].devices[].tempo_sync_switching_allowed
  -> [read-only, boolean]

-- When true and the device supports sync switching (see 'tempo_sync_switching_allowed'),
-- the device operates in wall-clock (ms) instead of beat times.
renoise.song().instruments[].sample_modulation_sets[].devices[].tempo_synced, observable
  -> [boolean]

Tempo_sync switching flag. But (again slightly interesting <- danoise edit :smiley: ) I can’t find a way of adding a point to the envelope in ‘beat time’ mode via lua. The function ‘add_point_at’ seems to require the time in ‘wall-clock’ milliseconds (which to be honest with you is the way I naturally assumed it was…But I’m really silly strange :D) I’m not a Renoise or Lua expert, I could’ve missed something really obvious (yes I did). It is just a quick hack. If you ever come back to look at this script, I’m certain you’ll do the calculations and sort it way better than me afta8 :slight_smile:

The function ‘add_point_at’ seems to require the time in ‘wall-clock’ milliseconds

I believe you just need to set the sync of the envelope beforehand (this should convert/update existing values too),

then you can pass the entire table of points in a single go. This should be slightly faster, too.

Beat-synced: one beat equals 256 units

Wall-clock: one second equals 1000 units

I also took at quick look at the length, couldn’t find any way to bypass the limitation of6144, unfortunately. We have to fix this in an update.

Ah danoise, you are right :slight_smile: Renoise does the conversion depending on time mode. When I see ‘time’ in a API I naturally think nanoseconds/milliseconds/seconds…I wish someone told me before I sat down with a calculator and worked out a silly inaccurate useless formula in ‘wall time’ mode :rolleyes: :smiley: