I would like to know, how a slide/portamento function could be realized, which has a constant time, independent from the distance between the source and target frequency. At this page http://www.tb-303.org/info/history.asp it is stated, that the TB303 offers this feature, but I’ve no idea how to implement this properly in software.
The portamento function of MIDIbox SID and FM is realized in the following way: “current_frequency * rate_factor” will be added to the current frequency value on each update cycle, until the target frequency is reached. This works well, but the sweep time between two notes is not constant.
So, what is the trick? Varying the rate depending on the frequency difference? Based on which formula? The frequency curve of the SID is not linear, this propably has to be taken into account… :-/
i’ve just started typing my thoughts on this and then deleted it realizing i was wrong. and i did it 3 times
apparently it’s not that easy to put it down mathematically. my next go at it:
*a few more lines deleted*
well apparently you’ll have to add the frequency difference into the formula. let’s see: one octave slide should last the same as two octave slide and 3 oct slide. so one octave slide’s f1/f2=2 and two octave’s is f1/f2=4 and three octave’s f1/f2=8…
for starters i’d just try adding the freq_high/freq_low to your equasion. something like
This isn’t so bad and brings some improvement. But what should happen if at the middle between previous and new note you decide to play another note? Let’s say, C-1 to C-4 (factor 8 ), and while the frequency is sweeped and has reached the frequency around C-3, D-3 is played. What should happen then? A very long sweep from C-3 to D-3? Or just ignoring this side effect, which wouldn’t happen when a slide is realized with analog components?
Do you know, how other synths with a similar slide feature like the TB303 do react under such conditions?
Best Regards, Thorsten.
P.S.: thanks for your answer! At the time I wrote the initial posting, I already thought: if somebody will answer, then propably Kokoon!
i’ve no idea how such think works in analogue - it’s obviously not a simple slew limiter or a lowpass filter - in order to get constant time it *beeds* to know source and target freq. i think
i remember reading a detailed description of tb-303’s slide somewhere. i’ll see if i can find it.
the example of interrupting the slide that you wrote - shouldn’t the last slide from C-3 to D-3 be FASTER than normal in that case? anyway - i’d just store the last frequency in the process of sliding and treat that as the last pressed note before the slide.
no need thanking me - i’m honored i can help you with this
the example of interrupting the slide that you wrote - shouldn’t the last slide from C-3 to D-3 be FASTER than normal in that case? anyway - i’d just store the last frequency in the process of sliding and treat that as the last pressed note before the slide.
yes, I guess that in reality it would be faster. You are right, by using the old “slide rate factor”, which was calculated at the time the slide has started, the effect would be more realistic. Maybe I should try this.
Can this help?
unfortunately not, because the question is, how to transfer a “constant time slide” into the digital world.
Ok, this evening I will try out Kokoon’s suggestions
yeah that’s the page i meant. i found it too - but like TK said, there isn’t anything there that helps us with this.
yes, I guess that in reality it would be faster. You are right, by using the old “slide rate factor”, which was calculated at the time the slide has started, the effect would be more realistic. Maybe I should try this.
actually no - the “constant slide time” rule would be violated in any case if you won’t use the current frequency to calculate the rate modifier. do you know what i mean? each time a slide is started you calculate the “rate modifier” = max(curr_freq, target_freq)/min(curr_freq, target_freq) and use it. you shouldn’t get curr_freq from last played note because the current frequency might be different if there’s a slide already in progress. do you agree?
oh and that *beeds* up there in my second post should be *needs*
actually no - the “constant slide time” rule would be violated in any case if you won’t use the current frequency to calculate the rate modifier. do you know what i mean? each time a slide is started you calculate the “rate modifier” = max(curr_freq, target_freq)/min(curr_freq, target_freq) and use it. you shouldn’t get curr_freq from last played note because the current frequency might be different if there’s a slide already in progress. do you agree?
I know what you mean, but this is what I already tried months ago, and the effect wasn’t really good, because the result is far from the behaviour of the analog circuit, just because the formula is too much simplified (and it *must* be simple, since 16bit calculations are taking many many cycles on the PIC!). However, your post inspirated me to a nice solution, just let me try it out
Currently I’m trying to find a formula which works without division, and which delivers not precise, but adequate results (in analog world nothing is precise anyhow ;-))
This one is promissing:
current_frq += int((current_frq * porta_rate) >> 16);
porta_rate += int(((target_frq>>8) * (porta_rate>>8)) >> 8);
[/code]
because it requires only a 16x16 multiplication (like the "normal" portamento function of MBSID), and a 8x8 multiplication (can be done within 1 CPU cylce)
Best Regards, Thorsten.
Despite of the small error in the formula (results are only correct with a slide from low to high frequency), it’s mathematically correct, but the slide doesn’t sound that good. I’ve the impression, that frequency changes must be higher at the beginning…
Forget the formulas: I just have started Rebirth, and it seems that a “constant time slide” is realized by transposing the starting value into a range which is close to the target note. Is this the typical TB303 slide effect?
so - the tables you posted that resulted in time differences (1 octave VS 3 octaves) - is the time difference because of inaccurancies in division (the inaccurancies are accumulative because you’re using previous cycle’s calculated frequency for the new one) or because of error in formula? i’ve tried to simulate that series in excel but didn’t manage to finish it i suck at excel haha. but i’m here at seaside for weekend and i don’t have anything else… hmmm i could with javascript…
regarding your last solution - 5 semitones - what if the desired slide is less than 5 semitones?
so you’re saying rebirth (and probably tb-303) is doing the same?
anyway - theoretically - is this statement correct - for 3x stronger slide (frequency range 3x larger) you need 3x faster slide? i mean - if the slides were linear (they’re exponential) that would be correct… but is it still correct with exponential curves?
you said it would sound better if the slide was faster from the beginning - what if we’d try with linear slide (constant addition per cycle)? have you already tried that?
i’ve tried to simulate that series in excel but didn’t manage to finish it
only lamers (and managers ;-)) are using excel.
At the begining I used this short perl program - I made a lot of modifications, which haven’t been saved, but I guess that it helps you:
my $porta_rate1 = 0.1;
my $current_frq = 220;
my $target_frq = 2*440;
#my $target_frq = 4*440;
#my $target_frq = 8*440;
my $porta_rate2 = $target_frq / $current_frq;
my $porta_rate = $porta_rate1 * $porta_rate2;
printf "Current Frequency: %5d\n", $current_frq;
printf "Target Frequency: %5d\n", $target_frq;
printf "Portamento Rate: %5.4f * %5.4f = %5.4f\n", $porta_rate1, $porta_rate2, $porta_rate;
my $step = 0;
while( $current_frq < $target_frq ) {
++$step;
$current_frq += $current_frq * $porta_rate;
if( $current_frq > $target_frq ) { $current_frq = $target_frq; }
printf "%6.3f mS: %d\n", 0.8192 * $step, $current_frq;
}
[/code]
> regarding your last solution - 5 semitones - what if the desired slide is less than 5 semitones?
then the 5 semitones modification will be skipped.
> so you're saying rebirth (and probably tb-303) is doing the same?
it seems, that at least rebirth is doing the same, maybe also because they payed more attention for the sound result, than for accuracy. Not sure, how a real TB303 behaves here.
> anyway - theoretically - is this statement correct - for 3x stronger slide (frequency range 3x larger) you need 3x faster slide? i mean - if the slides were linear (they're exponential) that would be correct... but is it still correct with exponential curves?
It should
> you said it would sound better if the slide was faster from the beginning - what if we'd try with linear slide (constant addition per cycle)? have you already tried that?
The idea isn't that bad, it would mean, that higher notes are sweeped more slowly than lower notes.
Best Regards, Thorsten.
Haven’t tried a linear slide yet, since I think that it doesn’t lead to the desired effect. Guess what happens when the frequency sweeps from a high to low note.
In the meantime I think, that the exponential charging and decharging curve of a capacitor has to be modelled. I did something similar with the envelope curve feature (algorithm found by Jess D. Skov-Nielsen), maybe using the same for portamento will result into the desired effect: