midi analysis - the blavatnik school of computer …nin/courses/workshop0405a/midieffects.doc ·...

20
Tel-Aviv University – Computer Science School Workshop in Computer Science Multivariate Modeling Sound and Interactive Multi-Media 0368-3500-07, Autumn 2004-5 Prof. Nathan Intrator 1

Upload: lyhanh

Post on 27-Jun-2018

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MIDI analysis - The Blavatnik School of Computer …nin/Courses/Workshop0405a/MidiEffects.doc · Web viewWorkshop in Computer Science Multivariate Modeling Sound and Interactive Multi-Media

Tel-Aviv University – Computer Science School

Workshop in Computer ScienceMultivariate Modeling

Sound and Interactive Multi-Media0368-3500-07, Autumn 2004-5

Prof. Nathan Intrator

By:Shahar Artzi

1

Page 2: MIDI analysis - The Blavatnik School of Computer …nin/Courses/Workshop0405a/MidiEffects.doc · Web viewWorkshop in Computer Science Multivariate Modeling Sound and Interactive Multi-Media

Table of Contents

About The Project ………………………………………………… 3

Max/Msp Introduction ……………………………………………. 4

Introduction - What is MIDI ……………………………………… 5

The Patches ………………………………………………………. 6

How To Use The MidiProj Patch …………………………. 7

Some More (smaller) Patches ……………………………………. 12

Conclusion ……………………………………………………….. 14

Bibliography ……………………………………………………... 15

2

Page 3: MIDI analysis - The Blavatnik School of Computer …nin/Courses/Workshop0405a/MidiEffects.doc · Web viewWorkshop in Computer Science Multivariate Modeling Sound and Interactive Multi-Media

About The Project

The midi effect project is one part of a bigger, three parts project.The idea of this specific project is to take a sound file (in this case a midi file), and make some “real time” changes on it, with dependence on several “real time” parameters, so the person that is listening to it will notice that the parameter have changed and will know how to react.

The parameters are given from the two other parts of the project.The first part is the hardware - responsible for obtaining an analog ECG signal and inserting it into the computer software (Mas/Msp in this case).The second part gives the parameters – it analyzes the ECG signal in real time and extracting a few parameters.Then come the midi effect part – witch takes these real time parameters and makes real time effects on the midi file.

Connecting all the parts of the project outcomes a nice tool for athletes to observe there health progress and strains.For example, if a man is running on a treadmill, connected to ECG electrodes and wearing headphones, listening to his favorite music, he will receive immediate feedback about his running through the music that he hears.

The environment where the midi affects ware written is Max/Msp 4.5.

3

Page 4: MIDI analysis - The Blavatnik School of Computer …nin/Courses/Workshop0405a/MidiEffects.doc · Web viewWorkshop in Computer Science Multivariate Modeling Sound and Interactive Multi-Media

Max/Msp Introduction Max/Msp is a graphical music programming environment.Max turns all control information into a simple stream of numbers, you can“Patch” anything to anything else.Programs are “written” using graphical objects rather than text. This reduces the need to learn a lot of arcane commands and syntax, and it provides a clear and intuitive way to write programs simply by connecting objects to each other.

Applications made with Max run in real time.Because of its speed, Max enables you to write programs that generate music instantly based on what you play, or that modify your performance as you play.

The Max/Msp has a User’s Manual witch contains three volumes: Getting Started, Tutorials and Topics, and the Max Reference Manual.

