Presentation is loading. Please wait.

Presentation is loading. Please wait.

Making music Consider music as structured sound Components include –Pitch –Duration –Instrument –Stereo direction Each attribute has a set of possible.

Similar presentations


Presentation on theme: "Making music Consider music as structured sound Components include –Pitch –Duration –Instrument –Stereo direction Each attribute has a set of possible."— Presentation transcript:

1 Making music Consider music as structured sound Components include –Pitch –Duration –Instrument –Stereo direction Each attribute has a set of possible values –Can specify by number or name

2 Components Pitch –defined by note values/names –Letters A-G, which repeat in the next octave –half steps between most notes (just not B-C and E-F) –12 notes per octave A, A ♯, B, C, C ♯, D, D ♯, E, F, F ♯, G, G ♯ –Pitch values double at the next octave up Duration –System of notes and rests –One beat is usually denoted with a “quarter note” –Dotted note has 1.5x the duration

3 Musical scale Ever watch The Sound of Music? The easiest musical scale is called C Major. It works like this: Actually, the movie used a B-flat Major scale which is 2 half-steps lower than C. NoteCDEFGABC Song namedoremifasolatido

4 Getting started We won’t use IDLE. Download new system: –http://www.cs.cofc.edu/~manaris/jythonmusic/ –Click on “download” –Open folder, double-click on JEM2.jar “Jython” is a version of the Python language –Does not change how your write code –Allows us to run programs to interact with Java on your computer to access extra multimedia capabilities Near top of program: from music import *

5 Note( ) function note = Note(pitch, duration, volume, panning) Note the 4 parameters –Pitch = name of note with octave number, e.g. C4, D5; or a number 0-127 where middle C = 60. –Duration = number of quarter-note beats, or a given name e.g. QN, HN, WH; precede with D to dot a note. –Volume = number 0-127. Forte = 85 is the default. Others are FFF, FF, F, MF, MP, P, PP, PPP –Panning = stereo direction. 0.0 = left, 0.5 = center (default), 1.0 = right –In most cases we just need first 2 parameters.

6 Examples note = Note(C4, DHN, FF) Play.midi(note) --------------------------- rest = Rest(HN) Play.midi(note) --------------------------- note = Note(E4, QN) Play.midi(note) --------------------------- note = Note(G4, QN) Play.midi(note)

7 Phrase Do you want to play more than 1 note? Then put your notes into a phrase. –Create a phrasep = Phrase() –Add notes to phrasep.addNote(Note(C4, QN)) p.addNote(Note(E4, QN)) p.addNote(Note(G4, QN)) p.addNote(REST) –Play the phrasePlay.midi(p)

8 Phrase features We can set a tempo and instrument p.setTempo(120) p.setInstrument(FLUTE) Tempo indicates speed of quarter note. –If we set tempo to 120, each beat is 1/120 of a minute or ½ a second. PIANO instrument is default. Choices include: CLARINET, VIOLA, GLOCKENSPIEL, ACCORDION, TRUMPET, ELECTRIC_GUITAR, FLUTE

9 List of notes Music has a lot of notes. Put them in a list! It will save typing. Create a list of pitches, which can include rests. [C4, C4, C4, C4, E4, D4, C4] Create a list of matching durations [QN, QN, QN, QN, DQN, EN, HN] Call this function on the 2 lists: p.addNoteList(, )

10 Example p = Phrase() p.setInstrument(FLUTE) p.setTempo(120) pitch1 = [C4, C4, C4, C4, E4, D4, C4] duration1 = [QN, QN, QN, QN, DQN, EN, HN] pitch2 = [E4, E4, E4, E4, G4, F4, E4] p.addNoteList(pitch1, duration1) p.addNoteList(pitch2, duration1) Play.midi(p)

11 Simultaneous notes The function p.addChord( ) allows you to specify that some notes play at the same time. Format: p.addChord(, ) p = Phrase() p.addChord([C4, E4, G4], HN) p.addNote(REST, QN) p.addChord([C4, EF4, G4], HN) p.addNote(REST, QN) p.addNote(E4, HN) Play.midi(p)


Download ppt "Making music Consider music as structured sound Components include –Pitch –Duration –Instrument –Stereo direction Each attribute has a set of possible."

Similar presentations


Ads by Google