Chapter 22 From Performance to MIDI. Motivation  Abstractly, an MDL program denotes a Performance.  But a Performance is just a Haskell data structure.

Slides:



Advertisements
Similar presentations
Peter Rademaker & Robert Stremler. Preview 1.Introduction 2.The Basics 3.Simple Examples 4.Interpretation and Performance 5.MIDI 6.Algebraic Properties.
Advertisements

MUSC1010 – WEEK 5 MIDI sequencing in Pro Tools. Cycle Record including MIDI Merge Follow the steps under “STARTING WITH MIDI & SOFT-SYNTHS” in last week’s.
Computer Fundamentals Multimedia MSCH 233 Lecture 10.
4.2 Multimedia Elements Audio 1. Learning Outcomes: At the end of the lesson, students should be: a) describe the purpose of using audio in multimedia.
3.6 Multimedia/Digital Media Components (Audio and Video) by Francisco Oliveira.
Kathleen Fisher cs242 Reading: “A history of Haskell: Being lazy with class”,A history of Haskell: Being lazy with class Section 6.4 and Section 7 “Monads.
Int 2 Multimedia Revision. Digitised Sound Analogue sound recorded from person, or real instruments.
I Power Higher Computing Multimedia technology Audio.
SWE 423: Multimedia Systems Chapter 3: Audio Technology (2)
Digital audio recording Kimmo Tukiainen. My background playing music since I was five first time in a studio at fourteen recording on my own for six months.
1 Digital Audio Storage Formats. 2 Formats  There are many different formats for storing and communicating digital audio:  CD audio  Wav  Aiff  Au.
Musical Instrument Digital Interface. MIDI Musical Instrument Digital Interface Enables electronic musical instruments, such as keyboard controllers,
Chapter 17 Rendering Reactive Animations. Motivation  In the previous chapter we learned just enough about advanced IO and concurrency to develop a “renderer”
Sound: Audio & Music B.Sc. (Hons) Multimedia ComputingMedia Technologies.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies,
BY CHRIS ANDERSON Creating a MIDI Generator Program.
ISE 582 Making Music (with MIDI) November 6, 2003 Arpi Mardirossian.
Honours project: Interim presentation Amanda Crawford – Comp. Sci. Honours
Cse536 Functional Programming 1 6/26/2015 Lecture #19, Dec. 6, 2004 Todays Topics –Interpreting Music –Performance –MidiFile Read – Chapters 21 - Interpreting.
1 My Beats Final Presentation Mike Smith, Karen Tipping, Dylan Barrett.
Chapter 9 Audio.
Chapter 14 Recording and Editing Sound. Getting Started FAQs: − How does audio capability enhance my PC? − How does your PC record, store, and play digital.
Andrew Welds Music Technology BTEC. Examples MIDI-Karaoke (which uses the ".kar" file extension) files are an "unofficial" extension of MIDI files, used.
Object Orientated Data Topic 5: Multimedia Technology.
M I D I Musical Instrument Digital Interface The MIDI protocol — a “language” that lets synthesizers, computers and other devices talk to each other.
Making a MIDI Keyboard Bob Wayne Bell, Jr. Nov. 15, 2002 EE281.
Welcome to The Music Jungle By Dean Smith And Cathy Ritter.
Midi files Here we look at another way of dealing with sound on a computer the use of Midi files. The the Midi file differs from the “wav” file, because.
MIDI. A protocol that enables computers, synthesizers, keyboards, and other musical devices to communicate with each other. Instead of storing actual.
컴퓨터 전자음악 입문 10 주차 Tutorials 4 Editing MIDI. Tutorial Tutorial 1 - Basics Tutorial 2 - Recording MIDI Tutorial 3 - Recording Digital Audio Tutorial 4 -
MIDI and YOU Orchestra in a Box. What is MIDI?  Musical Instrument Digital Interface  MIDI is a protocol - a standard by which two electronic instruments.
Home entertainment. The hardware, software and techniques used for sound MP3 players: play music files stored digitally in MP3 file format are small and.
Sound on the Web. Using Sound on a Web Site Conveying information  pronounce a word or describe a product Set a mood  music to match the web page scene.
Overview of Multimedia A multimedia presentation might contain: –Text –Animation –Digital Sound Effects –Voices –Video Clips –Photographic Stills –Music.
Types of Data. Numbers Text Pictures Sound Video.
Multimedia Technology and Applications Chapter 2. Digital Audio
Chapter 15 Recording and Editing Sound. 2Practical PC 5 th Edition Chapter 15 Getting Started In this Chapter, you will learn: − How sound capability.
Multimedia ITGS. Multimedia Multimedia: Documents that contain information in more than one form: Text Sound Images Video Hypertext: A document or set.
Digital Audio IV MIDI Overview. Sending MIDI Information I. Serial Transmission A. Single cable to move data B. Slower than parallel, but is less expensive.
Specialized Input and Output. Inputting Sound ● The microphone is the most basic device for inputting sounds into a computer ● Microphones capture sounds.
Unit 01- setting up and operate a digital audio workstation By Alfie fennemore.
DATA AND FILE FORMATS. RTF TIFF MIDI JPEG DIB MPEG
By Cheyenne Morgan Unit 1- Set up and operate a DAW.
CSCI-100 Introduction to Computing Hardware Part II.
For use with WJEC Performing Arts GCSE Unit 1 and Unit 3 Task 1 Music Technology Technical issues.
Interactive Multimedia Sound Mikael Fernström. Data sources Microphones and transducers –Sample acoustic reality Synthesis –Simulate reality (and beyond.
Quick Record (Simple Song) 1. Press the Record Button 2. Press the (F2) Soft Button to select Quick Record 3.Press the Play Button to start the recording.
PJV25 1 javax.sound.midi try { Sequencer seq = MidiSystem.getSequencer( ); seq.open( ); Sequence z = MidiSystem.getSequence( new File( "res/song.mid" )
Glencoe Introduction to Multimedia Chapter 8 Audio 1 Section 8.1 Audio in Multimedia Audio plays many roles in multimedia. Effective use in multimedia.
Guerino Mazzola (Fall 2015 © ): Honors Seminar IV.3 Communication IV.3.1 (Fr Nov 06) MIDI.
9 th Grade Science Chapter 12c.  Definition: ◦ Sounds used in regular pattern that is pleasing to hear  Every musical instrument has: ◦ Natural frequency:
Project Presentation Eoin Culhane Multi Channel Music Recognition for an Electric Guitar.
Multi Channel Music Recognition for an Electric Guitar.
Final Year Project Eoin Culhane. MIDI Guitar Guitar with 6 outputs 1 output for each string Each individual string output will be converted to MIDI.
MIDI. MIDI, which means: Musical Instrument Digital Interface, is a digital communications protocol. In August of 1983, music manufacturers agreed on.
MIDI Controller By: Ronal Inga Jeyner Cespedes. Musical Instrument Digital Interface is a computer language that allows communication with other devices.
Garage Band For MAC. What is it? A digital audio workstation that can record and play back multiple tracks of audio. Is a software application for OS.
XP Practical PC, 3e Chapter 14 1 Recording and Editing Sound.
By Kyle Tatum.  MIDI (or Musical Instrumental Digital Interface) is an industry-standard protocol, first defined in 1982 by Gordon Hall, that enables.
Chapter 8 Sound FX Composition. Chapter 8 Sound FX Composition.
Chapter 15 Recording and Editing Sound
Objective % Explain concepts used to create digital audio.
European Robotic LABoratory
Creating Simple Music By Keith Lynn
Laser Harp Team: Peter Crinklaw Qiushi Jiang Edwin Rodriguez.
Objective % Explain concepts used to create digital audio.
Multimedia: making it Work
The MIDI Standard A.
Objective Explain concepts used to create digital audio.
Chapter 9 Audio.
Presentation transcript:

Chapter 22 From Performance to MIDI

Motivation  Abstractly, an MDL program denotes a Performance.  But a Performance is just a Haskell data structure – we can analyze it, but we cannot hear it!  To remedy this, we will convert a Performance into a MIDI File.  MIDI (Musical Instrument Digital Interface) is a standard protocol for describing electronic music.  The MIDI file format is part of this standard, and all consumer PC’s are capable of playing them through the PC’s sound card.  In addition, General MIDI standardizes instrument and percussion names as used in MDL.

Our Goal  We need to define a function (called “test” in text): musicToMidi :: Music -> IO () musicToMidi = outputMidiFile "test.mid“. performToMidi. perform defCon  “perform” was defined in the previous chapter, and “defCon” is just the default Context.  So additionally we need: performToMidi :: Performance -> MidiFile outputMidiFile :: String -> MidiFile -> IO ()  “MidiFile” and “outputMidiFile” are imported from Haskore. Our main job is to define “performToMidi”.

MidiFile Data Type  The MidiFile data type (imported from Haskore) captures the essence of a Midi file: data MidiFile = MidiFile MFType Division [Track] deriving (Show, Eq) type MFType = Int type Track = [MEvent] data Division = Ticks Int | SMPTE Int Int deriving (Show,Eq) data MEvent= MidiEvent ElapsedTime MidiEvent | MetaEvent ElapsedTime MetaEvent | NoEvent deriving (Show,Eq) type ElapsedTime = Int [ see text for details ]

MIDI Events  MIDI events are like MDL events, except that there are events for both start and end of a note: data MidiEvent = | NoteOff MidiChannel MPitch Velocity | NoteOn MidiChannel MPitch Velocity | ProgChange MidiChannel ProgNum |... deriving (Show, Eq) type MPitch= Int;type Velocity = Int type ProgNum= Int;type MidiChannel = Int data MetaEvent = SetTempo MTempo |... deriving (Show, Eq) type MTempo = Int

performToMidi  To convert a Performance into a MidiFile value: performToMidi :: Performance -> MidiFile performToMidi pf = MidiFile mfType (Ticks division) (map performToMEvs (splitByInst pf)) mfType = 1:: Int division = 96:: Int  This leaves two functions: splitByInst :: Performance -> [(MidiChannel,ProgNum,Performance)] performToMEvs :: (MidiChannel,ProgNum,Performance) -> [MEvent]  In a Type 1 MIDI file, each instrument is associated with a separate track. splitByInst splits the Performance to achieve this (see text for details).

performToMEvs performToMEvs :: (MidiChannel,ProgNum,Performance) -> [MEvent] performToMEvs (ch,pn,perf) = let setupInst= MidiEvent 0 (ProgChange ch pn) setTempo= MetaEvent 0 (SetTempo tempo) loop []= [] loop (e:es)= let (mev1,mev2) = mkMEvents ch e in mev1 : insertMEvent mev2 (loop es) in setupInst : setTempo : loop perf tempo = :: Int-- number of microsecs in one beat insertMEvent :: MEvent -> [MEvent] -> [MEvent] insertMEvent ev1 [] = [ev1] insertMEvent t1 _) t2 _) : evs') = if t1 <= t2 then ev1 : evs else ev2 : insertMEvent ev1 evs'

mkMEvents  Finally, we convert individual notes: mkMEvents :: MidiChannel -> Event -> (MEvent,MEvent) mkMEvents mChan (Event { eTime = t, ePitch = p, eDur = d }) = ( MidiEvent (toDelta t) (NoteOn mChan p 127), MidiEvent (toDelta (t+d)) (NoteOff mChan p 127) ) toDelta t = round (t * 4.0 * intToFloat division)