13

I'm trying to convert a MIDI file to a WAV file, on OS X.

So far, I have this:

fluidsynth -F output_sound soundfont.sf2 note.mid

This creates an output_sound file, however, that file is not WAV, it seems to be in sint16 format given that I get this output:

~ $ fluidsynth -O help
FluidSynth version 1.1.6
Copyright (C) 2000-2012 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of E-mu Systems, Inc.

-O options (audio file format):
   's16'

Is there an easy way to convert the output_sound to a WAV file in Terminal (or in any scriptable fashion)?

4

3 Answers 3

9

There is a simpler way than using SoX: when FluidSynth is installed with libsndfile support, it outputs WAV by default. This is how Homebrew installs FluidSynth by default:

$ brew install fluid-synth
...
$ fluidsynth -T help
FluidSynth runtime version 2.0.8
Copyright (C) 2000-2019 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of E-mu Systems, Inc.

-T options (audio file type):
   'aiff','au','auto','avr','caf','flac','htk','iff','mat','mpc','oga','paf','pvf','raw','rf64','sd2','sds','sf','voc','w64','wav','wve','xi'

auto: Determine type from file name extension, defaults to "wav"
2
  • Thank you so much! Though, I had to reinstall fluid-synth to get it working
    – Bolein95
    Mar 19, 2017 at 18:58
  • 1
    I think currently the flag/option --with-libsndfile is included by default now. Flags/options are deprecated.
    – Carolus
    Feb 18, 2020 at 15:42
7

I found the easiest solution to be timidity:

timidity input.mid -Ow -o out.wav

If you use homebrew it's also trivial to install:

brew install timidity
1
  • This worked for me ;) I had tried fluidsynth, but it could not successfully convert midi files that I created using the python-midi...
    – dermen
    Jul 8, 2016 at 16:22
3

Thanks to CL.'s comment I came up with this:

sox -t raw -r 44100 -e signed -b 16 -c 1 raw_audio audio.wav
3
  • I needed to set -c 2, also I added --norm.
    – dirkk0
    Oct 16, 2014 at 9:45
  • wheres the MIDI file ?
    – dermen
    Jul 25, 2017 at 5:59
  • 1
    this does not work with MIDI files. You have to run the fluidsynth command first.
    – vossman77
    Jul 13, 2018 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.