Learn R Programming

fluidsynth (version 1.0.2)

midi_play: Play or convert a midi file

Description

Play a midi file to your audio device, render it to a file, or parse the raw data. Additional settings can be specified, see fluidsynth_setting_list for available options.

Usage

midi_play(
  midi = demo_midi(),
  soundfont = soundfont_path(),
  audio.driver = NULL,
  settings = list(),
  verbose = interactive()
)

midi_convert( midi = demo_midi(), soundfont = soundfont_path(), output = "output.mp3", settings = list(), verbose = interactive() )

midi_read(midi = demo_midi(), verbose = FALSE)

demo_midi()

Value

midi_read returns data frame with midi events.

Arguments

midi

path to the midi file

soundfont

path to the soundfont

audio.driver

which audio driver to use, see fluidsynth docs

settings

a named vector with additional settings from fluidsynth_setting_list()

verbose

print some progress status to the terminal

output

filename of the output. The out

Details

The midi_convert function internally uses fluidsynth to generate a raw wav file, and then av::av_audio_convert() to convert into the requested about format. See av::av_muxers() for supported output formats and their corresponding file extension.

You need a soundfont to synthesize midi, see the soundfonts page. On Linux you may also need to specify an audio.driver that works for your hardware, although on recent distributions the defaults generally work.

See Also

Other fluidsynth: fluidsynth_settings, soundfonts

Examples

Run this code
df <- midi_read(demo_midi())

Run the code above in your browser using DataLab