0% found this document useful (0 votes)
9 views3 pages

Juce Lesson301 Transcript

This module covers the fundamentals of audio processing in plugin development, including key concepts such as sound, sampling, and digital-to-analog conversion. It explains how sound is transformed into digital form through sampling and discusses the importance of frames and buffers in audio processing. The lesson concludes with a recommendation for further learning in digital signal processing (DSP).

Uploaded by

idontexistplease
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

Juce Lesson301 Transcript

This module covers the fundamentals of audio processing in plugin development, including key concepts such as sound, sampling, and digital-to-analog conversion. It explains how sound is transformed into digital form through sampling and discusses the importance of frames and buffers in audio processing. The lesson concludes with a recommendation for further learning in digital signal processing (DSP).

Uploaded by

idontexistplease
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

So far, you have learned about audio plugins and their ecosystem, including plugin

hosts. You’ve also learned how JUCE facilitates plugin development and distribution.
In this course module, you will learn how to implement the audio processing part of
your plugin. For this, it's important to clarify and explain some definitions. Chances
are you already know some of them.

That's why I put together a list of all the concepts that will be explained in this lesson.
If you think you know all of them well, you can skip this lesson.

The first term that we must consider is the sound itself. What is the sound? Physically
speaking, sound is any vibration of a solid, gas, or liquid in the frequency range of
human hearing. The most common form of a sound is an acoustic wave: a
propagation of air pressure changes in the air.

These air pressure changes repeat many times per second. How many times the
particle movement repeats per second is denoted in the unit of Hz. Hz is the inverse
of a second. So if air density at a single point rises and falls 20 times per second, we
hear a sound at the frequency of 20 Hz–the lowest frequency a human can hear. If
the full cycle of air density changes happens 20 000 times per second, we hear a
sound at the frequency of 20 000 Hz–the highest frequency a human can generally
hear.

As developers, we work with random-access memory on a computer. How do we


transform the acoustic sound into a digital form?

To this end, we use a microphone, a device that converts air pressure changes to
voltage changes. That's how we obtain an analog signal representing a sound. That's
the signal that is processed in analog mixing consoles. But we said, we want the
sound signal to be present on a computer. How do we represent voltage changes on
a computer?

Well, we sample it. At regular time intervals, we record the voltage value and store it
in memory. The result is a series of samples: evenly spaced discrete values.

The time interval between the samples is the sampling period. It is the reciprocal of
the sampling rate, which is the number of samples we get per second. For example,
if we have an audio recording of one second and the sampling rate is 48 000 Hz, the
recording will be represented by 48 000 samples. Sample rate, sampling
frequency, and sampling rate are terms used interchangeably.

For completeness, let me say that the process of transforming an analog signal into a
series of samples is called analog-to-digital conversion, often abbreviated as A/D.
The electronic unit responsible for A/D conversion is an analog-to-digital converter,
often abbreviated as ADC.

Of course, we need to perform a complementary operation to obtain an analog signal


from discrete samples; this process is called digital-to-analog conversion, or D/A
conversion. The electronic unit performing D/A conversion is a digital-to-analog
converter, abbreviated as DAC.

A sound signal converted into voltage can be amplified and played back via a
speaker that transforms the analog signal into an acoustic wave. And so the circle
completes.
Every audio interface contains an ADC and a DAC. You can recognize it by seeing
analog inputs, analog outputs, and a digital USB connection to your computer.

Let's now return to our digital samples in random-access memory.


In audio plugin processing, a single sample is a floating-point value in the [-1, 1]
range. If a sample exceeds this range at the output, it will clip, and the user will
probably see a red indicator on the DAW’s level meters. In C++, a sample is
represented by the float type or the double type.

These samples are often stored in simple arrays. An array of samples is a mono
signal; a signal that contains just a single channel of samples.

Most audio setups have more than one loudspeaker, and all headphones have two
speakers. Thus, the stereo setup with two channels is probably the most popular.
However, with the increasing interest in multichannel layouts, be prepared to handle
more than two channels as well.

However, you may now see a different issue. The pure notion of a sample is not
enough to specify the complete audio content at a single instant because one sample
is present only on a single channel. We need a name for a collection of samples from
all channels at a single point in time.

That’s why there is a notion of a frame: a collection of samples from several channels
at a single point in time. If we process a mono signal, a frame contains just one
sample. If we process a stereo signal, a frame contains two samples, and so on.

Because of the reasons you'll learn in the subsequent lessons, it does not make
much sense to invoke your plugin just to process a single frame. In all audio plugins
and applications, audio is processed in blocks. A block or a buffer is a collection of
successive frames. The number of frames in a buffer is called the buffer size. Be
aware that it's not a formal name, so it may be used with a different meaning.
Viewed differently, a buffer contains an array of audio samples for each channel it
represents.
Since the sample rate is known and the number of frames in a block is fixed for a
particular block, this collection of frames has a known length in seconds.

For example, if our plugin operates at the sampling rate of 48 000 Hz, and the
number of frames in a buffer is equal to 480, this buffer represents 480 divided by 48
thousand, so 0.01 seconds. In other words, it represents 10 milliseconds.

In general, the number of frames in a buffer divided by the sampling rate always
conveys the length of the buffer in seconds, regardless of the channel count. It’s also
useful to note that the number of frames in a buffer equals the number of samples in
a single channel of this buffer.

What is quite problematic is that the number of frames in a buffer is sometimes


referred to as "samples per block". This is misleading because a stereo buffer has
twice as many samples as frames. So, if a stereo buffer has "960 samples per block",
does it have 960 frames or 480 frames? Be mindful of the difference between frames
and samples, and be cautious when someone is using the term "samples" to refer to
"frames". Remember: a frame contains a single sample per channel at a single
instant.

In this lesson, you learned the basics of digital audio signal processing. You learned
how sound is represented on a computer, what audio samples, frames, channels,
blocks, or buffers are, and what the sampling rate is. You also learned the basics of
A/D and D/A conversion.

In the next lesson, you will learn the structure of any audio plugin.

In this lesson, we've merely scratched the surface of what is called digital signal
processing, DSP: the science of processing audio, images, video, etc. I'd be remiss
if I didn't mention a great all-in-one resource to learn DSP in the context of audio: the
DSP Pro online course. People often ask me what the go-to resource is to learn DSP;
well, that's the option I recommend. The course is available at
[Link]/dsp-pro.

You might also like