Export Sounds as WAV Files

I have never worked too much with sounds in Mme.

I have

t = Sound[List["Violin",SoundNote[-6]]] 

How can I export t to a .WAV file?

When I try to make the obvious

 Export["c:\\test.wav",t] 

I get

enter image description here

In this old thread, Szabolcs said this was not possible. Perhaps since 2007 the situation has improved!

+7
source share
1 answer

I think this is still not possible. Mathematica supports creating and modifying MIDI objects, but leaves the sound generation from midi to the underlying operating system. For now, you will need to export to midi and then use the midi interface on your system or an online service to convert to a sampled sound format.

For example (from the documentation)

 t = Sound[SoundNote[DeleteCases[3 Range[31] Reverse[#], 0] - 48, .1] & /@ Transpose[CellularAutomaton[90, {{1}, 0}, 30]]] Export["test.mid", t] 

Uploaded to http://free-midi-converter.com/Midi/Create gives a link.

It can also be converted using TiMidity , which is available on all major operating systems with the command (assuming you run above)

 Run["timidity test.mid -Ow -o test.wav"] 

which can be imported back to Mathematica using Import["test.wav"] .

This conversion can be automated if necessary ...


Apparently VLC can also convert midi to wav , which may be easier for some cool operating systems! See also the options given here .

+4
source

All Articles