Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M....

18
metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta , and David Rizo Computer Music Laboratory University of Alicante {tperez,inesta,drizo}@dlsi.ua.es

description

MIDI Metadata File global metadata: – filename, text metaevents, size, format, number of tracks, resolution, tempo, meter, key, timbral, … Track metatada: – Text metaevents: track name, instrument name, lyrics, markers, … – Content description: duration, occupation, polyphony, pitch range, …

Transcript of Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M....

Page 1: Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta,…

metamidi: a tool for automatic metadata extraction from MIDI files

Tomás Pérez-García, Jose M. Iñesta, and David Rizo Computer Music Laboratory

University of Alicante{tperez,inesta,drizo}@dlsi.ua.es

Page 2: Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta,…

Introduction

• Metadata permit organization, indexing, and retrieval of music information.

• Metadata are an important subject of research.

• metamidi is introduced as a tool for metadata extraction from MIDI files:– Global technical– Track content description and metaevents

Page 3: Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta,…

MIDI Metadata

• File global metadata: – filename, text metaevents, size, format, number of

tracks, resolution, tempo, meter, key, timbral, …• Track metatada:

– Text metaevents:• track name, instrument name, lyrics, markers, …

– Content description:• duration, occupation, polyphony, pitch range, …

Page 4: Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta,…

The metamidi tool

• Downloadable from our group web site– http://grfia.dlsi.ua.es/gen.php?id=resources

• Source code, DTD, XSD

• Developed in ANSI C 4.2.4 version

• Open source

• Tested under Linux.

Page 5: Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta,…

The metamidi tool• metamidi –{r|x|l} file [-o fileoutput]

Metadata output formats: -r: register -l: line -x: XML

-r ------- Midi features --------name: /Users/inesta/metamidi/straussmyrthenbluten.midtext metaevent: $size: 48323format: 1num tracks: 5resolution: 1024tempo: 176.00tempo changes: 70meter: 6/8(0),1/4(15360),6/8(24576),1/4(113664),3/4(114688)meter changes: 5key: FM(0),CM(225280),FM(335872),BbM(385024),FM(495616),BbM(606208)key changes: 6instruments: 1percussion: -1duration: 1515521has sysex: 0------ Features of track 0 ----text metaevent: $channel: -1duration: 1515521duration rate: 1.00occupation: 0occupation rate: 0.00polyphony duration rate: 0.00max polyphony: 0avg polyphony: 0.00low pitch: -1high pitch: -1modulations: 0aftertouches: 0pitch bends: 0program changes: $

Page 6: Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta,…

The metamidi tool• metamidi –{r|x|l} file [-o fileoutput]

Metadata output formats: -r: register -l: line -x: XML

-l '/Users/inesta/metamidi/straussmyrthenbluten.mid';'$';48323;1;5;1024;176.00;70;6/8(0),1/4(15360),6/8(24576),1/4(113664),3/4(114688);5;FM(0),CM(225280),FM(335872),BbM(385024),FM(495616),BbM(606208);6;1;-1;1515521;0;|0;'$';-1;1515521;1.00;0;0.00;0.00;0;0.00;-1;-1;0;0;0;$;|1;'Acoustic Grand Piano';1;1515521;1.00;606315;0.40;0.47;4;1.69;33;69;0;0;0;1(0);|2;'ACP 4';4;1515521;1.00;1263793;0.83;0.71;4;1.85;43;93;0;0;0;1(0);|3;'ACP 3';3;1515521;1.00;127284;0.08;0.27;9;1.71;48;84;0;0;0;1(0);|4;'B.S. Lengton';2;1515521;1.00;760688;0.50;0.96;4;2.87;29;70;0;0;0;1(0);

Page 7: Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta,…

The metamidi tool• metamidi –{r|x|l} file [-o fileoutput]

Metadata output formats: -r: register -l: line -x: XML

-x <?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE midifile SYSTEM "metamidi.dtd"><midifile><external name="/Users/inesta/metamidi/straussmyrthenbluten.mid" size="48323" midiformat="1" numtracks="5" resolution="1024"><comments></comments></external><global metaeventtext="$" tempo="176.00" tempoChanges="70" meter="6/8(0),1/4(15360),6/8(24576),1/4(113664),3/4(114688)" meterChanges="5" key="FM(0),CM(225280),FM(335872),BbM(385024),FM(495616),BbM(606208)" keyChanges= "6" instruments="1" percussion="-1" duration="1515521.00" hasSysEx="0"><comments></comments></global><tracks><track metaeventtext="$" channel="-1" duration="1515521" durationRate="1.00" occupation="0" occupationRate="0.00" polyphonyDurationRate="0.00" maxPolyphony="0" avgPolyphony="0.00" lowpitch="-1" highpitch="-1" modulations="0" afterTouches="0" pitchBends="0" programChanges="$"><comments></comments><track metaeventtext="Acoustic Grand Piano" channel="1" duration="1515521" durationRate="1.00" occupation="606315" occupationRate="0.40" polyphonyDurationRate="0.47" maxPolyphony="4" avgPolyphony="1.69" lowpitch="33" highpitch="69" modulations="0" afterTouches="0" pitchBends="0" programChanges="1(0)"><comments></comments></track><track metaeventtext="ACP 4" channel="4" duration="1515521" durationRate="1.00" occupation="1263793" occupationRate="0.83" polyphonyDurationRate="0.71" maxPolyphony="4" avgPolyphony="1.85" lowpitch="43" highpitch="93" modulations="0" afterTouches="0" pitchBends="0" programChanges="1(0)"><comments></comments>

