Can I use SoX to generate audio?

╄→尐↘猪︶ㄣ 提交于 2019-12-08 16:20:20

问题


For a project I am working on, I need to use the SoX tool for audio generation. If there is a way to use SoX to generate certain notes/tones for a certain duration, please let me know! I have done quite some research on this to no avail.

Moreover, any way to make it output directly into your speakers? I'm thinking something like redirection to /dev/audio.


回答1:


You can synthesise sound effects using synth and the -n option. For instance, the following command creates a 3 seconds sine wav at 500 Hz:

sox -n -r 8000 output.wav synth 3 sine 500

You can set the sample frequancy using the option -r. Default value is 48kHz.

You can play audio directly to /dev/audio. If you just need to play the file, and not save it, you can use play utility (provided by sox) as follows:

play -n -c1 synth 3 sine 500


来源:https://stackoverflow.com/questions/24236678/can-i-use-sox-to-generate-audio

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