Re: [Audacity-nyquist] Processing individual samples
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: <edg...@we...> - 2008-02-11 04:21:13
|
Hi Jean [and all others on this list], > > > I was beginning to cycle through the usual "try something / fail / > > > what do all these messages mean / try something else" routine > > > > The backtrace and the [in great parts non-existent] error messages are > > a major disease of Nyquist. You need knowledge about the inner workings > > of the interpreter to be able [after long riddeling] what the real error > > in the lisp code could be. > > Nothing special here IMHO. Learning a new language in a new context > amounts to being stranded in the jungle with only a machete and a > gallon of water, you know the drill. :-) > > > I think the next problem will be that it of course does not make much > > sense to filter single samples [in fact it is impossible]. > > Disclaimer: I'm an amateur when it comes to signal processing, with a > general knowledge of FFT and friends, rules of thumbs galore, and > that's about it. If some of the following rant seems totally off the > wall to you, do not hesitate to correct me. > > As a guitarist and wannabe electronics hacker I'm interested in the > harmonic distortion generated by effect boxes or amplifiers. In > particular, the signal processing occuring in a tube amplifier looks a > bit like a static compressor in that the main factor in the transfer > function is the intensity of the signal; time is theoretically not > involved, like is the case in a dynamic compressor. This behaviour > creates harmonic distortion and it seems the harmonic content comes > partly from the output stage architecture : single-ended, push-pull, > "class A" vs. AB (the actual meaning being doubtful in this context), > fixed or cathode bias... I also have very old distortion stompboxes > which have a "good" sound and they are currently being analysed by > scope and FFT. Information: I had built my own guitar effects for approx. twenty years (from tube amplifiers to germanium, silicium and mosfet semiconductors). Maybe we should add a guitar fuzz box section anywhere? :) > I can more or less reproduce the latter type of germanium distortion > fairly easily: just compress the signal so that a sine wave is rounded > with third harmonics. sin(x*pi/2) and ln((e-1)*x+1) do the trick [¹] > (iterate to your taste) while a second-degree polynomial like x²+2x > generates too many high-order harmonics - the sound becomes too harsh. > A tube amplifier would also yield a 2nd harmonic, probably due to the > fact that an amplifier processes the sound in an asymmetrical way when > driven up. You do not neccessarily need DSP to do this, you can approximate tube or semiconductor characteristics by cascading several Nyquist 'clip' functions with different treshold values in a much faster way. There also exists a Nyquist 'shape' function for exactly this purpose but it unfortunately doesn't work right with Nyquist in Audacity. Of course DSP gives you the most flexible way to do experiment with amplifier characteristics but according to my experience the audio result is not really better, only the math formulae are excessively more complicated. But it's not my intention to keep you from experimenting. > So, to me, stateless processing, sample by sample, does have its use > and what's more, I can use different functions for the positive and > negative samples (good when you square a value). Of course, this code > alone is way too simple to really emulate an amplifier. I believe that > a POD, for instance, features other algorithms in order to take into > account the inductive load and the bandpass filter of the speakers, > the filtering and resonance of the cabinet - closed, open-back - and > so forth. Other Audacity plugins like Delay, High- and Low-Pass Filter > come in handy in this context, as well as the Compressor effect to > simulate the "sag" which happens when the power supply itself is > overdriven. In principle you are right, for simulating amplifier characteristics it is sufficient to work with single samples, but as soon as you want to change the frequency characteristics, e.g. for simulating highpass, lowpass or bandpass filters via DSP, this only works with sequences of samples. But a whole battery of filters is already available as Nyquist built-in functions so this will probably not be necessary for building guitar effects with Nyquist. And caution: the Audacity 'Compressor' effect is still misfunctional and with a minimum Attack time of 100 milliseconds slower than the slowest grandma and therefore IMHO just simply far beyond useless anyway. For a guitar compressor e.g. you need attack times between 1 and 5 milliseconds. But the good news is: with Nyquist you can write your own compressors too. > [¹] BTW I have a problem with log and sqrt functions, the plugin can't > find them... Information about missing Nyquist functions [in Audacity] can be found under 'Nyquist Apropos plugin' in the updated Nyquist docs: http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/devel/audacity-nyquist-en.htm#apropos > Lisp suffers from a bad reputation, being quite alien to us imperative > programmers. Your initiative will probably diminish the general > reluctance and alleviate somewhat the steep learning curve of the > language by providing recipes, allowing programmers to concentrate on > the algorithms rather than on the syntax. And provide more plugins to > Audacity users. Thanks for that, too. My eternal talking: a programmer who has not at least a basic knowlodge of the concepts of Fortran, Algol and Lisp is inadvertibly doomed to re-invent the wheel from the beginning. This does of course not mean that everybody must learn these [rather old] languages in every detail but without knowlege about the origins of computer programming you will inadvertibly run against walls again and again and again... But you are right: It took me approx. half a year of every-day reading and trying until I was able to write my first 'free-hand' Lisp programs without looking up every detail in the docs. Roger has started to introduce the SAL notation [derived from the SAL notation used in recent versions of 'Common Music' by Heinrich Taube], which is a Lisp front-end to save typing parens, but this still is not implemented in Audacity. [@roger: I think this could work without changing the Audacity/Nyquist C code but I just simply still haven't tried to tell the truth] P.S.: Links to some fuzz-box effects: The Broadcast Limiters II and III at the end of the 'Effects' section on the Nyquist Plug-ins download page in the Audacity Users Wiki are directly derived from my old silicium diode guitar fuzz boxes: http://audacityteam.org/wiki/index.php?title=Download_Nyquist_Plug-ins I also have a german 'tube amplifier simulator' on store which works in a similar manner [but is still rather slow with high 'dB' numbers]: http://www.audacity-forum.de/download/edgar/plugins/dB-max/RFT-dB-Max.ny Maybe somebody [including me] could do more tests with the Nyquist 'shape' function in Audacity? I always only got 'table limit exceeded' error messages, even with wavetables of only a few samples. Is it me myself or Nyquist in Audacity who causes this bug? - edgar -- The author of this email does not necessarily endorse the following advertisements, which are the sole responsibility of the advertiser: ________________________________________________________ Bis 50 MB Dateianhänge? Kein Problem! http://www.digitaledienste.web.de/freemail/club/lp/?lp=7 |