Re: [Audacity-devel] Speed up Square, no alias generator
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: Roger D. <rb...@cs...> - 2012-03-31 03:53:24
|
This has me curious. For what it's worth, Nyquist *is* C code (at some level) and often faster than you could write by hand. There's some overhead to interpret the plug-in code, but often there's no interpretation once the DSP begins. Some methods to generate a low-alias square wave in Nyquist include: sum of sines (Nyquist has a function called partial that is very fast for additive synthesis) make a highly-oversampled single period using sum of sines, then use that as a (linearly interpolated) wave table, the oversampled table reduces aliasing you'd get otherwise make a non-oversampled single period, synthesize it at the closest integer period to avoid aliasing, and then resample it to the exact period you need (resampling is expensive so I would not place bets on this method winning on speed) -Roger On 3/30/12 5:02 PM, James Crook wrote: > On 30/03/2012 20:39, Steve the Fiddle wrote: >> Thanks for the reply James, but please do try comparing my plug-in >> generator with the Audacity no alias square wave generator. I >> understand the theoretical arguments but in practice my tests indicate >> that the waveform produced by the Nyquist version is at least as good, >> and in the case of low frequency square waved it is superior to the >> built-in effect. Also it is very much faster. > Would you like to have a go at translating your code to C/C++? > > I don't completely understand the nyquist code. Are you creating the > wavetable at a higher resolution than you need it, then using FFT (low > pass filter) to make it alias free? If so, I don't understand why the > lowpass parameters differ and why they are absent on tri-wav. If we try > to use that technique in tonegen.cpp when the frequency is varying, as > it can in tonegen, the filter will need to vary too, so will need to be > applied repeatedly. Should still be cheaper than calculating zillions > of sines - up to 400 per sample in Audacity code - which is craziness. > > How important is alias free tone generation? Standard square wave > generation is a lot faster than with no-alias. > > --James. > > >> If there is little interest in improving the Audacity version then I >> suggest that it is replaced by a better quality, faster version >> written as a Nyquist plug-in (such as the one attached). >> >> Steve >> >> On 30 March 2012 16:06, James Crook<cr...@in...> wrote: >>> Wavetables (in general) work when the period of the wave is an exact >>> whole number of samples. Our built-in generators do not assume that, so >>> we would need to interpolate from wavetables. >>> >>> There is an argument for detecting the repeats-after-n-samples case and >>> doing that quickly. We can even reference the same audio block >>> repeatedly if the amplitude and frequency are constant - which would >>> give very fast generation of very long regular waves. >>> >>> Steve, please have a look at our current bugzilla. I would put this at >>> P5 if it were a bugzilla enhancement request. Worth noting, but not a >>> pressing issue. >>> >>> --James. >>> >>> On 30/03/2012 14:56, Steve the Fiddle wrote: >>>> The "Square, no alias" generator is extremely slow, which appears to >>>> be because the entire waveform is generated by additive synthesis. >>>> Attached is a Nyquist generator plug-in that is much faster generating >>>> alias free square waves, particularly when generating waveforms longer >>>> than 10 seconds. >>>> >>>> One would expect a built-in generator to be significantly faster than >>>> a Nyquist implementation, but the Nyquist version achieves a huge >>>> speed boost by generating a wavetable for the waveform, then using the >>>> wavetable to generate the waveform. I presume that this method could >>>> be implemented in C+ to make the "Square, no alias" generator very >>>> substantially faster. >>>> > > ------------------------------------------------------------------------------ > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > _______________________________________________ > audacity-devel mailing list > aud...@li... > https://lists.sourceforge.net/lists/listinfo/audacity-devel |