Create a wave file using a C++ library(like libsndfile library)
Convert the wave file to mp3 using a utility (like lame). This is a command line tool which can be called from your C program as well. see -t for converting wave to mp3.
One thing to note is 15KHz is very high frequency to be heard by human and I guess most of speakers are not capable of playing it as it is beyond cutoff frequency of them. So don't be surprised if you don't hear the result.
发布评论
评论(3)
您可以使用 Python 的
wave
模块创建一个波形文件,然后将其压缩为 MP3。要创建一秒 15khz 正弦波:You could use Python's
wave
module to create a wave file which you could then compress to MP3. To create a one second 15khz sine wave:我会将其分为两部分:
-t
将 Wave 转换为 mp3。需要注意的一件事是 15KHz 是人类听到的非常高的频率,我猜大多数扬声器都无法播放它,因为它超出了它们的截止频率。因此,如果您没有听到结果,请不要感到惊讶。
I would break this into 2 pieces:
-t
for converting wave to mp3.One thing to note is 15KHz is very high frequency to be heard by human and I guess most of speakers are not capable of playing it as it is beyond cutoff frequency of them. So don't be surprised if you don't hear the result.
你有没有尝试过:
Have you tried: