Oregon State University|blogs.oregonstate.edu

A whole new world…  February 10th, 2022

one of channels and sampling.

This week I have been really diving into how to process audio data. It turns out that there is more to it than I originally thought.

Some reflections. Audio data comes in so many forms and it turns out a bunch of them are not compatible. Here’s an example. Even within the same audio format (aka file extension), tracks can be sample at crazy different rates. This means that when trying to combine their data, you either have one track missing data at certain time stamps, or you are jumping over data on the track sampled at a higher rate. When trying to play back the track, you have to decide on a sample rate for playback and since there is a mismatch one of the two audio tracks will suffer.

Once you have that problem solved, let me tell you about my friend NumChannels(). Here’s the kicker, you can have two tracks sampled at the same rate, but at each sample they may have more than just one data point. For each channel, the track has a float value (between -1 and 1) per sample. These values align with what each speaker should be playing at that time. So mono track (or 1 channel) only have one value, and if you play it on more speakers they all play the same (copied) value. For stereo, you have 2 channels and of course 2 values. This means we can tell 2 different speakers to play a different “notes”. Audio tracks can be recorded in several multichannel formats, including 6 channels, or 8 channels.

So, when I am trying to take that data in, I have to figure out how to get the “best” channels to play on to our 2 channel system (i.e. headphones).

Kinda makes you want to take a magic carpet ride 🙂

Print Friendly, PDF & Email


Leave a Reply