[Csnd] Help with wavetable phase distortion
Date | 2012-12-08 22:06 |
From | Ed Costello |
Subject | [Csnd] Help with wavetable phase distortion |
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 |
Date | 2012-12-09 20:53 |
From | Oeyvind Brandtsegg |
Subject | Re: [Csnd] Help with wavetable phase distortion |
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... best Oeyvind
2012/12/8 Ed Costello <edwardcostello@gmail.com> Hi list, 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 |
Date | 2012-12-10 10:53 |
From | Edward Costello |
Subject | Re: [Csnd] Help with wavetable phase distortion |
Attachments | None None |
Date | 2012-12-10 11:36 |
From | Oeyvind Brandtsegg |
Subject | Re: [Csnd] Help with wavetable phase distortion |
... another stray thought, could you make one log table and one exponential table, and then morph between them using ftmorf? Oeyvind 2012/12/10 Edward Costello <edwardcostello@gmail.com>
-- 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 |
Date | 2012-12-10 17:00 |
From | Edward Costello |
Subject | Re: [Csnd] Help with wavetable phase distortion |
Attachments | None None |