| Hi,
I have to nerve you with another strangeness I found: On Linux,
'tanh' does not what it's supposed to do:
Could anyone try out the following orc/sco and run without '-d'
option, so you can see the displayed waveform ?
For me, when 'tanh' is used to distort the sine, a extremely
strange 'spike-output' is the result. The second version,
using tanh as (exp(x)-exp(-x))/(exp(x)+exp(-x))
(thats how tanh is defined!), however, works as expected
(and also sounds that way).
Another strangeness is, that when I set kr=44100, ksmps=1,
both versions work ok...
Thomas
;score
f1 0 512 10 1 ; Sinus
t 0 80
i1 0 0.5
i1 0.8 0.5
i1 1 0.2
e
;orchestra
sr = 44100
kr = 441
ksmps = 100
nchnls = 1
instr 1
kgate adsr 0.2,0.5,0.8,0.5
asrc oscili 5*kgate, 500, 1
; does produce strange spikes
adist1 = tanh(asrc)
; works as expected
adist2 = (exp(asrc)-exp(-asrc))/(exp(asrc)+exp(-asrc))
;display the output
display adist1,0.05
display adist2,0.05
; out 15000*adist1
out 15000*adist2
endin; |