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

  • From: "Damien Sykes-Lindley" <damien@xxxxxxxxxxxxxxxxxxxx>
  • To: <audacity4blind@xxxxxxxxxxxxx>
  • Date: Mon, 14 Aug 2017 12:08:32 +0100

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



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

Other related posts: