Re: [Audacity-devel] Speed up Square, no alias generator
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: Steve t. F. <ste...@gm...> - 2012-03-31 17:12:54
|
On 31 March 2012 10:35, James Crook <cr...@in...> wrote: > Norm, Roger, Steve - Thanks for this. > > Norm, thanks especially for the link to the doc. > > > Putting this all together it looks to me as if the best route forward > might be to use Tonegen.cpp's GUI with Nyquist's code. It saves > writing/testing/debugging quite a bit of code. I'm relying here on > Roger's statements about Nyquist's efficiency. An advantage is that > people who understand the details can rapidly experiment with new > Nyquist variants on the algorithms, and the best can then be 'baked in' > to tonegen with almost no risk of regressions. > > The quickest route is to hack together a bridge from tonegen to Nyquist, > and that is what I would propose to do. A later more measured approach > would be to add the GUI niceties of the C++ GUI to Nyquist effects in > general. > > Steve, are you interested in extending your nyquist tone generator to > handle linear and logarithmic varying frequencies (slow variation), so > that it can become a replacement for the ToneGen back end? I'm certainly happy to look into it and see what I can come up with. Steve > > --James. > > > > > > > On 31/03/2012 06:01, Norm C wrote: >> There are several other good techniques, too. See, for example, >> http://www.cs.washington.edu/education/courses/cse490s/11au/Readings/Digital_Sound_Generation_1.pdf >> >> Generation of a sine whose phase increments at a constant rate (as here) can >> be done an order of magnitude faster than simply calling a sin() library >> function, by just using a 2nd-order filter (with poles on the unit circle), >> with feedback. Aside from the setup, no trig function calls required at all. >> (BTW this could be used to speed up simple tone generation significantly). >> >> Generation of high-frequency alias-free square waves by simply summing these >> sines, is efficient due to the low number of harmonics required. >> >> Generation of low-frequency low-alias square waves can be done efficiently >> by generating the aliased square wave then adding a correction function >> surrounding each transition. See the "Virtual Analog Oscillators" section of >> the documented linked to above. He doesn't cover square waves, but you can >> generate 2 sawtooths, 90 degrees apart, and subtract them to get a square >> wave. This technique is good for low-alias sawtooths and triangle waves too, >> should we want to add those to the list of generated waveforms. Even >> low-alias impulses can be generated this way. >> >> And as for whether alias-free is worth it... just listen to a >> naively-generated square wave that's not a submultiple of the sample rate - >> for mid to high frequencies it usually sounds terrible. >> >> Norm > |