[audacity4blind] Re: Manuals and tutorials (Re: nyquist little manual)

  • From: "Damien Sykes-Lindley" <damien@xxxxxxxxxxxxxxxxxxxx>
  • To: <audacity4blind@xxxxxxxxxxxxx>
  • Date: Fri, 18 Aug 2017 19:59:13 +0100

Wow...Lots to take in there. Shame there isn't a decent accessible convolution plugin or method with Audacity, but hey ho. If I have to make it myself, that makes me all the more determined to do it. Convolution is amazing, a lot can be done with it and so it's a shame to have to do without it.
Once I get geared up with how audio data actually works in practice as well as theoretically, I might write some tutorials myself. A onestop place for basic overviews to advanced effects processing etc.
-----Original Message----- From: Gmail - Alexandre
Sent: Friday, August 18, 2017 6:00 PM
To: audacity4blind@xxxxxxxxxxxxx
Subject: [audacity4blind] Re: Manuals and tutorials (Re: nyquist little manual)


Convolution is a pretty convoluted subject, I'll try to do my best!

As far as filtering goes, there are two natures of filters. There are the analog filters, that we usually implement by a physical electronic circuit and there are the digital filters that we usually work with in digital processing, such as in your computer or in a DSP (Digital Signal Processor).

Analog filters are often called IIR filters, which stands for infinite impulse response and digital filters are often called FIR filters which stands for finite impulse response. An impulse response is how a filter responds to an impulse, which you can think of only one sample at 1 and all the other samples at 0. So an analog filter will have an infinite impulse response meaning that we could not fit the response of that filter in memory, because it would take infinite space. However, we can store the transfer function of such filters, by only storing their coefficients, it's like knowing a mathematical function. Although we couldn't store every value of a parabola, we could store the mathematical function and evaluate it on the values we need. You probably have seen analog filters, because they are grouped in different families such as Butterworth, Chebychev type 1, Chebychev type 2, etc.

On the FIR filter side (digital filters), we usually store in memory the filter coefficients, which are samples of the impulse response. We can do this because, remember, FIR filters have a finite impulse response, meaning it would take a finite amount of memory.

But now, you will ask, where is convolution in all of this ? First, you must know that a filter has a specific goal. A low-pass filter, for instance, will let the low frequencies through but will cut the high frequencies. But that's not so simple. When you will design your low-pass filter, you will often choose a cut frequency where you want the lower frequencies to pass and the higher frequencies to be cut. But it doesn't work so radically. Actually, lower frequencies will be less attenuated and higher frequencies will be attenuated. It's not like a brick wall that would cut at a certain frquency, it's smoother than that.

So, depending on the filter goal, it will have different coefficients, which are different impulse response. Whether it's a low-pass, high-pass, band-pass, band-stop, noise reducer, vocal isolator, etc, the filters will be different. So, to answer one of your question, yes, we could have a plug-in that would read a chosen file to import filter coefficients and apply the filter, but we usually see plug-ins that will design a certain type of filter, such as low-pass and we will ask the person to choose parameters of such a filter, such as the cut frequency, the attenuation we want at cut frequency, the order of the filter and so on. With these parameters, we will calculate the filter coefficients and apply the filter, because it's not everyone that knows how to design a filter and, moreover, we do not have the time or the will to do so, it's much easier to just specify parameters that speak to us. However, such a plug-in would still be cool, because if we have very specific goals or a very specific filter we designed, we could import it and apply it. If the filter is too specific, there will not be a plug-in that would satisfy the general case.

Ok, heading back towards convolution, we're pretty close now. I've been talking about applying filters to the sound signal (the audio wave), but how exactly do we apply a FIR filter to a signal ? Basically, there are two main ways of doing it. You can work with time or you can work with frequencies. So, wither you convolute your signal with your filter in the time domain, or you do a point to point multiplication in the frequency domain, it is mathematically equivalent. But since you are asking about the convolution part, I'll try to explain this method.

