--- title: First Notes layout: ../../layouts/MainLayout.astro --- import { MiniRepl } from '@src/docs/MiniRepl'; import { midi2note } from '@strudel.cycles/core/'; import Box from '@components/Box.astro'; import QA from '@components/QA'; # First Notes Let's look at how we can play notes ## numbers and notes **play notes with numbers** [midi2note(i + 36), i + 36]), )} /> Try out different numbers! Try decimal numbers, like 55.5 **play notes with letters** [n, n.split('')[0]]))} /> Try out different letters (a - g). Can you find melodies that are actual words? Hint: ☕ 😉 ⚪ **add flats or sharps to play the black keys** [n, n.split('').slice(0, 2).join('')]), )} /> [n, n.split('').slice(0, 2).join('')]), )} /> **play notes with letters in different octaves** [n, n]))} claviatureLabels={Object.fromEntries( Array(49) .fill() .map((_, i) => [midi2note(i + 36), midi2note(i + 36)]), )} /> Try out different octaves (1-8) ## changing the sound Just like with unpitched sounds, we can change the sound of our notes with `sound`: Try out different sounds: - gm_electric_guitar_muted - gm_acoustic_bass - gm_voice_oohs - gm_blown_bottle - sawtooth - square - triangle - how about bd, sd or hh? - remove `.sound('...')` completely **switch between sounds** **stack multiple sounds** The `note` and `sound` patterns are combined! We will see more ways to combine patterns later.. ## Longer Sequences **Divide sequences with `/` to slow them down** {/* [c2 bb1 f2 eb2] */} The `/4` plays the sequence in brackets over 4 cycles (=4s). Try adding more notes inside the brackets and notice how it gets faster. Because it is so common to just play one thing per cycle, you can.. **Play one per cycle with \< \>** ").sound("gm_acoustic_bass")`} punchcard /> Try adding more notes inside the brackets and notice how it does **not** get faster. **Play one sequence per cycle** {/* <[c2 c3]*4 [bb1 bb2]*4 [f2 f3]*4 [eb2 eb3]*4>/2 */} /2") .sound("gm_acoustic_bass")`} /> **Play X per cycle with \{ \}** Try different numbers after `%` `{ ... }%1` is the same as `< ... >` ## Examples Small Town Boy /2") .sound("gm_synth_bass_1").lpf(1000)`} /> /2" .add.squeeze("[0 12]\*4") .note() .sound("gm_synth_bass_1")`} />