Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

readMidi

Read a MIDI file


Description

A MIDI file is read and returned in form of a structured data frame containing most event information (minus some meta events and minus all system events). For details about the represented information see the reference given below.

Usage

readMidi(file)

Arguments

file

Filename of MIDI file.

Value

A data frame consisting of columns

time

Time or delta-time of the events, depending on the MIDI format.

event

A factor indicating the event.

type

An integer indicating the type of a “meta event”, otherwise NA.

channel

The channel number or NA if not applicable.

parameter1

First parameter of an event, e.g. a representation for a note in a “note event”.

parameter2

Second parameter of an event.

parameterMetaSystem

Information in a “meta event”, currently all meta events are converted to a character representation (of hex, if all fails), but future versions may have more appropriate representations.

track

The track number.

Please see the given reference about the MIDI file format about details.

Note

The data structure may be changed or extended in future versions.

Author(s)

Uwe Ligges and Johanna Mielke

References

A good reference about the Midi file format can be found at http://www.music.mcgill.ca/~ich/classes/mumt306/StandardMIDIfileformat.html.

See Also

The function getMidiNotes extracts a more readable representation of note events only.

You may also want to read Wave (readWave) or MP3 (readMP3).

Examples

content <- readMidi(system.file("example_files", "Bass_sample.mid", package="tuneR"))
str(content)
content

tuneR

Analysis of Music and Speech

v1.3.3
GPL-2 | GPL-3
Authors
Uwe Ligges <ligges@statistik.tu-dortmund.de> with contributions from Sebastian Krey, Olaf Mersmann, Sarah Schnackenberg, Guillaume Guenard, Andrea Preusser, Anita Thieler, Johanna Mielke and Claus Weihs, as well as code fragments and ideas from the former package 'sound' by Matthias Heymann and functions from 'rastamat' by Daniel P. W. Ellis. The included parts of the libmad MPEG audio decoder library are authored by Underbit Technologies.
Initial release
2018-07-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.