tutorial updates
This commit is contained in:
parent
823115c4ec
commit
858f4f74b3
14 changed files with 744 additions and 390 deletions
40
website/src/pages/learn/sounds.mdx
Normal file
40
website/src/pages/learn/sounds.mdx
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
title: Sounds
|
||||
description: Strudel Tutorial - Sounds
|
||||
layout: ../../layouts/MainLayout.astro
|
||||
---
|
||||
|
||||
import { MiniRepl } from '../../docs/MiniRepl';
|
||||
import { JsDoc } from '../../docs/JsDoc';
|
||||
|
||||
# Sounds
|
||||
|
||||
We can play sounds with `s`, in two different ways:
|
||||
- `s` can trigger audio samples, where a sound file is loaded in the background and played back:
|
||||
<MiniRepl client:idle tune={`s("bd hh sd hh")`} />
|
||||
- `s` can trigger audio synthesisers, which are synthesised in real-time using code also running in the background:
|
||||
<MiniRepl client:idle tune={`s("sawtooth square triangle sine")`} />
|
||||
|
||||
You can learn more about both of these approaches in the pages [Synths](/learn/synths) and [Samples](/learn/samples).
|
||||
|
||||
# Combining notes and sounds
|
||||
|
||||
In both of the above cases, we are no longer directly controlling the `note`/`n`/`freq` of the sound heard via `s`, as we were in the [Notes](/strudel/notes) page.
|
||||
|
||||
So how can we both control the sound and the pitch? We can _combine_ `note`/`n`/`freq` with `s` to change the sound of our pitches:
|
||||
|
||||
<MiniRepl client:idle tune={`note("a3 c#4 e4 a4").s("sawtooth")`} />
|
||||
|
||||
<MiniRepl client:idle tune={`n("57 61 64 69").s("triangle")`} />
|
||||
|
||||
<MiniRepl client:idle tune={`freq("220 275 330 440").s("sine")`} />
|
||||
|
||||
What about combining different notes with different sounds at the same time?
|
||||
|
||||
<MiniRepl client:idle tune={`freq("220 275 330 440 550").s("triangle sawtooth sine")`} />
|
||||
|
||||
Hmm, something interesting is going on there, related to there being five notes and three sounds.
|
||||
|
||||
Let's now take a step back and think about the Strudel [Code](/learn/code) we've been hearing so far.
|
||||
|
||||
<br/>
|
||||
Loading…
Add table
Add a link
Reference in a new issue