Cse536 Functional Programming 1 5/16/2015 Lecture #19, Dec 1 & 6, 2004 Todays Topics – Haskore System –The Music datatype –MIDI Instruments –Pitch & absolute.

Slides:



Advertisements
Similar presentations
Haskore Musikbearbeitung mit Haskell Paul Hudak, Yale University, USA
Advertisements

Chapter 20 Functional Music Composition. MDL: Music Description Language MDL is a DSL for computer music composition that is even simpler than FAL and.
Peter Rademaker & Robert Stremler. Preview 1.Introduction 2.The Basics 3.Simple Examples 4.Interpretation and Performance 5.MIDI 6.Algebraic Properties.
MUSIC Elements, History, and Performance. Timbre- Sound Quality Instrument Families STRINGS Violin Viola Cello Bass Harp Guitar Banjo Piano WIND Saxaphone.
Instruments of the Orchestra Revision. There are 4 families of instruments in the orchestra:  Strings  Brass  Woodwind  Percussion.
Instrument Families.
Questions on Orchestra Family Instruments
Instrumental Families
Timbre A description of the actual sounds that you hear. “Tone color” or “quality”
Chapter 2: PERFORMING MEDIA  Voices/Singing Ten important points 1. There is a much wider range of pitch and volume than is used in speaking 2. Vowel.
Understanding Music - Instrumental Music. What we will be learning about in this topic...
Families of Musical Instruments
The Orchestra.
Families and Classifications of Instruments
Music Appreciation Musical Instruments.
Y Fernandez- CMS Instruments 1. Families of Instruments String Instruments Violin Viola Cello Double Bass Violin Viola Cello Double Bass.
Music JEOPARDY Family of Instruments By A. Vilcins
Instruments of the Orchestra
MGC (Music Generator for Composing). Pronunciation MGC MGC mmmmGiC mmmmGiC Magic Magic.
Elements of Music. Harmony Two or more notes together Two or more notes together Chord – three or more notes at one time Chord – three or more notes at.
MGC (Music Generator for Composing). Pronunciation MGC MGC mmmmGiC mmmmGiC Magic Magic.
Musical Instruments.
MUSICAL INSTRUMENTS CLASSIFICATION. 1. STRING INSTRUMENTS A string instrument is a musical instrument that produces sound by string that vibrates. They.
Presented By: Miss Cross.  There are four main types of instruments: ◦ Winds ◦ Brass ◦ Strings ◦ Percussion  Which instruments belong to which categories?
Musical Instruments Grade Ten Music.
Elements of Music Music History.
Music Core Content.
Performing Media: Voices and Instruments.  Singing most widespread and familiar way of making music.  Differences in cultural tastes the tone color.
Introduction to Band Instruments Mr. Johnson Revised: 2 August 2010.
The Orchestra.
Spring Creek Middle School Beginning Band Introduction to Band Instruments Mr. Hansen Revised: 18 June 2004.
Musical Instruments.
The Instruments of the Orchestra 4 Families of Instruments Strings Winds Brass Percussion.
Musical Instrument Families. Why are there different families Each instrument family has their own unique TIMBRE or sound How is sound produced –By vibrations!
Instructions Add your name to the title slide (the next slide) Research the different sections and instruments summarising what you find out on the appropriate.
Instruments of the orchestra. Instrument Families By the end of this lesson you should: Know what an orchestra is Understand the layout of an orchestra.
Chapter 7 Western Musical Instruments. Strings They are bowed and plucked – Violin – Viola – Cello (also Violoncello) – Double Bass.
SPELLING PRACTISE. ORCHESTRA 1. Write the word. Spell it, Study it, Remember it.
Instruments. Strings Commonly made of wood and strings (usually four). Played by drawing a bow across the strings or plucking the strings. Examples: violin,
Music By: Raegan Light.
Instruments.  Which categories would you consider instruments to fall under?  Melody  Harmony  Rhythm/Beat  Dynamics So where would instruments fall…
Instruments are grouped into 4 major families  Brass instruments all share these characteristics  They are made of metal and have a brass finish 
Computing with Music: Creating Musical Patterns Campy, 2005 Quinnipiac University Computing with Music: Creating Musical Patterns John Peterson No Longer.
Orchestral Seating Chart ► The symphony orchestra is composed of three groups: Strings, Winds and Percussion ► The String section consists of basses, cellos,
1. Woodwind 2. Brass 3. Strings 4. Percussion/Keyboard.
Music Core Content Instrument Families Voice Parts Brass S oprano Woodwind A lto String T enor Percussion Bass How each instrument or voice sounds.
Each corner of the room is a different answer (A, B, C, or D)
Musical Instruments.
Instruments of the H R O S C A E T R.
Musical Instruments. Instrument Families There are four instrument families –Brass Instruments –Woodwind Instruments –Percussion Instruments –String Instruments.
Music Instruments Band Welcome to your first day! This quarter you will: Learn to read music Learn the instrument families and instruments!
Performance media INSTRUMENTS = mechanism other than a voice that produces musical sounds. (single note or multi) CLASSES OF INSTRUMENTS 1 WOODWIND 2 BRASS.

