# Digging into an Audio Signal and the DSP Process Pipeline

In this post, I'll look at the benefits of using multiple perspectives when handling signals.

## A Pre-existing Audio File

Let's say we have an audio file of interest. Let's load it into Audacity and zoom in a little (using View → Zoom → Zoom In, multiple times). The figure illustrates the audio signal: just a basic single-tone signal.

By continuing to zoom into the signal, we eventually get to the point of seeing individual samples as illustrated below. Notice that I've marked one of the samples in the figure. We'll look at this sample more detail later.

Looking at the signal in the neighborhood marked above we can now look at the three leftmost samples:

In the figure, we have three audio samples. Based on the vertical scale on the left, we can see that the leftmost sample seems to have has the value zero, right? The second and third samples have values greater than zero and less than 0.5 respectively.

Using a C++ application, I extract the first four values from the signal. So, the listing below illustrates the first four signal values as they are read in from the WAV file.

Value of signal data[0] 0.000031

Value of signal data[1] 0.136047

Value of signal data[2] 0.268311

Value of signal data[3] 0.392517

Notice in the listing, that the WAV data tells a slightly different story from Audacity. Namely, that the first sample is in fact not zero. It has the value 0.000031.

Again, this shows the merit of using different perspectives. One tool (i.e., Audacity) gives us one perspective, but another, in this case, handcrafted C++ tool gives us a more accurate view of the same data.

Let's take the experiment a little further and include some more data (7 points) in the excerpt as illustrated in the following figure.

What does the C++ program output for the data in this figure look like? The following listing provides the details.

Value of signal data[0] 0.000031

Value of signal data[1] 0.136047

Value of signal data[2] 0.268311

Value of signal data[3] 0.392517

Value of signal data[4] 0.505493

Value of signal data[5] 0.603577

Value of signal data[6] 0.684082

More signal values

Notice in this listing that the last value is around the 0.684 mark.

In practice, it may not be necessary to delve into such fine detail. But, it's important to note that, with the right tooling, it is feasible to do so. Using multiple tools also facilitates the cross-checking of your signal data.

Previous post by Stephen Morris:
A Free DSP Laboratory

[ - ]
Comment by March 13, 2020

You can also get these values by selecting the audio and choosing (Tools  → Sample Data Export), which opens this dialog:

Which would return a file like this:
C:\temp\sample-data.txt   1 channel (mono)
Sample Rate: 44100 Hz. Sample values on linear scale.
Length processed: 6 samples 0.00014 seconds.

1 0.00000
2 0.05012
3 0.10004
4 0.14957
5 0.19851
6 0.24667

[ - ]
Comment by March 13, 2020

Good point and thanks for the feedback.

But, the exported data shows the first sample as having the value 0.00000, whereas, the other (C++) tool reports it as being non-zero, i.e., 0.000031. The point is that using two tools provides additional perspective on the signal data.

[ - ]
Comment by March 13, 2020

My sine wave isn't the same as yours. What does sample export show with the file from your post?

[ - ]
Comment by March 13, 2020

My version of Audacity (Windows) doesn't seem to have a Tools option (please see below). The data values in my post seem to be a bit different to the ones in your comment.

[ - ]
Comment by March 13, 2020

That is very strange. Maybe we are running different versions? I'm on 2.3.3

[ - ]
Comment by March 13, 2020

I'm on 2.2.2.

To post reply to a comment, click on the 'reply' button attached to each comment. To post a new comment (not a reply to a comment) check out the 'Write a Comment' tab at the top of the comments.