The Cycling ’74 web site (http://www.cycling74.com) provides the latest updates to the software as well as an extensive list of frequently asked questions and other support information.

4

Page 5: MIDI analysis - The Blavatnik School of Computer …nin/Courses/Workshop0405a/MidiEffects.doc · Web viewWorkshop in Computer Science Multivariate Modeling Sound and Interactive Multi-Media

Introduction - What is MIDI(Reference: at http://www.borg.com/~jglatt/tutr/whatmidi.htm)

MIDI stands for Musical Instrument Digital Interface.How Midi was invented? Musicians had a need to remotely or automatically control their musical instruments, and they wanted a method that wasn't tied to one particular manufacturer's product, nor one particular type of instrument. (i.e., they wanted a method that worked as well with an electronic piano as it did with a drum box, for example). They wanted a standard that could be useful in controlling any electronic musical device. To satisfy this need, a few music manufacturers got together in mid 1983 and created MIDI. (For more information about the history of Midi’s development, see http://www.borg.com/~jglatt/tutr/history.htm )

Mostly, MIDI is an extensive set of "musical commands" which electronic instruments use to control each other.So, what is a MIDI command? A MIDI command consists of a few (usually 2 or 3) "data bytes". These data bytes are merely a series of numbers. We refer to one of these groups of numbers as a "message" (rather than a command).There are many different MIDI messages, and each one correlates to a specific musical action. For example, there is a certain group of numbers that tells an instrument to make a sound. ("Note On"). There is a different group of numbers that tells an instrument to stop making a sound. ("Note Off" message). One of the numbers within that "Note On" or "Note Off" message tells the instrument which one of its "keys" (i.e., notes) to start or stop sounding. (Remember that a piano has 88 notes. MIDI instruments can have a maximum of 128 different notes, although some instruments respond to only messages limited to a smaller range, say 72 notes).

In this project we took a complete midi file (RAW DATA – a file contains “message” sequences) and, by using MAX software, we applied changes on the “messages” before there ware played out.In this way we do not change the original midi file, however we do make it sound differently while it is playing.The changes are mostly sets in “real time” and not in preset.

5

Page 6: MIDI analysis - The Blavatnik School of Computer …nin/Courses/Workshop0405a/MidiEffects.doc · Web viewWorkshop in Computer Science Multivariate Modeling Sound and Interactive Multi-Media

The Patches

Let’s see how the patch looks inside…

6

Page 7: MIDI analysis - The Blavatnik School of Computer …nin/Courses/Workshop0405a/MidiEffects.doc · Web viewWorkshop in Computer Science Multivariate Modeling Sound and Interactive Multi-Media

How To Use The MidiProj Patch

The MidiProj patch has 9 inlets. We will go over them from left to right:

Inlet 1: On / Off Switch Input: 0 or 1 (toggle), 0 = off, 1 = on.

Inlet 2: Read Midi fileInput: A bang, which opens the browser and let you select a file. (You have to select the file twice).

Inlet 3: Drum Volume (on channel 10) Input: float number in the range of [0,1]. 1 = max volume, 0 = min volume.

Inlet 4: Accompaniment Volume (on channel 7) Input: float number in the range of [0,1]. 1 = max volume, 0 = min volume.

Inlet 5: Lead Pitch band (on channel 4) Input: 0, 1 or 2. 1 = no change, 0 = pitch down, 2 = pitch up.

Inlet 6: Instrument Change (on channel 6)Input: float number in the range of [0,1], if the number is higher then 0.5 then the original instrument will change, if it is higher 0.75 then it will change again.

Inlet 7: Tempo Fast Forward Input: bang, that “fast forward” the speed of the midi sequence that playing.

Inlet 8: Tempo Slow Forward Input: bang, that “slow forward” the speed of the midi sequence that playing.

Inlet 9: Delay Drums Volume Input: float number in the range of [0,1]. 0 = max volume, 1 = min volume.

The MidiProj patch uses 4 “main” sub-patches: PandT, ctc, Instru, Dubble2.

7

Page 8: MIDI analysis - The Blavatnik School of Computer …nin/Courses/Workshop0405a/MidiEffects.doc · Web viewWorkshop in Computer Science Multivariate Modeling Sound and Interactive Multi-Media

PandT patch

Inside Look:

The PandT, like most of the project patches, uses the “midiparse” and “midiformat” patches.

8

Page 9: MIDI analysis - The Blavatnik School of Computer …nin/Courses/Workshop0405a/MidiEffects.doc · Web viewWorkshop in Computer Science Multivariate Modeling Sound and Interactive Multi-Media

Midiparse and midiformat

The midiparse object sorts the raw MIDI data it receives from midiin or from seq, and sends the vital sorted data out its outlets. The combination of midiin and midiparse is like having all of the specialized MIDI receiving objects in one place.Exemple:

We receive a midi sequence from “seq” in to midiparse.We separate the information with midiparse – looking at the midi channel, pitch and velocity. (we use unpack to separate the lists of pitch and velocity). We applied some changes on the pitch or velocity and send it back to “midiformat” – to restore it to a midi file – and played it with “midiout”.

In the “PandT” patch we used a patch called “gate” and the “Midi Channel” line to decide to which midi channel the changes will take place.

The “PandT” patch output is the midi file after the changes, so it could go to others patches for some more changes, before it goes out. (Midiout)

9

Page 10: MIDI analysis - The Blavatnik School of Computer …nin/Courses/Workshop0405a/MidiEffects.doc · Web viewWorkshop in Computer Science Multivariate Modeling Sound and Interactive Multi-Media

Ctc Patch

The ctc patch like the PandT patch uses “midiparse” and “midiformat” patches to break apart the midi file – and changes the volume of the selected channel.

Instru Patch

The instru patch breaks the midi sequence (“midiparse”) and with “makenote”and “pgmout” changes the instrument of the selected channel.It’s output is the midi sequence without the specific channel.

10

Page 11: MIDI analysis - The Blavatnik School of Computer …nin/Courses/Workshop0405a/MidiEffects.doc · Web viewWorkshop in Computer Science Multivariate Modeling Sound and Interactive Multi-Media

Dabble Patch

The Dabble patch makes an effect on only one specific channel, and only plays this channel.The channel is played 0.5 sec in delay (using “delay” patch).The changes he makes on the midi channel is – volume / Tempo.

11

Page 12: MIDI analysis - The Blavatnik School of Computer …nin/Courses/Workshop0405a/MidiEffects.doc · Web viewWorkshop in Computer Science Multivariate Modeling Sound and Interactive Multi-Media

Some More (smaller) Patches

Here are some more patches written for the project or used in the process of writing the project and helped it to get to what it is in the end.

MplayerAt the beginning I wrote a patch that only play a midi raw file, without making any changes to it.

The patch has 2 inlets:

1) on / off switch2) “read” message for “seq” patchNo outlet. The midi sent to “midiout”.(“sel” is a select patch – Send bang out an outlet that matches the input)

I had a big problem with this “simple” patch until I added the “midiflush”.As I mention before, all midi notes have a “note in” and “note out”, if you stop a midi sequence in the middle you can be at the situation that the “note in” is playing but the “note out” is not. In this case the note will still plays and will play forever!! (Actually until you close the entire max software or until you disable your sound card).The “midiflush” solved this problem exactly, because it send note-offs for hanging note-ons in raw MIDI data.Afterwards every significant patch I wrote contained it.

12

Page 13: MIDI analysis - The Blavatnik School of Computer …nin/Courses/Workshop0405a/MidiEffects.doc · Web viewWorkshop in Computer Science Multivariate Modeling Sound and Interactive Multi-Media

CmidiIn order to analyze a specific midi file – I wanted to know witch channel in it plays what instrument – so I wrote the Cmidi patch.

The “Cmidi” patch has 2 inlets:1) Midi sequence.2) Channel (integer).Outlet: Midi sequence with only the selected channel.

