Be sure you have the latest version of the sound library.
Our examples this week focus on simple music generation. We will be working at a higher level of abstraction, thinking about the notes to play, rather than the creating the sound of a note.
You can experiement with generating sounds and noise yourself if you like. Take a look at the p5 docs for information about the library functions p5 provides for working with sound.
I don’t have a great deal of knowledge around music theory, so this information will not be deep (and there is so much more depth below). It is possible that some of it will be incorrect.
Still, these are the assumptions I used in creating the examples we will study this week.
First
Pitches
2^(1/12)
or 1.059
times higher than the last.Note | C | C# | D | D# | E | F | F# | G | G# | A | A# | B |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Equal Temperament hz | 261.63 | 277.18 | 293.66 | 311.13 | 329.63 | 349.23 | 369.99 | 392.00 | 415.30 | 440.00 | 466.16 | 493.88 |
Equal Temperament ratio | 1 | 1.059 | 1.122 | 1.189 | 1.259 | 1.334 | 1.414 | 1.498 | 1.587 | 1.681 | 1.781 | 1.887 |
Just Interval Ratio | 1 | - | 1.125 | - | 1.2 | 1.333 | - | 1.5 | - | 1.666 | - | 1.875 |
Just Interval Ratio | 1/1 | - | 9/8 | - | 5/4 | 4/3 | - | 3/2 | - | 5/3 | - | 15/8 |
Scales
Note | C | C# | D | D# | E | F | F# | G | G# | A | A# | B |
---|---|---|---|---|---|---|---|---|---|---|---|---|
C-Major | x | x | x | x | x | x | x | |||||
Step | w | w | h | w | w | w | h |
Rhythm
emptyArray = [];
simpleArray = [1, 2, 3];
nestedArray = [[60, 1], [62, 1]];
nestedArray.push([64, 1]);
nestedArray[1][0];
nestedArray[1][1];
nestedArray2 = [[70, 1], [72, 1]];
combinedArray = nestedArray.concat(nestedArray2);
For this weeks class, I have created two small javascript libraries and several example sketches.
MonoSynth, uses the p5.js oscillator and envelope classes to create an synth object that can play back a sequence of notes.
var synth = new MonoSynth();
synth.playNotes([[60, 1/4], [62, 1/4]]);
QuickMusic provides a few utilty functions for processing sequences of notes and working with keys/scales.
Supported Musical Scales
quickMusic.scales.major
quickMusic.scales.minor
quickMusic.scales.phrygianDominate
quickMusic.scales.minorPentatonic
Library Functions
quickMusic.getNoteInScale(position, tonic, scale)
translate from scale positoin to midi note number
quickMusic.midiToName(number)
find the name of a midi note number
quickMusic.nameToMIDI(name, octave)
find the midinote number by name
quickMusic.imposePhrase(phrase, tonic, scale)
translate notes from scale position to midi note number
quickMusic.shiftPhrase(phrase, amount)
shift notes up or down in pitch
quickMusic.clonePhrase(phrase)
create copy of a phrase
I also created several fully commented example scripts, we will review them in class, but I suggest also reading them at your own pace.