Add a "narrow" railroad diagram to the audio scope post; add line numbers to the samples listing

This commit is contained in:
Eryn Wells 2022-09-11 10:44:13 -07:00
parent fc2bbb2126
commit 3b74c3a256

View file

@ -91,6 +91,14 @@ Our audio processing graph looks like this:
rr.Terminal("destination"))); rr.Terminal("destination")));
{{< /figures/railroad >}} {{< /figures/railroad >}}
{{< figures/railroad id="audioContextDiagram" class="narrow-only" >}}
return rr.Diagram(
rr.Stack(
rr.Terminal("<audio>"),
rr.Terminal("Analyzer"),
rr.Terminal("destination")));
{{< /figures/railroad >}}
By itself the AudioContext doesn't actually play any audio. I'll tackle that By itself the AudioContext doesn't actually play any audio. I'll tackle that
next. next.
@ -178,7 +186,7 @@ for (let i = 0; i < samples.length; i++) {
The most interesting part of this function starts at line 66 where we get an array of samples from the analyzer node. The `samples` variable is a JavaScript `Float32Array`, with one element for each pixel of width. The most interesting part of this function starts at line 66 where we get an array of samples from the analyzer node. The `samples` variable is a JavaScript `Float32Array`, with one element for each pixel of width.
```js {linenos=false} ```js {linenostart=30}
samples = new Float32Array(p.width); samples = new Float32Array(p.width);
``` ```