The Orchestra.
Musical instrument families
Types of Musical Groups and Ensembles
Introduction to Music Musical Instruments
Musical Instruments and Ensembles
Instruments and Clefs Families Ranges Clefs.
Chapter 2—Performing Media: Voices and Instruments
Music Appreciation Musical Instruments.
Family Categories Strings Strings Woodwinds Woodwinds Brass Brass Percussion Percussion.
Instrumentation and Transposition
The Instrument Families
A Variety of Instruments and the Families in Which They Belong
Benjamin Britten's The Young Person's Guide to the Orchestra.
Family Of Instruments Test
KS3 Knowledge Organiser: Year 7 Instruments of the Orchestra
INSTRUMENTS OF THE ORCHESTRA AND CONCERT BAND
Performing Media: Voices & Instruments
Presentation transcript:

Cse536 Functional Programming 1 5/16/2015 Lecture #19, Dec 1 & 6, 2004 Todays Topics – Haskore System –The Music datatype –MIDI Instruments –Pitch & absolute Pitch –Composing Music »Delay »Repeating »Transposing –Presentation and the MIDI file format

Cse536 Functional Programming 2 5/16/2015 The Haskore library must be installed to work on your machine. Down load the zip file from the web. – Unzip it into a temporary directory. –You will get a directory named Haskore, with many files in it Find your Hugs installation directory –Usually some thing like C:\Program Files\WinHugs Open this directory, there should be a directory called packages. Copy the complete Haskore directory into the packages directory You have now installed Haskore!! Using the Haskore Library on your machine

Cse536 Functional Programming 3 5/16/2015 Haskore Haskore is a Haskell library for constructing digital music –It supports an abstract high-level description of musical concepts –Maps into the Midi (Musical Instrument Digital Interface) standard »a low-level binary bit based encoding of music »can be “played” by “Media-Players” Haskore Haskell Haskore Abstract High Level Implementation independent MIDI low level bit based implementation standard presentation

Cse536 Functional Programming 4 5/16/2015 Musical Basics in Haskore type Pitch = (PitchClass, Octave) data PitchClass = Cf | C | Cs | Df | D | Ds | Ef | E | Es | Ff | F | Fs | Gf | G | Gs | Af | A | As | Bf | B | Bs type Octave = Int Middle C Octave 2Octave 3 Octave 4 C D E F G A B C Cs Ds Fs Gs As Df Ef Gf Af Bf Cf Ff Es Cf Bs

Cse536 Functional Programming 5 5/16/2015 Music data Music = Note Pitch Dur [NoteAttribute] | Rest Dur | Music :+: Music | Music :=: Music | Tempo (Ratio Int) Music | Trans Int Music | Instr IName Music | Player PName Music | Phrase [PhraseAttribute] Music

Cse536 Functional Programming 6 5/16/2015 Our first piece of music m1 = Note (C,5) 1 [] m2 = Note (D,5) 1 [] m3 = m1 :+: m2 First Notes

Cse536 Functional Programming 7 5/16/2015 cf,c,cs,df,d,ds,ef,e,es,ff,f,fs,gf,g,gs,af,a,as,bf,b,bs :: Octave -> Dur -> [NoteAttribute] -> Music cf o = Note (Cf,o); c o = Note (C,o); cs o = Note (Cs,o) df o = Note (Df,o); d o = Note (D,o); ds o = Note (Ds,o) ef o = Note (Ef,o); e o = Note (E,o); es o = Note (Es,o) ff o = Note (Ff,o); f o = Note (F,o); fs o = Note (Fs,o) gf o = Note (Gf,o); g o = Note (G,o); gs o = Note (Gs,o) af o = Note (Af,o); a o = Note (A,o); as o = Note (As,o) bf o = Note (Bf,o); b o = Note (B,o); bs o = Note (Bs,o) These functions have the same names as the constructors of the PitchClass but they’re not capitalized. Compare –Note (C,5) 1 [] with c 5 1 [] Short hands