So, suppose you have your sound signal that is composed of 1000 samples (usually it would be much much more than that, but it's for the example). Suppose also that you have a FIR filter composed of 50 samples (50 coefficients) that is a low-pass for instance. You can apply the filter to the signal by convoluting the filter and the signal together. To do this you would:

1) Start by flipping the filter coefficients, so the last sample of the filter would become the first, the before last would become the second and the first sample would become the last.
2) Now, represent the signal in your head, it's a pretty long wave form 1000 samples long. What you need to imagine is that you place the flipped filter on the left most with only one sample overlapping with the signal.
3) For every point overlapping, you would do a multiplication between the overllapping pair and then sum every multiplications. In this case, you have only one pair of points overlapping, that means only one multiplication and hence no sum to make. The result is the first sample of your filtered signal, which is the output.
4) Shift your flipped filter to the right by one sample, meaning that now two samples of the signal is overlapping with two samples of the flipped filter.
5) Repeat the calculation. In this case, we have two pairs of samples overlapping, that means two multiplications and summing those two multiplications. The result is the second sample of the output.
6) Shift the flipped filter again to the right by one sample, rince and repeat. At some point, the filter will overlap completely with the signal, because remember, the filter has 50 samples and the signal has 1000 samples.
7) Near the end, the filter will start to overlap less the signal, because it goes towards the right. The last sample of the output will be the multiplication of the last sample of the signal with the first sample of the flipped filter.

And there you have it, you have calculated a numeric convolution! The output will be an audio signal where higher frequencies were cut.

Now, here's a few things I want you to notice, the output is longer than the original signal. Actually, the length of the output is the length of the signal plus the length of the filter minus one, which is 1049 samples in this case. What you can do is to truncate the first 25 samples and the last 24 samples to keep the same length in output. The first part of the convolution is only the filter "charging" anyways.

So, as you might have noticed, there is a lot to say on the subject and there are so many things I didn't talk about, but there you have it in a nut shell.

Hope it helped,


-----Message d'origine-----
De : audacity4blind-bounce@xxxxxxxxxxxxx [mailto:audacity4blind-bounce@xxxxxxxxxxxxx] De la part de Damien Sykes-Lindley
Envoyé : 18 août 2017 11:28
À : audacity4blind@xxxxxxxxxxxxx
Objet : [audacity4blind] Re: Manuals and tutorials (Re: nyquist little manual)

Very interesting. My initial thought would be that skipping every other sample would give you a sound half the speed rather than half the pitch, but I guess since frequency cycles are also changing at half the speed it vaguely makes sense.
Also the samples. Each sample represents the position of a speaker, from which we determine the volume, hence the reason overall volume is calculated on the entire sample, and why 0 is defined as silence - the speaker is at a central position. That also makes the steady curve of the sine wave make sense - just before Christmas last year, I actually generated a 1Hz sine wave, from a preset of course, and thanks to having an exposed sub speaker, was able to feel each individual cycle. Quite eery, but fascinating as well.
So I guess filtering works on the whole sample to determine which samples would fit the required frequencies in order to remove them, and delaying is a case of copying samples, changing the volume and mixing etc.
I think it's all starting to slot into place with a satisfying clunk.
Finally. That is of course assuming my above theories aren't also wrong in some way.
Still interested to know how convolution works. Would that even be possible to write as a Nyquist plugin since it will need you to be able to select an impulse response file to work from?
-----Original Message-----
From: Robert Hänggi
Sent: Friday, August 18, 2017 3:51 PM
To: audacity4blind@xxxxxxxxxxxxx
Subject: [audacity4blind] Re: Manuals and tutorials (Re: nyquist little

Hi Damien

The sign of a sample dictates the position of a speaker membrane. It is like a pendulum that goes back and forth.
If you want to change the volume of a whole track, you have to multiply each sample with a constant positive) factor.

If you want to create a fade-out, you would multiply it with a ramp.
For instance 1.0 0.875, 0.75, 0.625, 0.5, 0.375, 0.25, 0.125 would be suitable for our wave form above (lowest sample would be 12 dB lower than before).

