Hi,
A sample represents an amplitude, you were right. This amplitude is often
normalized, meaning it ranges from -1 to 1 over the whole 32-bit range,
depending on your bit depth, the better the bit depth, the bigger the range is
so you have a better resolution, however, it takes more space.
So, then, you might ask why is there a maximum frequency then ? The thing is
that since your are blocked with a maximum and minimum value, the biggest
transition you can make is from -1 to 1 and since the frequency is all about
how fast the amplitude moves, then you have a maximum frequency, which would be
oscillating between -1 and 1.
However, the frequency only depends on time, not amplitude. The pfrequency is
about how many cycles of wave per second (or Hz). We only use the samples to
reconstruct the audio waves by fixing an amplitude point of the wave in time,
giving enough information to reconstruct the sound. So by oscillating between
-1 and 1, it's like if the wave is having a very high frequency, because it
moves really fast, because it was at -1 of amplitude at let's say time t and it
was at 1 at time t + 1/samplerate (sample rate is typically 44,1 kHz or 44100).
But what if the wave was moving even faster than that, meaning it has a higher
frequency ? We have absolutely no way of telling. Imagine one sample is at -1
and then the wave would go to 1 and go back to 0 before the next smaple. We
would have a sample at -1, then a sample at 0, we would think the wave simply
went from -1 to 0, not from -1 to 1, then back to 0. To notice that this is
really what happened, we would need to increase the sample rate, meaning we
would need to take more samples per second. This way, we could have a sample at
-1, then a sample at 0, then a sample at 1, then a sample at 0 again, but over
the same amount of time as before, we would just have more sample for the same
time duration. So there's a limit to the maximum frequency we can represent in
this data form, because we use this data to reconstruct sound.
Finally, the good part. Nyquist tells that we can perfectly reconstruct the
audio if the maximum frequency in the audio is less than half of the sample
rate. So if you sample at 44100 Hz (44100 samples per second), then you can
have sound in your audio that goes up to 22050 Hz, which is higher than what
normal humans can hear (we usually hear between 20 and 20000 Hz). Usually
people see the Nyquist theorem the other way. Usually it's that you have to
sample a sound with a sample rate that is at least twice the maximum frequency
in the sound. So if you hare recording voice, which might have a maximum
frequency of 10 kHz, then you could record that sound with a sample rate of 20
kHz (20000), which would produce a smaller audio file. That's just an exemple,
we obviously do not talk with only one frequency and depending on the form of
the audio, there are harmonics of higher frequencies, so it might sound pretty
bad.
So if you create the sound digitally with a 44,1 kHz sample rate, you will be
able to produce sound with a maximum frequency of 22,05 kHz. However, if you
record audio, the maximum frequency you can numerize is still 22,05 kHz, but
there's a catch. If in the audio you are recording are higher frequencies than
that limit, you will have aliasing, meaning that the sound will have noise from
the higher frequencies that will fold on the 0-22050 Hz range (that is exactly
what I was explaining earlier with the -1 sample, then the 0 sample). Imagine
you have a 32050 Hz frequency in the sound you are recording, then you will
hear a 10000 Hz noise (33050 - 22050 = 10000). To prevent this, you need to
filter the sound with a low-pass filter before it will be numerized. Don't
worry, there are filters in your sound card or microphone or whatever, it's
just for you understanding.
I hope it helped, there are pretty good resources on youtube if you want to
learn more.
Alexandre
-----Message d'origine-----
De : audacity4blind-bounce@xxxxxxxxxxxxx
[mailto:audacity4blind-bounce@xxxxxxxxxxxxx] De la part de Damien Sykes-Lindley
Envoyé : 14 août 2017 07:09
À : audacity4blind@xxxxxxxxxxxxx
Objet : [audacity4blind] Re: Manuals and tutorials (Re: nyquist little manual)
Hi Robert,
Feeling like I'm about to walk off the edge of an exceptionally large precipice
through bedlam and confusion into digital hades. I have been editing audio now
for over ten years but have never yet had to look at data as closely as this.
Then every time I think I understand something, it raises yet more questions
and contradictions and goodness knows whatever else my brain wants to spew
forth. However I'm determined to form a digital audio click in my brain that
might at least tell me I've got it!
So, to break it down step by step. I think the below is the impression I'm
forming.
A sound is a series of channels. 1=mono, 2=stereo, 3=2.1, 4+ is talking
surround-sound/3d setups and so on.
A channel is a series of <total_time_seconds*samplerate> samples.
A sample, at least in Audacity's editing context, is a set of 32 bits, ranging
from -1 to likely below +1, including decimals.
If the bit depth dictates the audio's dynamics, then it would make sense that
each bit must indeed represent the "volume", which to my understanding is
synonymous with "amplitude".
My logic then draws me to a conclusion that if a sample rate dictates what the
highest permitted frequency is, then each sample must represent a particular
frequency.
But if each sample goes from -1 to 1, that can't be true. Frequencies don't go
from -1 to 1. They are, in the case of CD quality (44.1KHZ), 0 to 22050HZ. Also
it would mean that adding one sample to another (I'm guessing that's what you
mean by "summation") would shift the pitch of the sample.
Add 16 to 131 (C3), and you end up with 147 (D3). That also tells me that logic
doesn't quite make sense, if adding two samples is supposed to perform a mix.
Also, saving a sound in a standard format such as 16-bit integer would make the
-/+1 sample logic seem weird, as every decimal number would be rounded to the
nearest integer, giving either -1, 0 or 1. Or does it then convert to the minus
and plus billion values I referred to previously?
I kind of wish I could just literally forget everything I've learned about this
and start over. I think that's half of the problem that when I think I
understand something I come up with theories that in the end just don't fit
with information that I learn later on.
Cheers.
Damien.
-----Original Message-----
From: Robert Hänggi
Sent: Monday, August 14, 2017 10:54 AM
To: audacity4blind@xxxxxxxxxxxxx
Subject: [audacity4blind] Re: Manuals and tutorials (Re: nyquist little
manual)
Hi Damien
Yes, samples lie in fact between -1 and 1, at least this is what Audacity will
show.
However, let's say that we have 5 bits to represent a sample.
This gives 32 possible values a sample can take.
Example for the Nyquist prompt (copy and paste there and press "Debug", but you
must have a track and a time range being defined):
(snd-display
(mult 16
(quantize
; 50 samples with start at 0 and at a rate of 1 sample per second
(snd-pwl 0 1 (list 0 -1.0 50 1.0 50))
; this is the quantization, i.e. 1/16 which gives 32 values from -1 to
1
16); quantize
); mult
); snd-display
(I've unfolded the parens but normally you wouldn't write Lisp code like
this)
That's exactly the way a signed 5-bit sound would be stored on disk.
You will notice that negative values can have an amplitude of max 1.0
whereas positive ones can only go up to 15/16 = 0.9375.
This is because one value is needed for 0.
Since we have 50 samples over the whole range, some will be doubled
due to rounding.
If this sound was imported, all samples would be normalized (divide by
16) and changed to 32-bit float.
This doesn't give a higher quality though...
To change the volume, we would have to multiply by a factor (e.g. 0.5).
Summation means simply two sounds playing at the same time.
This is essentially what "Mix and Render" does if you have multiple
tracks in your project.
Changing the speed is a totally other thing, we can't do it with
sample by sample manipulation.
The example sound above is defined with a sample rate of 1 Hz and it
would play 50 seconds (and you wouldn't hear a bit apart from two
clicks because the signal frequency is 0.02 Hz).
However, if the sound would be returned to Audacity, instead of being
displayed, it would assume that it has the same sample rate as the
track. Therefore, the signal would have a frequency of 882 Hz (at 44.1
kHz).
However, you would still hear nothing because it is only one cycle.
To test:
Copy the innermost code of above at the end of the Nyquist Prompt content:
(snd-pwl 0 1 (list 0 -1.0 50 1.0 50))
-> OK
Turn the volume down and start loop-play (Shift+Space)
That's our signal at 882 Hz and with the maximum amplitude. It's form
is that of a sawtooth.
Cheers
Robert
On 14/08/2017, Damien Sykes-Lindley <damien@xxxxxxxxxxxxxxxxxxxx> wrote:
Hi,
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 signals 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 2*2=4, not
chipmunk. *Grin*.
At least making an attempt to be serious again, I think it's more a theory
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
32
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 most often,
which
I understand to a degree, is that each number represents either an
amplitude, or a speaker position. I've seen both explanations, not sure
how
they link together but I guess they do. But nothing explains why doing
something to one number and something else to another can change the
output
in a way that makes me think that adding would logically change the
volume,
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, dividing
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
that
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 is
needed.
I've always wanted to make a convolution plugin since neither GoldWave or
Audacity seems to have one - Wondering if Nyquist is up to such a task
once
I can get all this theory learned first.
Cheers.
Damien.
-----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:
http://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference
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:
http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/xlisp/xlisp-index.htm
Steve
On 14 August 2017 at 08:39, Paolo Giacomoni <paolgiac@xxxxxxxxxx> wrote:
Hi listers.
I.m looking for a little nyquist manual, specially for audacity
applications.
Thanks you
Paolo
The audacity4blind web site is at
//www.freelists.org/webpage/audacity4blind
Subscribe and unsubscribe information, message archives,
Audacity keyboard commands, and more...
To unsubscribe from audacity4blind, send an email to
audacity4blind-request@xxxxxxxxxxxxx
with subject line
unsubscribe
The audacity4blind web site is at
//www.freelists.org/webpage/audacity4blind
Subscribe and unsubscribe information, message archives,
Audacity keyboard commands, and more...
To unsubscribe from audacity4blind, send an email to
audacity4blind-request@xxxxxxxxxxxxx
with subject line
unsubscribe
The audacity4blind web site is at
//www.freelists.org/webpage/audacity4blind
Subscribe and unsubscribe information, message archives,
Audacity keyboard commands, and more...
To unsubscribe from audacity4blind, send an email to
audacity4blind-request@xxxxxxxxxxxxx
with subject line
unsubscribe