Cse536 Functional Programming 8 5/16/2015 type Dur = Ratio Int -- fractions of Integers such as 3 /4. We write (3 % 4) in Haskell. wn, hn, qn, en, sn, tn :: Dur dhn, dqn, den, dsn :: Dur wn = 1 -- whole hn = 1%2 -- half qn = 1%4 -- quarter en = 1%8 -- eight sn = 1%16 -- sixteenth tn = 1%32 -- thirty-second dhn = 3%4 -- dotted half dqn = 3%8 -- dotted quarter den = 3%16 -- dotted eighth dsn = 3%32 -- dotted sixteenth Duration

Cse536 Functional Programming 9 5/16/2015 Compare m1 = Note (C,5) 1 [] m2 = Note (D,5) 1 [] m3 = m1 :+: m2 n1 = c 5 wn [] n2 = d 5 wn [] n3 = n1 :+: n2

Cse536 Functional Programming 10 5/16/2015 Generic Music - Rests wn, hn, qn, en, sn, tn :: Dur dhn, dqn, den, dsn :: Dur wnr = Rest wn -- whole hnr = Rest hn -- half qnr = Rest qn -- quarter enr = Rest en -- eight snr = Rest sn -- sixteenth tnr = Rest tn -- thirty-second dhnr = Rest dhn -- dotted half dqnr = Rest dqn -- dotted quarter denr = Rest den -- dotted eighth dsnr = Rest dsn -- dotted sixteenth

Cse536 Functional Programming 11 5/16/2015 Lets Write Some Music!Music Example 1 cscale = c 4 qn [] :+: d 4 qn [] :+: e 4 qn [] :+: f 4 qn [] :+: g 4 qn [] :+: a 4 qn [] :+: b 4 qn [] :+: c 5 qn [] chord1 = (c 4 hn [] :=: e 4 hn []) Note the change in Octave

Cse536 Functional Programming 12 5/16/2015 line, chord :: [Music] -> Music cscale2 = line [c 4 qn [], d 4 qn [], e 4 qn [], f 4 qn [], g 4 qn [], a 4 qn [], b 4 qn [], c 5 qn [] ] chords = chord [ (Rest (3%4) :+: cscale), cscale ] More shorthands

Cse536 Functional Programming 13 5/16/ All three compute the same thing, but some are -- easier to write than others cscale3 = line2 [c 4 qn, d 4 qn, e 4 qn, f 4 qn, g 4 qn, a 4 qn, b 4 qn, c 5 qn ] cscale = c 4 qn [] :+: d 4 qn [] :+: e 4 qn [] :+: f 4 qn [] :+: g 4 qn [] :+: a 4 qn [] :+: b 4 qn [] :+: c 5 qn [] cscale2 = line [c 4 qn [], d 4 qn [], e 4 qn [], f 4 qn [], g 4 qn [], a 4 qn [], b 4 qn [], c 5 qn [] ] Getting rid of those annoying [ ]’s

Cse536 Functional Programming 14 5/16/2015 More Examples cMaj = [ n 4 hn [] | n <- [c,e,g] ] cMin = [ n 4 wn [] | n <- [c,ef, g] ] Example 2 cMajArp = line cMaj Example 3 cMajChd = chord cMaj Example 4 ex4 = line [ chord cMaj, chord cMin ]

Cse536 Functional Programming 15 5/16/2015 Time Delaying Music delay :: Dur -> Music -> Music delay d m = Rest d :+: m ex5 = cscale :=: (delay dhn cscale)

Cse536 Functional Programming 16 5/16/2015 Transposing Music ex6 = chord [line cMajor,Trans 12 (line cMajor)] 12 tone difference

Cse536 Functional Programming 17 5/16/2015 f 6 qn [] d 6 qn [] b 5 qn [] g 5 qn [] e 5 qn [] c 5 qn [] Where are the notes? e 6 qn [] c 6 qn [] a 5 qn [] f 5 qn [] d 5 qn [] B 4 qn [] Middle C

Cse536 Functional Programming 18 5/16/2015 Create a masterpiece row = line2 [c 5 qn, c 5 qn, c 5 den, d 5 sn, e 5 qn,e 5 den, d 5 sn, e 5 den, f 5 sn, g 5 hn,triplet (c 6 qn), triplet (g 5 qn), triplet (e 5 qn), triplet (c 5 qn),g 5 den, f 5 sn, e 5 den, d 5 sn, c 5 hn] triplet n args = Tempo 3 (n args) :+: Tempo 3 (n args) :+: Tempo 3 (n args)

Cse536 Functional Programming 19 5/16/2015 row1 = testNT row row2 = testNT (Tempo 2 row) row3 = testNT (Tempo 2 (row :=: (Rest wn :+: row))) row4 = testNT (Tempo 2 (voice1 :=: voice2 :=: voice3)) where voice1 = row voice2 = (Rest wn :+: row) voice3 = (Rest (wn * 2) :+: row) Adding more value

