Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music...

21
Introduction to MIDI & Music Synthesis Lecture

Transcript of Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music...

Page 1: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

Introduction to MIDI & Music Synthesis

Lecture

Page 2: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

Topics today…

Synthetic sounds

MIDI Basics

Wavetable synthesis

Few Techniques for Wavetable synthesis

Multimedia Computing (CSIT 410) 2

Page 3: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

Synthetic Sounds

1. FM (Frequency Modulation): one approach to generating synthetic sound:

x(t)= A(t)cos[ωcπt + I(t)cos(ωmπt+φm)+φc]

Multimedia Computing (CSIT 410) 3

Page 4: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

Frequency Modulation

Multimedia Computing (CSIT 410)

(a): A single frequency. (b): Twice the frequency. (c): Usually, FM is carried out usinga sinusoid argument to a sinusoid. (d): A more complex form arises from a carrierfrequency, 2πt and a modulating frequency 4πt cosine inside the sinusoid.

4

Page 5: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

Wave Table synthesisA more accurate way of generatingsounds from digital signals. Also known,simply, as sampling.In this technique, the actual digitalsamples of sounds from real instrumentsare stored. Since wave tables are storedin memory on the sound card, they canbe manipulated by software so thatsounds can be combined, edited, andenhanced.

Multimedia Computing (CSIT 410) 5

Page 6: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

MIDI

Efficient method for representing musicalperformance informationOne minute music commonly requires 5Mbytes, whereas MIDI for 1 min requires 1Kbytes.

MIDI does not contain sampled audio data,instead the instructions (MIDI Messages) that thesynthesizer can use to generate soundEasy to edit the music, change the playback speedand the pitch or key of the sounds independently.

Multimedia Computing (CSIT 410) 6

Page 7: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

MIDI Basics

Provide the means for conveying themusical performances efficiently10 bits transmitted per byte (including 1start & 1 stop bits, as zeros)MIDI interface on a MIDI device containsconnectors

INOUTTHRU

Multimedia Computing (CSIT 410) 7

Page 8: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

MIDI Basics [2]

MIDI data stream originates fromMIDI controller such as MIDISequencer, KeyboardThe recipient of the MIDI stream isthe MIDI Sound generator or soundmodule16 logical channels, identified byincluding 4 bit channel number withthe MIDI messages

Multimedia Computing (CSIT 410) 8

Page 9: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

MIDI Basics [3]

Multimedia Computing (CSIT 410)

MIDI System

9

Page 10: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

MIDI Messages

A message is composed of a status byte, followed by one or two bytes of dataClassified as

Channel messages (First bit 1)Channel voice messages Channel Mode messages

System Messages (First 4 bits 1)System Common messagesSystem Real-time MessagesSystem Exclusive Messages

MIDI messages tables

http://www.midi.org/about-midi/table1.shtml

Multimedia Computing (CSIT 410) 10

Page 11: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

MIDI Sequencers & synthesizers

SequencersAdds time-stamping to the MIDI messages

SynthesizerPolyphonicHelps sending MIDI messages to MIDI synthesizer

Ability to play more than one note at a timeMultitimbral Mode

Capable of producing two or more different instrumentsounds simultaneouslyIf a synthesizer can play five notes simultaneously, and itcan produce a piano sound and an acoustic bass sound atthe same time, then it is multitimbral and polyphonic.

Multimedia Computing (CSIT 410) 11

Page 12: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

Standard MIDI Files

MIDI messages are stored in disks as MIDIfilesMIDI file is the major source of music incomputer games, CD Entertainment titlesThe file format is SMF (Standard MIDIFormat)SMF file stores standard MIDI messagesalong with the appropriate timing informationSMF files organizes data in chunks, precededby ID and size

Multimedia Computing (CSIT 410) 12

Page 13: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

Standard MIDI Files [2]

A chunk is a group of related data itemsEach chunk begins with 4 characters ID, saying thetype of the chunk, next 4 bytes forms the size of thechunk. ID & size forms the chunk headerMIDI Chunks are of following types

MThdMTrk

What does the header following header mean?4D 54 68 64 00 00 00 06

More on MIDI file formathttp://home.roadrunner.com/~jgglatt/tech/midifile.htm

Multimedia Computing (CSIT 410) 13

Page 14: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

Wavetable Synthesis

Stores high quality sound samplesdigitally & plays it on demandTable of sound waveforms which may belooked up and utilized when needed,hence the name Wavetable.Amount of memory required to storethese samples can be reduced bytechniques collectively called asWavetable Synthesis Techniques

Multimedia Computing (CSIT 410) 14

Page 15: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

Technique-1Looping and Envelope Generation

Attack & Sustain portions of a waveform

Looping of a Sample Segment

Multimedia Computing (CSIT 410) 15

Page 16: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

Technique-1Looping and Envelope Generation [2]

The fairly constant sustain section can be represented by looping the wave samples, multiplied by the gain-factor (governed by ADSR envelope)

A waveform is stored with

A sample of Attack sectionA sample for the loop in sustain section

ADSR Amplitude Envelope

Multimedia Computing (CSIT 410) 16

Page 17: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

Technique-1Looping and Envelope Generation [3]

Loop length is measured as the number ofsamplesSample whose sound cannot beadequately modeled as ADSR, such asshort sounds or sounds of dynamicbehavior, cannot be looped. These soundsare called one-shot sounds

Multimedia Computing (CSIT 410) 17

Page 18: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

Technique-2 Pitch Shifting

Technique to generate number ofdifferent notes from single sound sampleof a given instrumentPitch shifting can be accomplished byreading the stored sample at differentratesAllowing the sample pointer to have onlyinteger increments restricts the pitchshifts to a limited setIn general, sample pointer consists ofintegers, as well as fractional pointers

Multimedia Computing (CSIT 410) 18

Page 19: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

Technique-2 Mathematical Interpolation

Sample memory addressing and Interpolation

For More on Wavetable synthesis, refer reference number 1 quoted at the end of this presentationMultimedia Computing

(CSIT 410) 19

Page 20: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

MIDI to WAV Conversion

Some programs, such as early versions ofPremiere, cannot include .mid files -- instead,they insist on .wav format files.

a) Various shareware programs exist for approximatinga reasonable conversion between MIDI and WAVformats.

b) These programs essentially consist of large lookupfiles that try to substitute pre-defined or shifted WAVoutput for MIDI messages, with inconsistent success.

Multimedia Computing (CSIT 410) 20

Page 21: Introduction to MIDI & Music Synthesisgutierre/ctlect08.pdf · Introduction to MIDI & Music Synthesis Lecture. ... 7. MIDI Basics [2] {MIDI ... (Standard MIDI Format) {SMF file stores

Reference

1. “Tutorial on MIDI and Music Synthesis”, http://www.midi.org/aboutmidi/tut_midimusicsynth.php

2. Several Tutorials on MIDI: http://www.midi.org/about-midi/tutorial/tutor.shtml

3. Chapter 6

Multimedia Computing (CSIT 410) 21