开发者

Exporting sounds as WAV files

I never worked too much with sounds in Mma.

I have

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

How could I Export t as a .WAV file?

When I try the obvious

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

I get

Exporting sounds as WAV files

In this old thread Sz开发者_运维技巧abolcs said that it can't be done. Perhaps things have improved since 2007!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