简体   繁体   English

是否有可能将(频率,幅度)数据转换为Python中相应的(音频)声音?

[英]Is it possible to convert (frequency, amplitude)-data to the corresponding (audio) sound in Python?

I am working on a Python project simulating the sounds produced by vibrating strings. 我正在研究一个模拟振动弦产生的声音的Python项目。 If for a given string, I have determined the Fourier transform of the motion, those results can by a simple operation be changed into the data showing the amplitude per (audio) frequency. 如果对于给定的字符串,我已经确定了运动的傅立叶变换,那么这些结果可以通过简单的操作变成显示每(音频)频率的幅度的数据。

Is it possible to then turn those (frequency, amplitude)-data into the corresponding sound using Python? 是否有可能使用Python将那些(频率,幅度)数据转换为相应的声音?

I have tried it using IPython.display.audio but didn't manage to get it working properly. 我已经尝试使用IPython.display.audio,但没有设法让它正常工作。

If i understand you correctly,you can extract and convert a specific (frequency, amplitude)-data into wav file with scipy.io.wavfile.write . 如果我理解正确,您可以使用scipy.io.wavfile.write提取特定(频率,幅度)数据并将其转换为wav文件。 Just don't forget to convert your array to [sample,channel] format. 只是不要忘记将数组转换为[sample,channel]格式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM