image/svg+xml image/svg+xml Create Your Own VST Plugins, Part 2: Audio Samplerate Explained | Denise
PluginsStoreTeamBlog

Create Your Own VST Plugins, Part 2: Audio Samplerate Explained

– Guest blog by Audio Dev Academy

To convert or not to convert?

Most of you who produce music in a DAW have encountered an audio sample rate issue. Your audio file might unexpectedly play too slow or too fast, changing pitch after wrongly answering the the age old question: ‘To convert or not to convert?’. Some internet audio guru might have convinced you to just stick with 44.1kHz even if your life depends on it, or – the opposite – to take up your samplerate as a high as possible before you run out of CPU, in order to win back some of the analog magic from yesteryear. So, what’s the deal with this all?

What a ‘sample’ really is

an audio interfaceIn my first blog, Create Your Own VST Plugins, Part 1: Movement In (Digital) Space, I explained what happens when you record audio. First, your microphone continuously measures the sound pressure in the air. Then, your sound card ‘samples’ the amplitude of this continuous sound wave at short intervals in time. And finally, your computer stores these values as a long list of numbers, usually according to a specified format like .WAV or .AIFF. The samplerate on which you record, is what determines the length of these short intervals in time. For example, when you record on a samplerate of 44100 Hz, your sound card samples the incoming audio 44100 times per second. This means that the resulting .WAV or .AIFF file will use 44100 numbers to represent one second of audio, and needs to be played back on the same samplerate it was recorded to prevent speeding up or slowing down the playback, and thus changing the pitch.

Resolution over time

In order to facilitate correct playback speed, the samplerate of an audio file is stored inside the .WAV or .AIFF file as meta-data. This allows your DAW to check the samplerate of any audio file you load, and ask you if you want to convert the audio file to the samplerate of the DAW project, to guarantee the correct playback speed. In that regard, you can view the samplerate you set in your DAW as your project’s recording and playback speed. In addition, you can view the samplerate of the actual audio files you record or load as the files resolution over time. Because the higher the samplerate during recording, the better the shape of original sound wave is preserved.

Computing speed

a computer's mothboardI think it is wonderous that just one second of digital audio consists of many thousands of numbers, and that these numbers get processed at superhuman speed by your computer to create a real-time audio signal. When creating audio plugins, you get to manipulate these numbers in code – as if time stands still – and then hear the musical and emotional impact these manipulations have. It can be very rewarding, theorizing and writing audio algorithms and then listening back to them run at full speed. Music and math intertwined.

Audio Dev Academy is an exciting online environment for like-minded programmers, musicians and audio engineers who want to learn how to code audio plug-ins and virtual instruments – to be launched in 2019. In preparation for the launch, Audio Dev Academy will publish a series of blogs and ebooks about programming and the inner workings of audio plug-ins and virtual instruments. If you want to know more, find Audio Dev Academy on Facebook.

 

December 28, 2018 by JD Young