Define a musical note with name and octave
Array.filter
fn(element, index, array)
Array.map
fn(element, index, array)
Array.reduce
fn(accumulator, element, index, array)
0.000
Here, we will take a note name and return a slightly detuned frequency.
Writing a function that converts a human readable shorthand into a computer readable array.
`C4@16n E4@16n G4@16n C5@16n E5@16n G4@16n C5@16n E5@16n`
This input string becomes...
[
"C4@16n", "E4@16n", "G4@16n", "C5@16n",
"E5@16n", "G4@16n", "C5@16n", "E5@16n",
]
...this array of strings, which becomes...
[
{ name: "C", octave: 4, length: "16n", time: 0 },
{ name: "E", octave: 4, length: "16n", time: 0.125 },
{ name: "G", octave: 4, length: "16n", time: 0.25 },
{ name: "C", octave: 5, length: "16n", time: 0.375 },
{ name: "E", octave: 5, length: "16n", time: 0.5 },
{ name: "G", octave: 4, length: "16n", time: 0.625 },
{ name: "C", octave: 5, length: "16n", time: 0.75 },
{ name: "E", octave: 5, length: "16n", time: 0.875 }
]
...this array of note objects!
`C4@16n E4@16n G4@16n C5@16n E5@16n G4@16n C5@16n E5@16n
C4@16n E4@16n G4@16n C5@16n E5@16n G4@16n C5@16n E5@16n
C4@16n D4@16n A4@16n D5@16n F5@16n A4@16n D5@16n F5@16n
C4@16n D4@16n A4@16n D5@16n F5@16n A4@16n D5@16n F5@16n
B3@16n D4@16n G4@16n D5@16n F5@16n G4@16n D5@16n F5@16n
B3@16n D4@16n G4@16n D5@16n F5@16n G4@16n D5@16n F5@16n
C4@16n E4@16n G4@16n C5@16n E5@16n G4@16n C5@16n E5@16n
C4@16n E4@16n G4@16n C5@16n E5@16n G4@16n C5@16n E5@16n`;
`E5@16n E5@8n E5@8n C5@16n E5@8n G5@4n G4@4n
C5@8n. G4@8n. E4@8n. A4@8n B4@8n Bb4@16n A4@8n
G4@8t E5@8t G5@8t A5@8n F5@16n G5@8n
E5@8n C5@16n D5@16n B4@8n.
C5@8n. G4@8n. E4@8n. A4@8n B4@8n Bb4@16n A4@8n
G4@8t E5@8t G5@8t A5@8n F5@16n G5@8n
E5@8n C5@16n D5@16n B4@8n.`;
Questions? Catch me afterwords or message me @AdamGieseDev
Slides available at: https://composed.adamgiese.com