On Sunday 9 December 2012 at 21:53, Oeyvind Brandtsegg wrote:
Not sure, but I wonder if it would perhaps be more efficient (well, give a more stable usage anyhow) to calculate the mapping at audio rate as needed instead of calculating all values and writing to table whenever the parameter settings change. The actual calculation does not look too heavy, but doing a k-rate loop over a whole table can easily cost a lot, also depending on table size of course.Just as a stray thought, perhaps you could also use the pdhalf opcode for something here? It would be linear segment instead of smooth...bestOeyvind2012/12/8 Ed Costello <edwardcostello@gmail.com>Hi list,I'm making a wavetable synth and I have implemented a phase distortion opcode that controls where and at what rate parts of the wavtables tables are read. The phase distortion opcode creates a 'wavereader' table that is read using a phasor, this in turn is then plugged into a table read opcode which reads the actual audio waveform.It all works fine except that when I change the phase distortion parameters it takes a load of cpu to rewrite the phase distortion table. I was just wondering could anyone suggest a more efficient way of implementing this. The opcode is this:opcode LogarithmicToExponentialCurve, i, kki
k_Bend, k_Stretch, i_FTSize xin
k_BendTracker init -1
k_StretchTracker init -1
gi_LogExpTable ftgen 0, 0, i_FTSize, -2, 0
if k_BendTracker == k_Bend || k_StretchTracker == k_Stretch then
kgoto End
elseif k_BendTracker != k_Bend || k_StretchTracker != k_Stretch then
k_BendTracker = k_Bend
k_OneMinusBend = 1-k_Bend
k_Index = 0
Loop:
k_X = k_Index / i_FTSize
k_TableValue = ((k_X^k_Stretch * k_OneMinusBend)+((k_X^(1/k_Stretch)) * k_Bend))
tabw k_TableValue, k_Index, gi_LogExpTable
loop_le k_Index, 1, i_FTSize, Loop
endif
End:
xout gi_LogExpTable
endop
Thanks,
Ed
--
Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205
http://flyndresang.no/
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://soundcloud.com/t-emp