Cse536 Functional Programming 20 5/16/2015 Midi Standard supports lots of instruments "Acoustic Grand Piano" "Bright Acoustic Piano" "Electric Grand Piano" "Honky Tonk Piano" "Rhodes Piano" "Chorused Piano" "Harpsichord" "Clavinet" "Celesta" "Glockenspiel" "Music Box" "Vibraphone" "Marimba" "Xylophone" "Tubular Bells" "Dulcimer" "Hammond Organ" "Percussive Organ" "Rock Organ" "Church Organ" "Reed Organ" "Accordion" "Harmonica" "Tango Accordion" "Acoustic Guitar (nylon)" "Acoustic Guitar (steel)" "Electric Guitar (jazz)" "Electric Guitar (clean)" "Electric Guitar (muted)" "Overdriven Guitar" "Distortion Guitar" "Guitar Harmonics" "Acoustic Bass" "Electric Bass (fingered)" "Electric Bass (picked)" "Fretless Bass" "Slap Bass 1" "Slap Bass 2" "Synth Bass 1" "Synth Bass 2" "Violin" "Viola" "Cello" "Contrabass" "Tremolo Strings" "Pizzicato Strings" "Orchestral Harp" "Timpani" "String Ensemble 1" "String Ensemble 2" "Synth Strings 1" "Synth Strings 2" "Choir Aahs" "Voice Oohs" "Synth Voice" "Orchestra Hit" "Trumpet" "Trombone" "Tuba" "Muted Trumpet" "French Horn" "Brass Section" "Synth Brass 1" "Synth Brass 2" "Soprano Sax" "Alto Sax" "Tenor Sax" "Baritone Sax" "Oboe" "Bassoon" "English Horn" "Clarinet" "Piccolo" "Flute" "Recorder" "Pan Flute" "Blown Bottle" "Shakuhachi" "Whistle" "Ocarina" "Lead 1 (square)" "Lead 2 (sawtooth)" "Lead 3 (calliope)" "Lead 4 (chiff)" "Lead 5 (charang)" "Lead 6 (voice)" "Lead 7 (fifths)" "Lead 8 (bass+lead)" "Pad 1 (new age)" "Pad 2 (warm)" "Pad 3 (polysynth)" "Pad 4 (choir)" "Pad 5 (bowed)" "Pad 6 (metallic)" "Pad 7 (halo)" "Pad 8 (sweep)" "FX1 (train)" "FX2 (soundtrack)" "FX3 (crystal)" "FX4 (atmosphere)" "FX5 (brightness)" "FX6 (goblins)" "FX7 (echoes)" "FX8 (sci-fi)" "Sitar" "Banjo" "Shamisen" "Koto" "Kalimba" "Bagpipe" "Fiddle" "Shanai" "Tinkle Bell" "Agogo" "Steel Drums" "Woodblock" "Taiko Drum" "Melodic Drum" "Synth Drum" "Reverse Cymbal" "Guitar Fret Noise" "Breath Noise" "Seashore" "Bird Tweet" "Telephone Ring" "Helicopter" "Applause" "Gunshot"

Cse536 Functional Programming 21 5/16/2015 row5 = testNT (Tempo 2 (voice1 :=: voice2 :=: voice3)) where voice1 = Instr "Tenor Sax" row voice2 = Instr "English Horn" (Rest wn :+: row) voice3 = Instr "Harpsichord" (Rest (wn * 2) :+: row) -- Is there a pattern? row6 = testNT (voice "Violin" 0 :=: voice "Flute" 1 :=: voice "Tubular Bells" 2) where voice i part = Tempo (3%2) (Instr i (Rest (wn * part) :+: row)) Adding instruments

Cse536 Functional Programming 22 5/16/2015 Repeating Music repeatM :: Music -> Music repeatM m = m :+: repeatM m nBeatsRest n note = line ((take n (repeat note)) ++ [qnr]) ex7 = line [e 4 qn [], d 4 qn [], c 4 qn [], d 4 qn [], line [ nBeatsRest 3 (n 4 qn []) | n <- [e,d] ], e 4 qn [], nBeatsRest 2 (g 4 qn []) ]

Cse536 Functional Programming 23 5/16/2015 Music Presentation Music is a highlevel, abstract representation We call the playing of Music its Presentation Presentation requires “flattening” the Music representation into a list of low level events. –Events contain information about »pitch »start-time »end-time »loudness »duration »instrument etc. The MIDI standard is a file format to represent this low level information.