Pitch shifting is a bit more involved.
In the simplest case (raising the pitch by one octave), you would skip every other sample. It does essentially not matter if you're taking 1,3,5,... or 2,4,6,....

In order to lower the pitch, you have to insert interpolated values.
However, there lies the problem. Imagine 0.0, 1.0, 0.0, -1.0, 0.0

If you interpolate linearly, there would now plus or minus 0.5 stand at each other position.
This is a triangle waveform but it could actually be a pure sine tone that we wanted or assumed (with 0.7071 instead of 0.5).
So, the interpolation has to be better. But even with the best one, it will only be an approximation because we are trying to create the double of information.

It gets worse if we want to preserve the length of the sound.
The naive solution (for the double octave case) is to repeat each cycle once.
But this creates a step function rather than a smooth transposition from one sound to the other.
Indeed, there are no simple formulas for pitch shifting and every manufacturer of e.g. tuning plug-ins is very secretive about the implementation details.


On 18/08/2017, Damien Sykes-Lindley <damien@xxxxxxxxxxxxxxxxxxxx> wrote:

Hi Robert,
Ah, I think I get the basics now. So 0=silence, 1=0DB and everything
else lies in between. If this is the case then why do we have negative values?
Also my question still stands - if each sample is an amplitude, which
controls the audible volume, then how do certain formula allow mixing,
others allow pitchshifting etc? What logic dictates these formulae so
that people can work out new formulae in order to generate new
effects? Surely changing any of these sample/amplitude numbers would
merely change the volume rather than the audio - I.E., add .2 to .5
and you get .7, making the

sample louder. Multiply .2 with .5 and you get .1, making the sample
quieter. I don't see how any of that works for mixing, pitch etc.
Having said that, isn't pitch shifting something to do with
resampling? Or did I dream that...
Then there's reverbs and filters, convolution and invert mixing - I
have no

idea how all that works. I thought reverb was some really really fast

but when I experimented with that it sounded more like a robot with
its head

