## audacity-nyquist

 [Audacity-nyquist] eq-band and "width" From: James Shatto - 2010-10-24 18:51:03 eq-band(signal, hz, gain, width) I'm trying to write an EQ routine for audacity and I'm having trouble understanding the width parameter. I had thought that High Hz - Low Hz over 2 is what should be width. But my routine doesn't work that way when it uses that on the larger Hz values. But over 4 does seem to work. I'd like to sort out why so I don't have any gap or overlap in the EQ bands. When it does the EQ for the higher bands ~18kHz, it basically nulls out the audio if /2 is used. 20000 - 16000 = 4000 4000/2 = 2000 = width? or 4000/4 = 1000 = width? or Some other factor I seem to not quite get yet. To be used like (eq-band s 18000 2.0 2000) Per the documentation: --- and width (a FLONUM) is the half-gain width in octaves --- Could someone give me a human-esque interpretation of that phrase. Am I supposed to make it a factor of the gain that I'm applying or something? If so, what does that do to the gain value? Also, is there any sort of debugging tutorial, even if I have to use emacs or something. Even though my routine is fairly simple, I hate having no ability to peak at the values (after applied arithmetic) before they get used. Thanks, - James
 Re: [Audacity-nyquist] eq-band and "width" From: Roger Dannenberg - 2010-10-25 01:26:19 On 10/24/10 2:50 PM, James Shatto wrote: > eq-band(signal, hz, gain, width) > > I'm trying to write an EQ routine for audacity and I'm having trouble > understanding the width parameter. I had thought that High Hz - Low > Hz over 2 is what should be width. But my routine doesn't work that > way when it uses that on the larger Hz values. But over 4 does seem > to work. I'd like to sort out why so I don't have any gap or overlap > in the EQ bands. I guess you know there will always be overlap. These are not "brick wall" filters. > When it does the EQ for the higher bands ~18kHz, it > basically nulls out the audio if /2 is used. > > 20000 - 16000 = 4000 > 4000/2 = 2000 = width? > or > 4000/4 = 1000 = width? > or > Some other factor I seem to not quite get yet. To be used like > (eq-band s 18000 2.0 2000) > > Per the documentation: > --- and width (a FLONUM) is the half-gain width in octaves --- > > Could someone give me a human-esque interpretation of that phrase. Am > I supposed to make it a factor of the gain that I'm applying or > something? If so, what does that do to the gain value? The gain is measured in dB. The width is measured in octaves, e.g. if the width is 2, the range of frequencies affected by the filter is from hz/2 (an octave below) to hz*2 (an octave above). At these points (hz/2 and hz*2), the filter gain will be gain/2, measured in dB. To compute width, the octaves between f1 and f2, where f2 > f1, use log2(f2 / f1). log2(x) is not built-in, but log2(x) = log(x) / log(2.0). To hz, get the frequency in the middle, use hz = f1 * power(2.0, width / 2.0). I wrote a little program to send a sine sweep through a filter and plot the peak amplitude of the output as a function of frequency (works in the Nyquist IDE, and since the output is a sound, I guess you run something similar to this in Audacity: function test() begin ;; probe is a sinusoidal sweep at 1Hz/s with probe = hzosc(pwl(0, 0, 1000, 1000, 1000, 0)), ;; filt is a filtered probe filt = eq-band(probe, 200, -6.0, 2.0), ;; out is the rms of the input scaled to get peak out = rms(filt, 10) * sqrt(2.0) return out end exec s-plot(test(), 1000, 1000) > Also, is there any sort of debugging tutorial, even if I have to use > emacs or something. Even though my routine is fairly simple, I hate > having no ability to peak at the values (after applied arithmetic) > before they get used. Maybe someone has a better answer for Audacity-nyquist, but I use the Nyquist IDE. -Roger > Thanks, > - James
 Re: [Audacity-nyquist] eq-band and "width" From: James Shatto - 2010-10-25 02:22:07 What I'd really like to do is sort of a spline adjustment to EQ across the board maxing out at the high end at a specific dB level. And close to 0dB on the low end. Could that be done per frequency? I'm trying to compensate for the HF loss due to fake fur. And I've grown tired of entering 15 numbers for every adjustment. Plus I'd like a few more bands for a smoother adjustment. Hopefully with some control over how linear or dipped / curved the adjustment will be. For my current setup I'm needing near 2dB to 4dB on the high end. As much as 6dB on previous contraptions. So far results are promising for the restoration of certain percussion instruments and certain wildlife. Plus the spoken word seems to need a bit of high end for clarity. My lisp is a little weak, having only used it before to do a bunch of notch filters to counter sox's noise reduction that seems to omit the 1000Hz multiples from it's filter. Ultimately I'd like the actually measure the mics response in said configuration and base compensation off of that information. But for now, just trying to keep it simple and mostly automated. I don't really care if it takes a day for an hours audio, as long as it's good audio. Thanks for the clarification on width. That helps a bit. - James On 10/24/10, Roger Dannenberg wrote: > > On 10/24/10 2:50 PM, James Shatto wrote: >> eq-band(signal, hz, gain, width) >> >> I'm trying to write an EQ routine for audacity and I'm having trouble >> understanding the width parameter. I had thought that High Hz - Low >> Hz over 2 is what should be width. But my routine doesn't work that >> way when it uses that on the larger Hz values. But over 4 does seem >> to work. I'd like to sort out why so I don't have any gap or overlap >> in the EQ bands. > I guess you know there will always be overlap. These are not "brick > wall" filters. >> When it does the EQ for the higher bands ~18kHz, it >> basically nulls out the audio if /2 is used. >> >> 20000 - 16000 = 4000 >> 4000/2 = 2000 = width? >> or >> 4000/4 = 1000 = width? >> or >> Some other factor I seem to not quite get yet. To be used like >> (eq-band s 18000 2.0 2000) >> >> Per the documentation: >> --- and width (a FLONUM) is the half-gain width in octaves --- >> >> Could someone give me a human-esque interpretation of that phrase. Am >> I supposed to make it a factor of the gain that I'm applying or >> something? If so, what does that do to the gain value? > The gain is measured in dB. The width is measured in octaves, e.g. if > the width is 2, the range of frequencies affected by the filter is from > hz/2 (an octave below) to hz*2 (an octave above). At these points (hz/2 > and hz*2), the filter gain will be gain/2, measured in dB. > > To compute width, the octaves between f1 and f2, where f2 > f1, use > log2(f2 / f1). log2(x) is not built-in, but log2(x) = log(x) / log(2.0). > To hz, get the frequency in the middle, use hz = f1 * power(2.0, width / > 2.0). > > I wrote a little program to send a sine sweep through a filter and plot > the peak amplitude of the output as a function of frequency (works in > the Nyquist IDE, and since the output is a sound, I guess you run > something similar to this in Audacity: > > function test() > begin > ;; probe is a sinusoidal sweep at 1Hz/s > with probe = hzosc(pwl(0, 0, 1000, 1000, 1000, 0)), > ;; filt is a filtered probe > filt = eq-band(probe, 200, -6.0, 2.0), > ;; out is the rms of the input scaled to get peak > out = rms(filt, 10) * sqrt(2.0) > return out > end > > exec s-plot(test(), 1000, 1000) >> Also, is there any sort of debugging tutorial, even if I have to use >> emacs or something. Even though my routine is fairly simple, I hate >> having no ability to peak at the values (after applied arithmetic) >> before they get used. > Maybe someone has a better answer for Audacity-nyquist, but I use the > Nyquist IDE. -Roger >> Thanks, >> - James > > ------------------------------------------------------------------------------ > Nokia and AT&T present the 2010 Calling All Innovators-North America contest > Create new apps & games for the Nokia N8 for consumers in U.S. and Canada > \$10 million total in prizes - \$4M cash, 500 devices, nearly \$6M in marketing > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store > http://p.sf.net/sfu/nokia-dev2dev > _______________________________________________ > Audacity-nyquist mailing list > Audacity-nyquist@... > https://lists.sourceforge.net/lists/listinfo/audacity-nyquist >
 Re: [Audacity-nyquist] eq-band and "width" From: Roger Dannenberg - 2010-10-25 02:54:09 Attachments: Message as HTML On 10/24/10 10:22 PM, James Shatto wrote: > What I'd really like to do is sort of a spline adjustment to EQ across > the board maxing out at the high end at a specific dB level. And > close to 0dB on the low end. Could that be done per frequency? I'm > trying to compensate for the HF loss due to fake fur. And I've grown > tired of entering 15 numbers for every adjustment. Plus I'd like a > few more bands for a smoother adjustment. Hopefully with some control > over how linear or dipped / curved the adjustment will be. How would you specify the spline? There's a file in nyquist/lib/grapheq.lsp that implements NBAND-RANGE: |nband-rang/e//(input/, /gains/, /lowf/, /highf/)| A graphical equalizer applied to /input/ (a |SOUND|). The gain controls and number of bands is given by /gains/, an ARRAY of |SOUND|s (in other words, a Nyquist multichannel |SOUND|). Any sound in the array may be replaced by a |FLONUM|. The bands are geometrically equally spaced from the lowest frequency /lowf/ to the highest frequency /highf/ (both are |FLONUM|s). I think you could generate an array of gains according to some parametric description. > For my current setup I'm needing near 2dB to 4dB on the high end. As > much as 6dB on previous contraptions. So far results are promising > for the restoration of certain percussion instruments and certain > wildlife. Plus the spoken word seems to need a bit of high end for > clarity. My lisp is a little weak, having only used it before to do a > bunch of notch filters to counter sox's noise reduction that seems to > omit the 1000Hz multiples from it's filter. > > Ultimately I'd like the actually measure the mics response in said > configuration and base compensation off of that information. But for > now, just trying to keep it simple and mostly automated. I don't > really care if it takes a day for an hours audio, as long as it's good > audio. One well-known problem with EQ is that it introduces lots of frequency-dependent phase shift. Esp. for percussion, you might be better off with a simple low-order parametric filter that just boosts the highs a bit rather than a big multi-band EQ. The latter will let you model the overall amplitude response in detail, but the phase response will be erratic. > Thanks for the clarification on width. That helps a bit. > > - James > > > On 10/24/10, Roger Dannenberg wrote: >> On 10/24/10 2:50 PM, James Shatto wrote: >>> eq-band(signal, hz, gain, width) >>> >>> I'm trying to write an EQ routine for audacity and I'm having trouble >>> understanding the width parameter. I had thought that High Hz - Low >>> Hz over 2 is what should be width. But my routine doesn't work that >>> way when it uses that on the larger Hz values. But over 4 does seem >>> to work. I'd like to sort out why so I don't have any gap or overlap >>> in the EQ bands. >> I guess you know there will always be overlap. These are not "brick >> wall" filters. >>> When it does the EQ for the higher bands ~18kHz, it >>> basically nulls out the audio if /2 is used. >>> >>> 20000 - 16000 = 4000 >>> 4000/2 = 2000 = width? >>> or >>> 4000/4 = 1000 = width? >>> or >>> Some other factor I seem to not quite get yet. To be used like >>> (eq-band s 18000 2.0 2000) >>> >>> Per the documentation: >>> --- and width (a FLONUM) is the half-gain width in octaves --- >>> >>> Could someone give me a human-esque interpretation of that phrase. Am >>> I supposed to make it a factor of the gain that I'm applying or >>> something? If so, what does that do to the gain value? >> The gain is measured in dB. The width is measured in octaves, e.g. if >> the width is 2, the range of frequencies affected by the filter is from >> hz/2 (an octave below) to hz*2 (an octave above). At these points (hz/2 >> and hz*2), the filter gain will be gain/2, measured in dB. >> >> To compute width, the octaves between f1 and f2, where f2> f1, use >> log2(f2 / f1). log2(x) is not built-in, but log2(x) = log(x) / log(2.0). >> To hz, get the frequency in the middle, use hz = f1 * power(2.0, width / >> 2.0). >> >> I wrote a little program to send a sine sweep through a filter and plot >> the peak amplitude of the output as a function of frequency (works in >> the Nyquist IDE, and since the output is a sound, I guess you run >> something similar to this in Audacity: >> >> function test() >> begin >> ;; probe is a sinusoidal sweep at 1Hz/s >> with probe = hzosc(pwl(0, 0, 1000, 1000, 1000, 0)), >> ;; filt is a filtered probe >> filt = eq-band(probe, 200, -6.0, 2.0), >> ;; out is the rms of the input scaled to get peak >> out = rms(filt, 10) * sqrt(2.0) >> return out >> end >> >> exec s-plot(test(), 1000, 1000) >>> Also, is there any sort of debugging tutorial, even if I have to use >>> emacs or something. Even though my routine is fairly simple, I hate >>> having no ability to peak at the values (after applied arithmetic) >>> before they get used. >> Maybe someone has a better answer for Audacity-nyquist, but I use the >> Nyquist IDE. -Roger >>> Thanks, >>> - James >> ------------------------------------------------------------------------------ >> Nokia and AT&T present the 2010 Calling All Innovators-North America contest >> Create new apps& games for the Nokia N8 for consumers in U.S. and Canada >> \$10 million total in prizes - \$4M cash, 500 devices, nearly \$6M in marketing >> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store >> http://p.sf.net/sfu/nokia-dev2dev >> _______________________________________________ >> Audacity-nyquist mailing list >> Audacity-nyquist@... >> https://lists.sourceforge.net/lists/listinfo/audacity-nyquist >> > ------------------------------------------------------------------------------ > Nokia and AT&T present the 2010 Calling All Innovators-North America contest > Create new apps& games for the Nokia N8 for consumers in U.S. and Canada > \$10 million total in prizes - \$4M cash, 500 devices, nearly \$6M in marketing > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store > http://p.sf.net/sfu/nokia-dev2dev > _______________________________________________ > Audacity-nyquist mailing list > Audacity-nyquist@... > https://lists.sourceforge.net/lists/listinfo/audacity-nyquist >
 Re: [Audacity-nyquist] eq-band and "width" From: James Shatto - 2010-10-25 09:49:42 > How would you specify the spline? linearly it would be (current frequency)/(max frequency)*(dB adjustment) = (dB adjustment) my current math is more like (current gain for frequency) = (previous gain for frequency) * 0.75 (over 20-ish bands, going from highest to lowest). Which works pretty good using audacities 15 band mutiband eq and a value closer to 0.60. But I'm wanting something less step ladder and needing only one or two values (with defaults) on the effects initiation. Not that I know if nyquist supports it, but some sort of sin / cos arc averaged with the linear model to determine the depth of the arc. Based on the bottom right quadrant of a circle from lowest Hz to highest Hz. Or something like that. Perhaps some averaging to 2 line + 1 arc / 3 or 1 arc + 2 line / 3 type slider to tweak it. It's just the implementation of actually doing the eq that seems problematic right now. At a minimum the math for x^2+y^2=r^2 seems to be implemented. Where r is the max frequency, x is the current frequency and y the unknown would be scaled to the gain adjustment ((y/max frequency)*dB). But it's not that math that's got me stumped. It's how to use the result to affect the eq with the least issues. - James
 Re: [Audacity-nyquist] eq-band and "width" From: Roger Dannenberg - 2010-10-25 11:57:35 On 10/25/10 5:49 AM, James Shatto wrote: >> How would you specify the spline? > linearly it would be (current frequency)/(max frequency)*(dB > adjustment) = (dB adjustment) > > my current math is more like (current gain for frequency) = (previous > gain for frequency) * 0.75 (over 20-ish bands, going from highest to > lowest). > > Which works pretty good using audacities 15 band mutiband eq and a > value closer to 0.60. But I'm wanting something less step ladder and > needing only one or two values (with defaults) on the effects > initiation. > > Not that I know if nyquist supports it, but some sort of sin / cos arc > averaged with the linear model to determine the depth of the arc. > Based on the bottom right quadrant of a circle from lowest Hz to > highest Hz. Or something like that. Perhaps some averaging to 2 line > + 1 arc / 3 or 1 arc + 2 line / 3 type slider to tweak it. It's just > the implementation of actually doing the eq that seems problematic > right now. At a minimum the math for x^2+y^2=r^2 seems to be > implemented. Where r is the max frequency, x is the current frequency > and y the unknown would be scaled to the gain adjustment ((y/max > frequency)*dB). But it's not that math that's got me stumped. It's > how to use the result to affect the eq with the least issues. > > - James > OK, you could try the NBAND-RANGE function. Here, I believe frequency bands are geometrically spaced rather than linear, but you can compute an array of gains. If you tell me whether you are using Lisp or SAL, I think I can send a small example that computes a set of gains for NBAND-RANGE. (I still think for a few dB, you are better off with only a few bands, but if you like the sound, that's the ultimate test.) -Roger
 Re: [Audacity-nyquist] eq-band and "width" From: James Shatto - 2010-10-25 16:40:15 Based on the band being frequency/width to frequency*width, that really simplified what I was trying to do. For 22-ish bands the width would be 1.2-ish. Which places the 22nd band up past sampling rates of 48kHz, so I don't know if that will be problematic for samples at or less than 48kHz. Most of my samples are in the 192kHz / 96kHz realm, so not a problem for me (at the moment). I'll probably want to expand it later to allow a variable width and therefor variable bands. And I'm still not entirely sure if it does exactly what I want. But it does seem to work. And with most of the desired effect. In some respects better than expected, but I've still got to run the results through the ringer. i.e. downsample the long way to maximize clarity. http://home.earthlink.net/~shadow_7/FauxFurEQ.ny Feel free to set me straight if my logic is based on misunderstanding. It wouldn't be the first time. - James On 10/25/10, Roger Dannenberg wrote: > On 10/25/10 5:49 AM, James Shatto wrote: >>> How would you specify the spline? >> linearly it would be (current frequency)/(max frequency)*(dB >> adjustment) = (dB adjustment) >> >> my current math is more like (current gain for frequency) = (previous >> gain for frequency) * 0.75 (over 20-ish bands, going from highest to >> lowest). >> >> Which works pretty good using audacities 15 band mutiband eq and a >> value closer to 0.60. But I'm wanting something less step ladder and >> needing only one or two values (with defaults) on the effects >> initiation. >> >> Not that I know if nyquist supports it, but some sort of sin / cos arc >> averaged with the linear model to determine the depth of the arc. >> Based on the bottom right quadrant of a circle from lowest Hz to >> highest Hz. Or something like that. Perhaps some averaging to 2 line >> + 1 arc / 3 or 1 arc + 2 line / 3 type slider to tweak it. It's just >> the implementation of actually doing the eq that seems problematic >> right now. At a minimum the math for x^2+y^2=r^2 seems to be >> implemented. Where r is the max frequency, x is the current frequency >> and y the unknown would be scaled to the gain adjustment ((y/max >> frequency)*dB). But it's not that math that's got me stumped. It's >> how to use the result to affect the eq with the least issues. >> >> - James >> > OK, you could try the NBAND-RANGE function. Here, I believe frequency > bands are geometrically spaced rather than linear, but you can compute > an array of gains. If you tell me whether you are using Lisp or SAL, I > think I can send a small example that computes a set of gains for > NBAND-RANGE. > > (I still think for a few dB, you are better off with only a few bands, > but if you like the sound, that's the ultimate test.) > > -Roger > > > ------------------------------------------------------------------------------ > Nokia and AT&T present the 2010 Calling All Innovators-North America contest > Create new apps & games for the Nokia N8 for consumers in U.S. and Canada > \$10 million total in prizes - \$4M cash, 500 devices, nearly \$6M in marketing > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store > http://p.sf.net/sfu/nokia-dev2dev > _______________________________________________ > Audacity-nyquist mailing list > Audacity-nyquist@... > https://lists.sourceforge.net/lists/listinfo/audacity-nyquist >
 Re: [Audacity-nyquist] eq-band and "width" From: Stevethefiddle - 2010-10-25 18:18:19 If you are running this in Audacity, have you considered using "Draw Curves" in the Equalizer effect? (available in Audacity 1.3.x). Custom curves may be saved and reused when you need them. -- View this message in context: http://audacity.238276.n2.nabble.com/eq-band-and-width-tp5668375p5671802.html Sent from the audacity-nyquist mailing list archive at Nabble.com.
 Re: [Audacity-nyquist] eq-band and "width" From: Roger Dannenberg - 2010-10-25 18:36:04 On 10/25/10 12:40 PM, James Shatto wrote: > Based on the band being frequency/width to frequency*width, that > really simplified what I was trying to do. For 22-ish bands the width > would be 1.2-ish. Which places the 22nd band up past sampling rates > of 48kHz, so I don't know if that will be problematic for samples at > or less than 48kHz. Most of my samples are in the 192kHz / 96kHz > realm, so not a problem for me (at the moment). > > I'll probably want to expand it later to allow a variable width and > therefor variable bands. And I'm still not entirely sure if it does > exactly what I want. But it does seem to work. And with most of the > desired effect. In some respects better than expected, but I've still > got to run the results through the ringer. i.e. downsample the long > way to maximize clarity. > > http://home.earthlink.net/~shadow_7/FauxFurEQ.ny I took a look here: it looks like your width parameter is 1.2, but bands go from freq/1.2 to freq*1.2. Your bandwidth is 1.44, but you need to specify this in octaves. A ratio of 1.44 is 0.526069 octaves, so the width parameter to eq-band should be 0.526069. That's if you want the filter response to be gain/2 at freq/1.2 and freq*1.2. You could increase or decrease width to get more or less overlap. There's no need to write out equations for each band -- you could use a loop to simplify the code (or maybe that would "complexify" it by adding control constructs and data structures). The nband-range function uses a loops-and-array approach to do something similar. -Roger > Feel free to set me straight if my logic is based on misunderstanding. > It wouldn't be the first time. > > - James > > > On 10/25/10, Roger Dannenberg wrote: >> On 10/25/10 5:49 AM, James Shatto wrote: >>>> How would you specify the spline? >>> linearly it would be (current frequency)/(max frequency)*(dB >>> adjustment) = (dB adjustment) >>> >>> my current math is more like (current gain for frequency) = (previous >>> gain for frequency) * 0.75 (over 20-ish bands, going from highest to >>> lowest). >>> >>> Which works pretty good using audacities 15 band mutiband eq and a >>> value closer to 0.60. But I'm wanting something less step ladder and >>> needing only one or two values (with defaults) on the effects >>> initiation. >>> >>> Not that I know if nyquist supports it, but some sort of sin / cos arc >>> averaged with the linear model to determine the depth of the arc. >>> Based on the bottom right quadrant of a circle from lowest Hz to >>> highest Hz. Or something like that. Perhaps some averaging to 2 line >>> + 1 arc / 3 or 1 arc + 2 line / 3 type slider to tweak it. It's just >>> the implementation of actually doing the eq that seems problematic >>> right now. At a minimum the math for x^2+y^2=r^2 seems to be >>> implemented. Where r is the max frequency, x is the current frequency >>> and y the unknown would be scaled to the gain adjustment ((y/max >>> frequency)*dB). But it's not that math that's got me stumped. It's >>> how to use the result to affect the eq with the least issues. >>> >>> - James >>> >> OK, you could try the NBAND-RANGE function. Here, I believe frequency >> bands are geometrically spaced rather than linear, but you can compute >> an array of gains. If you tell me whether you are using Lisp or SAL, I >> think I can send a small example that computes a set of gains for >> NBAND-RANGE. >> >> (I still think for a few dB, you are better off with only a few bands, >> but if you like the sound, that's the ultimate test.) >> >> -Roger