Exporting sounds as WAV files

荒凉一梦 提交于 2019-12-04 06:15:34
Simon

I think that it still can't be done. Mathematica supports creating and modifying MIDI objects, but leaves the sound generation from the midi to the underlying operating system. For now, you'll have to export to midi 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 the link.

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

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

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

This conversion can be automated if need be...


Apparently VLC can also convert midi to wav, which might be an easier option for some propriety operating systems! See also the options given here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!