in a tin can.
-----Original Message-----
From: Robert Hänggi
Sent: Friday, August 18, 2017 1:32 PM
To: audacity4blind@xxxxxxxxxxxxx
Subject: [audacity4blind] Re: Manuals and tutorials (Re: nyquist

Hi Damien

The amplitude of a sample is its absolute value.
0.25 is the amplitude of both, a -025 and +0.25 sample.

Let's look at one period of a sine wave:

0.0, 0.707, 1.0, 0.707, 0.0, -0.707, -1.0, -0.707,...

There are 8 samples, thus the frequency is 44.1 kHz/8=5512.5 Hz or
To get the volume (as peak), you must take the maximum absolute value
of the waveform.
This is obviously 1.0.
In this example, it would have been enough to look at 4 samples but
this does not hold for other wave forms or if the phase would be
different or if one period would be 7.5 samples long.

The peak isn't reliable for volume measurement because any sample
could accidentally be very high.

That's why the Root Mean Square (RMS) measurement is frequently preferred.

- First step is  to square all samples which makes them incidentally
positive as well:
(0 times 0, 0.707 times 0.707,...)
0.0, 0.5, 1.0, 0.5, 0.0, 0.5, 1.0, 0.5

-Second step is to sum those values= 4.0
- Third step is to divide this by the number of samples=4.0 divided by
8 equals  0.5
- Last step is to take the square root of this value: root(0.5)=0.707...

Except for square waves, this value is always lower than the peak.

To get the volume of a whole song, you would take all samples into
account (summing all squares and dividing by their number).

If you wanted on the other hand to make an amplitude follower, e.g.
for compression, the window would be such that the lowest frequency
that you are interested in is covered. For instance all above 20 Hz
needs 2205 samples for integration (at  44.1 kHz).

Apropos Nyquist:
All up to the Nyquist frequency is reconstructable but not this
frequency itself.
Imagine the sine wave that starts with a phase of 90 degrees.
The values are: 1.0, -1.0, 1.0, -1.0
This is the above sample  wave form with start at the third sample and
skipping three samples to get the next value.
Try another start point, e.g. the second one: 0.707, -0.707, 0.707,...
and the worst: 0.0,0.0, 0.0,...


On 17/08/2017, Damien Sykes-Lindley <damien@xxxxxxxxxxxxxxxxxxxx> wrote:
Hi Gary,
Yeah, the audio fundamental guide mentions the Nyquist rate, that was
one term I wasn’t aware of before then, but makes sense that Nyquist
was named for that concept, which itself, by the way, was named after
Harry Theodore Nyquist (1889-1976). Yes, inventors do fascinate me.

So my theory about actual sample data being between -32768 and 32767
and that data being converted in a uniform value was correct then. I
guess that makes sense when we’re talking about files with different
sample rates, bit depths etc.

The way I understand it, volume is synonymous with amplitude. Is that
If so then I would assume that -1 would be equal to the minimum
possible volume (I.E. -160DB or whatever it is), and 1 represents the
maximum (I.E.

In relation to adding samples, you say that, “if sample 47 of wave 1
and that of sound 2 is .4, sample 47 of the new sound is .7.” If
that’s the case, my understanding is, since each sample is an
amplitude (or volume), that would change sample 47 from -56DB to
–24DB (That is assuming we are working with a -160DB minimum level).

Like I say, I need to know how these samples work before I can start
to touch Nyquist, otherwise I fear I’m going to be frazzled with
information that I don’t understand.

From: Gary Campbell
Sent: Thursday, August 17, 2017 5:44 PM
To: audacity4blind@xxxxxxxxxxxxx
Subject: [audacity4blind] Re: Manuals and tutorials (Re: nyquist

Hi Damien,

It's been a while since I've used Nyquist, but I learned what I know
about Audacity and Nyquist from the Nyquist manual.  On the wiki
there is a Nyquist Plug-ins Reference which has links to the Nyquist

An audio sample in a 16-bit signed WAV file is a number between
-32768 and 32767.  In a 24-bit file it would be different.  Nyquist
abstracts this out as a number between -1 and 1 so your program is
not dependent on the way each sound is stored.  If you display a
sound as a graph of voltage versus time, each sample is the value of
the voltage at that point in time.  So in Nyquist a sample is a
number between -1 and 1 that is the amplitude of the sound at that
point in time.  If you were to examine samples of a sine wave you
would find that they would start at 0, increase for a while until
they reach a maximum, then decrease through 0 to minus the maximum,
and then increase to the maximum again.  The samples between the two
maximum points would represent one cycle, the amount of time that
represents is the "period" (sec/cycle) of the wave, and the frequency
of that sound is 1 over the period.  If you sum two sounds in
Nyquist, you make a new sound by adding the values of sample 1 of
both sounds, then sample 2, etc.  So if sample 47 of wave 1 is .3 and
that of sound 2 is .4, sample 47 of the new sound is .7.  If you
multiply 2 sounds you take the product of each sample, so you again
change the amplitude in a different way, so the speed doesn't change.
There are some concepts used to work with sounds  that are unique to
Nyquist, and you need to read the first sections of the Nyquist

understand them.  If I were going to do much with Nyquist I would have to

back and read the Nyquist manual, time which my wife would consider not

BTW: Another post talked about how you can only represent a sound with a
frequency of half the sample rate.  That is called the Nyquist rate,
which Nyquist was named.


On 8/14/2017 2:16 AM, Damien Sykes-Lindley wrote:

  I don't know why, but Nyquist kind of reminds me of the GoldWave
expression evaluator. Not sure if it's because the common upshot was I
couldn't understand either one of them, despite having a programming
background. Lol.
  Seriously though, I may be mistaken but they both may have this weird
caveat that you need a working knowledge of both programming, and digital
audio structure. The latter I have no experience with whatsoever, so when
people talk about adding signals to increase volume or multiplying
to mix or multiplying/dividing individual samples to manipulate speed...I
haven't a clue how that works in practice. I was always taught that
not chipmunk. *Grin*.
  At least making an attempt to be serious again, I think it's more a
behind digital audio processing is more what's needed. Everything I have
seen so far has either been very technical, or doesn't make sense. For
instance, I read somewhere, or at least understood it as, that an audio
sample is a number between -1 and 1. If that were the case, that could
easily be stored in 2 bits, yet audio is generally saved as 16, mixed at
bit, which I calculate as providing ranges of -32768 to 32767 and
-2147483648 to 2147483647 respectively.
  Additionally, I can't seem to find anything regarding a logical
explanation as to what the numbers mean. The simplest explanation used
often, which I understand to a degree, is that each number represents
an amplitude, or a speaker position. I've seen both explanations, not
how they link together but I guess they do. But nothing explains why
something to one number and something else to another can change the
in a way that makes me think that adding would logically change the
multiplying would logically change the speed, using a square root of the
inverse sign might apply a filter, or raising to the power of 16,
by Pi and adding the number of miles between NASA's latest rocket and the
sun would cause a flange. In case those weird formulas start a form of
interesting debate, let me clarify for those that didn't pick up on it
those last ones are completely made up garbage...I've no idea what would
cause those effects and I've no idea what using those formulas might do -
knowing my luck probably cause a lot of distortion and unwanted hiss.
  But as you can see. I personally think that's the kind of tutorial that

  I've always wanted to make a convolution plugin since neither GoldWave
Audacity seems to have one - Wondering if Nyquist is up to such a task
I can get all this theory learned first.
  -----Original Message----- From: Steve the Fiddle
  Sent: Monday, August 14, 2017 8:48 AM
  To: audacity4blind@xxxxxxxxxxxxx
  Subject: [audacity4blind] Re: nyquist little manual

  There is this page in the Audacity wiki that covers much of the
  Audacity specific Nyquist information:

  The complete reference for Nyquist functions is in the full Nyquist
  manual: http://www.cs.cmu.edu/~rbd/doc/nyquist/indx.html
  and detailed information about LISP in Nyquist (with examples) can be
  found here:


  On 14 August 2017 at 08:39, Paolo Giacomoni mailto:paolgiac@xxxxxxxxxx

    Hi listers.
    I.m looking for a little nyquist manual, specially for audacity
    Thanks you
    The audacity4blind web site is at

    Subscribe and unsubscribe information, message archives,
    Audacity keyboard commands, and more...

    To unsubscribe from audacity4blind, send an email to
    with subject line

  The audacity4blind web site is at

  Subscribe and unsubscribe information, message archives,
  Audacity keyboard commands, and more...

  To unsubscribe from audacity4blind, send an email to
  with subject line

  The audacity4blind web site is at

  Subscribe and unsubscribe information, message archives,
  Audacity keyboard commands, and more...

  To unsubscribe from audacity4blind, send an email to
  with subject line

The audacity4blind web site is at

Subscribe and unsubscribe information, message archives,
Audacity keyboard commands, and more...

To unsubscribe from audacity4blind, send an email to
with subject line

The audacity4blind web site is at

Subscribe and unsubscribe information, message archives,
Audacity keyboard commands, and more...

To unsubscribe from audacity4blind, send an email to
with subject line

The audacity4blind web site is at

Subscribe and unsubscribe information, message archives,
Audacity keyboard commands, and more...

To unsubscribe from audacity4blind, send an email to
with subject line

The audacity4blind web site is at

Subscribe and unsubscribe information, message archives,
Audacity keyboard commands, and more...

To unsubscribe from audacity4blind, send an email to
with subject line

The audacity4blind web site is at

Subscribe and unsubscribe information, message archives,
Audacity keyboard commands, and more...

To unsubscribe from audacity4blind, send an email to
with subject line

The audacity4blind web site is at

Subscribe and unsubscribe information, message archives,
Audacity keyboard commands, and more...

To unsubscribe from audacity4blind, send an email to
with subject line

Other related posts: