# Calculating The Proper Points For The Envelopes

Now a question on an area i’m not very good at.
I’m trying to figure out proper synchronisation rates for the instrument envelopes.
I know with LPB = 1, each line requires 24 rasterlines in the envelope frame.
When LPB is 2, it requires 12.
If LPB = 3, the amount of lines turns 9.
LPB 4 is 8 lines and now we get to the tricky area:
LPB 5. If i set the tick-amount in the song settings to 5, i have no problem synchronizing.
the same goes more or less for LPB 7, but these primal LPB rates aren’t exactly envelope-friendly.

Is there any reasonable formula that can be formed to translate an amount of lines to match to a distance between two envelope points?
Or should i simply take care that the ticks in the song settings match the prime value of the LPB? (5, 7, 11, 13)

I messed around with this.

• Used Instrument Settings’ Pitch Envelope to hear what was happening. (low to high, linear)
• Set BPM to 32 to see what was happening (observed the pitch envelope)

Put a note on every line. Loop. Observe. Try it yourself. Hours of fun

-=-=-

LPB 1, TPL 3
For each pattern editor line “24 raster points” are divided into 3.

LPB 1, TPL 5
For each pattern editor line “24 raster points” are divided into 5.

LPB 1, TPL 16
For each pattern editor line “24 raster points” are divided into 16.

-=-=-

LPB 2, TPL 3
For each pattern editor line “24 raster points” are first divided into 2, then this is divided into 3.

LPB 2, TPL 5
For each pattern editor line “24 raster points” are first divided into 2, then is divided into 5.

LPB 2, TPL 16
For each pattern editor line “24 raster points” are first divided into 2, then this is divided into 16.

-=-=-

LPB 3, TPL 3
For each pattern editor line “24 raster points” are first divided into 3, then this is divided into 3.

LPB 3, TPL 5
For each pattern editor line “24 raster points” are first divided into 3, then is divided into 5.

LPB 3, TPL 16
For each pattern editor line “24 raster points” are first divided into 3, then this is divided into 16.

-=-=-

Seeing the pattern yet?

• I think the magic number is 24.
• For each pattern editor line, the instrument envelope will be triggered at each (24 / LPB / TPL) point. (for the duration of the line)

Hope this helps.

Based on previous observation. If the distance between two instrument envelope points is 80 “raster lines” then the amount of lines this is will be (I think)

80 / (24 / LPB)

TPL is not important in this case. It’s just the amount of “equally divided slices” that will be triggered per line.

Am I wrong?

I did, got sick and tired of hearing the same notes over and over again (even though i sometimes changed them)

I already got that far. I was particulary aiming for a straightening solution for the LPB values that do not divide 24 into rounded figures.

I need to synchronize points with exact line positions, not the other way around. But i suspect you mean we can consider a reversed algorithm based on that data?

For 1,2,3,4 and everything that can divide 24 nicely into smooth figures, tpl doesn’t really matter much.
TPL seems important in the cases where you would have to put points on envelope-positions with decimals behind the comma:You can’t do that in the envelope-editor in those cases. If you did the same I already mentioned LPB 5 and 7: 24/5 is already not a complete number, and that again divided by 5 doesn’t make the number any smoother. You can make nice southern rythmic patterns with those though (positioning points on 4 and 7 instead of 4 and 8 and looping on point 12 for instance) but it is hard to place points on positions that equal exactly each xth line in the pattern editor with those LPB values.

Okay, new idea…
Lets simply scrap the support for the incompatible LPB values and try to convert the BPM to an alternate LPB setting instead…
I think this works a lot better as the envelope is automatically adjusted to the bpm anyway.

I think this looks like it:

``````
function sample_envelope_line_sync()
local lpb = renoise.song().transport.lpb
local bpm = renoise.song().transport.bpm
local rasters_per_line = 24/lpb
local approach = rasters_per_line - math.floor(rasters_per_line)
if approach > 0 then
if lpb > 24 then
bpm = (bpm / 24 * lpb)
lpb = 24
else
if lpb > 12 and lpb ~= 24 then
bpm = (bpm / 12 * lpb)
lpb = 12
end
if lpb < 12 and lpb > 6 then
bpm = (bpm / 8 * lpb)
lpb = 8
end
if lpb == 5 then
bpm = (bpm / 6 * lpb)
lpb = 6
end
end
renoise.song().transport.bpm = bpm
renoise.song().transport.lpb = lpb
rasters_per_line = 24/lpb
end

return rasters_per_line

end

``````

Anyone having a better idea is welcome to improve.

Are you updating the epic arpeggiator tool to be able to dump arpeggio patterns to the pitch envelope of an instrument?

next to the envelope, there’s instrument LFO’s. how does their frequency value relate to the song timing? I tried a bit but I can not get a filter cutoff lfo to sync to a 32line pattern with a 8 lpb. it’s fun to hear though.
does anybody know?

I think it depends on the amount and frequency mix, but i haven’t actually tried to figured out how they relate.
Just to give a wild guess example: if amount would be 6 and frequency 6, and this would represent 12LPB. to maintain 12LPB you would have to alter both values in different settings to keep the pace (3/4, 1/12 etc).
The best shot to test what it is is to set one of them to 1 and experiment with the other value. And then reverse the experiment by keeping the other value at 1.