Page 8: Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta,…

Applications

• Metadata can help in MIDI file indexing, organizing or classifying tasks.

• In this paper we have presented two examples of the use of the metamidi output in MIR problems:– Melody track selection using track content features– Genre classification using timbral metadata

Page 9: Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta,…

Melody track selection

• Metadata are used to compute the probability of a track to contain the melody of a MIDI file.

• What metadata should be used?– Amount of music information: occupation rate– Melody are usually monophonic: polyphony

duration rate, max polyphony, average polypohony– Pitch ranges: lowest pitch, highest pitch

Page 10: Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta,…

Melody track selection

• Training phase: assuming a Gaussian distribution for the values of a descriptor d, P(d|M) and P(d|M) are obtained from the tracks labeled as melodies and not melodies.

• Test phase: Bayes theorem is used to compute the probability of a track to be a melody:

)()|()()|()()|()|(

MPMdPMPMdPMPMdPdMP

Page 11: Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta,…

Melody track selection• The decision is taken using a maximum likelihood criterion

for all the tracks (i) in the file with probability over a threshold, :

)|(maxarg iiM dMPt

Corpus Descr. S% P R F

Clas200 High pitch 0.05 98.5 0.99 1.00 0.99

Clas Avg.Poly 0.20 80.8 0.81 1.00 0.89

Jazz200 Max.Poly & Low p. 0.12 86.5 0.88 0.98 0.93

Jazz Max.Poly & Low p. 0.052 82.0 0.83 0.99 0.90

Kar200 Avg.Poly 0.10 80.9 0.81 1.00 0.89

Kar Avg. Poly 0.10 88.6 0.87 1.00 0.94

Page 12: Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta,…

Timbre-based genre classification

• Use timbral information provided by metamidi to classify MIDI files into musical genres also under a probabilistic approach.

131}1,0{ Dx• File representation:

x = (1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0 … 0,0,1,0,0)

(128 GM + 3 percussions)

Grand piano Electric bass Electric guitar Drum kit

D

ijiijiij ctPxctPxcP

1

))|(1)(1()|()|(x

Page 13: Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta,…

Timbre-based genre classification

• The probability for instrument ti in class cj is computed from the training set

• A MIDI file is assigned to the class cj that maximizes the a posteriori probability

)()|()(

)|(xx

xP

cPcPcP jjj

)|( ji ctP

# files of cj with ti# files of cj

Page 14: Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta,…

Timbre-based genre classification

• Data set:– Hierarchical classes: 3 9

(235) Classical

(338) Jazz

(283) Popular

Baroque (56)Classic (50)Romantic (129)

Pre-bop (178)Bop (94)Bossanova (66)

Celtic (99)Blues (84)Pop (100)

Page 15: Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta,…

Timbre-based genre classification

Academic Jazz Popular

Academic 228 6 1

Jazz 3 295 40

Popular 5 16 262

• 3 class experiment– (10 fold crossvalidation)– 93 2 % (39.5 % baseline) (+53.5 %)

Page 16: Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta,…

Timbre-based genre classification

bar clas Rom Pre Bop Bos Cel Blu pop

Baroque 35 5 16 0 0 0 0 0 0

Classic 8 1 41 0 0 0 0 0 0

Romantic 12 7 110 0 0 0 0 0 0

Prebop 0 0 0 150 22 6 0 0 0

Bop 0 0 0 78 10 6 0 0 0

bossa 0 0 0 3 1 52 1 0 9

Celtic 0 0 1 2 0 1 96 0 0

Blues 0 0 0 7 1 1 5 62 8

pop 0 1 0 1 2 13 4 7 73

• 9 class experiment– (10 fold crossvalidation)– 68 5 % (20.8 % baseline) (+47.2 %)

Page 17: Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta,…

Conclusions

• metamidi has been designed as a tool for metadata extraction from standard MIDI files.

• The good performances of the presented examples show the power of metadata automatc extraction tools for helping in the solution of MIR problems.

Page 18: Metamidi: a tool for automatic metadata extraction from MIDI files Tomás Pérez-García, Jose M. Iñesta,…

metamidi: a tool for automatic metadata extraction from MIDI files

Tomás Pérez-García, Jose M. Iñesta, and David Rizo Computer Music Laboratory

University of Alicante{tperez,inesta,drizo}@dlsi.ua.es