2bangA patch that receive a float number in the range of [1,0], and output a bang in the left outlet or in the right outlet – depends on the number.

MulminA patch that receive an integer number, multiply it by 100 and subtract 50 from it – and outputs the number.

13

Page 14: MIDI analysis - The Blavatnik School of Computer …nin/Courses/Workshop0405a/MidiEffects.doc · Web viewWorkshop in Computer Science Multivariate Modeling Sound and Interactive Multi-Media

Conclusion

When I started to work on the project I didn’t know how to work with Max/Msp at all.I learnt Max while working on the project, mostly with trial and error.

I have to admit, I enjoyed working in the different, graphical Max environment. After having use to working in other programming environments (like C and pascal programming), it was a refreshing change to work with Max.

Max is a very convenient software to work with midi, although the documentation of it, concerning the work with raw midi files, is not extended and can be more definite.

Nevertheless, I happy I participate in this project, I learnt many new things and exposed to many new field, like biology, signal processing, sound, and medicine.

14

Page 15: MIDI analysis - The Blavatnik School of Computer …nin/Courses/Workshop0405a/MidiEffects.doc · Web viewWorkshop in Computer Science Multivariate Modeling Sound and Interactive Multi-Media

Bibliography

Max/Msp4.5 Documentation.

Sites

http://www.dj-media.com/doc/how_do_midi_work.asp

http://www.borg.com/~jglatt/tutr/whatmidi.htm

http://www.filetrial.com/convert/mid12mid0.html

15