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
In this old thread Szabolcs 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.
链接地址: http://www.djcxy.com/p/55036.html上一篇: 在Python程序中嵌入一个Web浏览器
下一篇: 将声音导出为WAV文件