<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[BLOG] How does DSP work? [Part 1]]]></title><description><![CDATA[<h2>How does DSP work? [Part 1] (an article for absolute beginners)</h2>
<p dir="auto">Audio programming does not look like audio.</p>
<p dir="auto"><img src="/assets/uploads/files/1785246695916-c5313d73-44fb-4b88-9622-2f597f65f9ee-dsp-math-sketch.png" alt="c5313d73-44fb-4b88-9622-2f597f65f9ee-dsp-math-sketch.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">It looks like values and numbers.</p>
<p dir="auto">And that's exactly what makes DSP possible.<br />
Once sound is represented by numbers, code can manipulate it!</p>
<p dir="auto">Without further ado, let me explain how audio gets represented as data, and how changing that data changes what you hear.</p>
<h2>Audio as Data</h2>
<p dir="auto">A speaker makes sound by moving.</p>
<p dir="auto"><img src="/assets/uploads/files/1785247051481-400e18a1-9d5c-4313-bfe2-03ea50b775fe-speaker-waveform.gif" alt="400e18a1-9d5c-4313-bfe2-03ea50b775fe-speaker-waveform.gif" class=" img-fluid img-markdown" /></p>
<p dir="auto">The line at the top is a <strong>waveform</strong>.</p>
<p dir="auto">For now, think of it as the shape the speaker is following.</p>
<p dir="auto">When the waveform moves up, the cone moves one way.<br />
When the waveform moves down, the cone moves the other way.</p>
<p dir="auto">That movement pushes air, and we hear it as sound.</p>
<hr />
<p dir="auto">Real audio is generally faster and messier, but the idea does not change:<br />
a speaker is following a changing value over time.</p>
<p dir="auto">So, if we want to create a sound,<br />
we need to create a <strong>waveform</strong>.</p>
<h2>The waveform as numbers</h2>
<p dir="auto">In digital audio, a waveform is stored as numbers.<br />
A tiny piece of a waveform might look like this:</p>
<pre><code class="language-text">[0.00,  0.70,  0.82,  0.27,  -0.51,  -0.86,  -0.51,  0.27]
</code></pre>
<p dir="auto">So, what is this?</p>
<p dir="auto">Well, digital audio does not store a "picture" of a waveform.<br />
It stores the <strong>height</strong> over <strong>time</strong>.</p>
<p dir="auto">Plot those heights from left to right, and the waveform appears.</p>
<p dir="auto"><img src="/assets/uploads/files/1785247104543-1e87fe4d-41b8-4f27-a13b-4c8f12a555f8-sample-array-to-plot.png" alt="1e87fe4d-41b8-4f27-a13b-4c8f12a555f8-sample-array-to-plot.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">These height numbers are called <strong>samples</strong>.<br />
Because each number is one tiny "sample" of the waveform height at one moment in time.</p>
<p dir="auto">The order matters because the order is time:</p>
<p dir="auto"><img src="/assets/uploads/files/1785247124213-73a0dd64-1d05-42a1-9db1-893ecfa99eec-sample-table-playback.gif" alt="73a0dd64-1d05-42a1-9db1-893ecfa99eec-sample-table-playback.gif" class=" img-fluid img-markdown" /></p>
<p dir="auto"><em>The array of data is the digital waveform. The drawing is the same data made easier to see.</em></p>
<h2>Lots of samples</h2>
<p dir="auto">The example I showed you above, is tiny on purpose.<br />
Real audio has far more samples than this.</p>
<p dir="auto">I'm sure you've heard of "Sample rate".</p>
<p dir="auto">44.1k, 48k. 96k, etc.<br />
With 48k being a common DAW sample rate.</p>
<p dir="auto">Well, running a program at 48 kHz means that <strong>one second of mono audio</strong> contains <strong>48,000</strong> sample values.</p>
<p dir="auto">That's the kind of high resolution that produces smooth waves.<br />
The simple drawings in this article are just a readable version.<br />
But real audio is the same thing packed more tightly in time.</p>
<p dir="auto"><img src="/assets/uploads/files/1785247149985-5719a9b4-2c59-4ce5-ab1a-b71224c0bb95-dense-sample-waveform.png" alt="5719a9b4-2c59-4ce5-ab1a-b71224c0bb95-dense-sample-waveform.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">(^ That's just something to be aware of. You don't have to worry about it for now, since I'll be continuing to use small pieces of audio for the sake of this article).</p>
<hr />
<p dir="auto">So far we have looked at audio as <strong>one long strip of sample values</strong>.<br />
But we have not talked about how a plugin generates this big stream of audio.</p>
<p dir="auto">So let's talk about chunks / buffers.</p>
<h2>Chunks (Buffers)</h2>
<p dir="auto">Real time DSP does not work on a big, long, sound in one go.<br />
- It processes chunks of audio.</p>
<p dir="auto"><img src="/assets/uploads/files/1785247192930-9c4096e2-3694-4ded-9d60-66cffae5cc0f-waveform-buffer-split.png" alt="9c4096e2-3694-4ded-9d60-66cffae5cc0f-waveform-buffer-split.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">A DSP effect takes a short chunk of audio, processes it, then moves on to the next chunk.</p>
<p dir="auto">An effect is like this:</p>
<p dir="auto">A chunk comes in.<br />
The effect changes the numbers inside it.<br />
The chunk goes out.<br />
Then the next chunk comes in.</p>
<p dir="auto">This is the basic shape of a normal audio effect.</p>
<p dir="auto"><img src="/assets/uploads/files/1785247211863-da8e66ea-dfc9-4e57-a281-63b38c6b8106-buffer-through-dsp.gif" alt="da8e66ea-dfc9-4e57-a281-63b38c6b8106-buffer-through-dsp.gif" class=" img-fluid img-markdown" /></p>
<p dir="auto">(The reason we process in small chunks of sound is efficiency related. But it's also practical:<br />
It's quite useful to have access to a whole portion of audio at a time)</p>
<h2>A simple example: volume</h2>
<p dir="auto">Let's look at a real-life example.<br />
Volume is a good example because it's easy to see.</p>
<p dir="auto"><img src="/assets/uploads/files/1785247228513-cfe8b407-2b25-4c75-82df-5d5077c169cc-hise-gain-node.png" alt="cfe8b407-2b25-4c75-82df-5d5077c169cc-hise-gain-node.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">You probably already know:<br />
Volume is the height of the waveform.</p>
<p dir="auto">Making a waveform less tall means the speaker isn't moving as much.<br />
In other words, <strong>height affects volume</strong>.</p>
<p dir="auto"><img src="/assets/uploads/files/1785247246805-de975f42-89a3-4f64-877b-554074d41d3c-waveform-volume-scale.gif" alt="de975f42-89a3-4f64-877b-554074d41d3c-waveform-volume-scale.gif" class=" img-fluid img-markdown" /></p>
<p dir="auto">...And earlier we saw that we store waveforms as height values.</p>
<p dir="auto">(you can see where I'm going with this).</p>
<p dir="auto">If we want to make the waveform quieter,<br />
all we need to do is make the sample values smaller.</p>
<p dir="auto">For example if we multiply every sample by 0.5 (half):</p>
<p dir="auto">The shape is the same.<br />
The height is half as large.</p>
<p dir="auto"><img src="/assets/uploads/files/1785247269456-9388e6dc-9e8b-4ee8-9422-5066a1096341-sample-gain-comparison.png" alt="9388e6dc-9e8b-4ee8-9422-5066a1096341-sample-gain-comparison.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">We've made the waveform half as loud.</p>
<p dir="auto">The algorithm for a volume effect then boils down to:</p>
<p dir="auto"><img src="/assets/uploads/files/1785247295857-f837f20d-a86c-4c31-a30c-97ae75417488-hise-gain-node-code.png" alt="f837f20d-a86c-4c31-a30c-97ae75417488-hise-gain-node-code.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">In pseudocode form:</p>
<pre><code class="language-text">receive buffer

for each sample in the buffer
{
    sample = sample * gain;
}

^ do the above for every buffer we receive
</code></pre>
<p dir="auto">So:</p>
<p dir="auto">If gain is 1.0, the sample values stay the same.<br />
If gain is 0.5, the waveform is half as tall.<br />
If gain is 2.0, the waveform is twice as loud/tall.<br />
If gain is 0.0, every sample becomes zero, which is silence.</p>
<p dir="auto">In actual C++ DSP:</p>
<p dir="auto"><img src="/assets/uploads/files/1785247421546-0ab2a9dd-9b10-4a29-b1ee-36186842477b-hise-gain-node-cpp-code.png" alt="0ab2a9dd-9b10-4a29-b1ee-36186842477b-hise-gain-node-cpp-code.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">(^ I bet you understand this now!)</p>
<p dir="auto">The main part of the effect is a function that receives a buffer of samples (a chunk) and processes them using math.<br />
That's what DSP code looks like!</p>
<p dir="auto">The real HISE gain node has some extra controls and parameter smoothing, but the core audio operation is still this simple multiplication.</p>
<h2>The Lesson</h2>
<p dir="auto">Honestly that's <em>pretty much</em> it.<br />
DSP is not very complicated.</p>
<p dir="auto">Most Audio effects work by:</p>
<p dir="auto">Take a buffer of sample values,<br />
change those values,<br />
and pass the buffer onward</p>
<pre><code class="language-text">A Gain effect multiplies the samples.
</code></pre>
<pre><code class="language-text">A Distortion bends the waveform shape by changing the samples.
</code></pre>
<pre><code class="language-text">A Delay stores samples and plays them back later.
</code></pre>
<p dir="auto">Oscillators are a slightly different case. They create new sample values rather than affecting incoming ones.</p>
<p dir="auto"><img src="/assets/uploads/files/1785247501503-0409a709-0ce4-4805-84c9-c680373dfdf4-oscillator-block-factory.gif" alt="0409a709-0ce4-4805-84c9-c680373dfdf4-oscillator-block-factory.gif" class=" img-fluid img-markdown" /></p>
<p dir="auto">^ And I'm if being 100% honest, this <em>isn't quite</em> the whole picture.</p>
<p dir="auto">If we zoom out a little, you'll see that there is actually a bigger loop going on.<br />
Where <strong>something</strong> is sending us a buffer, and asking our DSP to process or fill it.<br />
Then it takes that buffer back and sends it to the next place.</p>
<p dir="auto">(in our case, that <strong>"something"</strong> is HISE / JUCE).</p>
<p dir="auto"><img src="/assets/uploads/files/1785247674038-f79a05e7-920f-44c5-96e3-bcb2cc2b72f7-plugin-chain-routing.gif" alt="f79a05e7-920f-44c5-96e3-bcb2cc2b72f7-plugin-chain-routing.gif" class=" img-fluid img-markdown" /></p>
<p dir="auto">For an <strong>effect</strong>, <em>something</em> is going to send us a chunk and say "please process this" and we do that.</p>
<p dir="auto">For an <strong>oscillator</strong>, we might be given an empty chunk and we just need to write a waveform into the chunk and send that back.</p>
<h2>To Recap</h2>
<p dir="auto">1. The table, the waveform, the buffer.<br />
They are different visualizations of the same thing:<br />
sample values over time.</p>
<p dir="auto"><img src="/assets/uploads/files/1785247661904-9ae6b3ad-0c76-440b-9247-d89d85dac4cf-recap-signal-views.png" alt="9ae6b3ad-0c76-440b-9247-d89d85dac4cf-recap-signal-views.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">2. Audio plugins work by processing chunks of samples. These chunks are passed around between different oscillators and effects.</p>
<p dir="auto"><img src="/assets/uploads/files/1785247674038-f79a05e7-920f-44c5-96e3-bcb2cc2b72f7-plugin-chain-routing.gif" alt="f79a05e7-920f-44c5-96e3-bcb2cc2b72f7-plugin-chain-routing.gif" class=" img-fluid img-markdown" /></p>
<p dir="auto">3. Down the line, part of the program will mix the chunks and send them to the speaker and we will hear the waveform (we don't usually have to worry about that part, Hise or Juce will take care of those parts for us).</p>
<p dir="auto"><img src="/assets/uploads/files/1785247715366-a62c0ed0-1d53-4476-89d3-bc2628f0ba84-output-stream-to-speaker.gif" alt="a62c0ed0-1d53-4476-89d3-bc2628f0ba84-output-stream-to-speaker.gif" class=" img-fluid img-markdown" /></p>
<h2>Next: filters and other effects</h2>
<p dir="auto">I know what you're thinking:<br />
Gain makes sense, but how do we create filters and other kinds of effects? What kind of maths causes those?</p>
<p dir="auto">Look forward to [Part 2].</p>
]]></description><link>https://forum.hise.audio/topic/14957/blog-how-does-dsp-work-part-1</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Jul 2026 21:50:53 GMT</lastBuildDate><atom:link href="https://forum.hise.audio/topic/14957.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 28 Jul 2026 14:18:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [BLOG] How does DSP work? [Part 1] on Tue, 28 Jul 2026 18:47:11 GMT]]></title><description><![CDATA[<p dir="auto">Thank you so much for doing this. Truly great.</p>
]]></description><link>https://forum.hise.audio/post/122200</link><guid isPermaLink="true">https://forum.hise.audio/post/122200</guid><dc:creator><![CDATA[scottmire]]></dc:creator><pubDate>Tue, 28 Jul 2026 18:47:11 GMT</pubDate></item><item><title><![CDATA[Reply to [BLOG] How does DSP work? [Part 1] on Tue, 28 Jul 2026 18:16:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/3542">@griffinboy</a> exciting :)</p>
]]></description><link>https://forum.hise.audio/post/122199</link><guid isPermaLink="true">https://forum.hise.audio/post/122199</guid><dc:creator><![CDATA[lalalandsynth]]></dc:creator><pubDate>Tue, 28 Jul 2026 18:16:07 GMT</pubDate></item><item><title><![CDATA[Reply to [BLOG] How does DSP work? [Part 1] on Tue, 28 Jul 2026 16:53:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/3542">@griffinboy</a> Thanks, that's well explained!<br />
Looking forward to next lesson.</p>
]]></description><link>https://forum.hise.audio/post/122198</link><guid isPermaLink="true">https://forum.hise.audio/post/122198</guid><dc:creator><![CDATA[ulrik]]></dc:creator><pubDate>Tue, 28 Jul 2026 16:53:38 GMT</pubDate></item><item><title><![CDATA[Reply to [BLOG] How does DSP work? [Part 1] on Tue, 28 Jul 2026 14:48:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/12">@David-Healey</a><br />
Thank you!<br />
Maybe with some refinement :)</p>
<p dir="auto">It's far from perfect.</p>
<p dir="auto">This explanation is just my own attempt to boil down the theory into a simple form.<br />
...and it still ended up a bit of a ramble!</p>
<p dir="auto">I think it's quite a tricky subject to teach, because in real life there are so many implications and exceptions to every rule.<br />
Even simple DSP can look a bit monstrous when you layer ontop all of the common optimizations and C++ tricks.</p>
]]></description><link>https://forum.hise.audio/post/122197</link><guid isPermaLink="true">https://forum.hise.audio/post/122197</guid><dc:creator><![CDATA[griffinboy]]></dc:creator><pubDate>Tue, 28 Jul 2026 14:48:53 GMT</pubDate></item><item><title><![CDATA[Reply to [BLOG] How does DSP work? [Part 1] on Tue, 28 Jul 2026 14:25:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/3542">@griffinboy</a> Nice, would work well in the HISE documentation</p>
]]></description><link>https://forum.hise.audio/post/122195</link><guid isPermaLink="true">https://forum.hise.audio/post/122195</guid><dc:creator><![CDATA[David Healey]]></dc:creator><pubDate>Tue, 28 Jul 2026 14:25:30 GMT</pubDate></item></channel></rss>