简体   繁体   English

如何从声音文件中获取幅度和频率?

[英]How do I get the amplitude and frequency from a sound file?

y, sound = scipy.io.wavfile.read('mysound.wav')

If I plot the absolute value of sound , is that the amplitude of 'mysound.wav'?如果我 plot sound的绝对值,是'mysound.wav'的幅度吗? That is, how loud the sound is?也就是说,声音有多大?

What exactly is being stored in the sound?声音中究竟存储了什么? I know it's a representation of the sound?我知道这是声音的代表吗? How does one get the frequency and amplitude from that representation?如何从该表示中获得频率和幅度?

This is not too much a coding question but a physics related question!这不是一个太多的编码问题,而是一个与物理相关的问题! Your sound variable contains a list of "instantaneous amplitudes", but I think it is not what you are looking for.您的sound变量包含“瞬时幅度”列表,但我认为这不是您要找的。 If your file is a pure sinusoid, then the maximum of your data will be the amplitude of your sound (its strength).如果您的文件是纯正弦曲线,则数据的最大值将是声音的幅度(其强度)。

However, your sound might have amplitude variation over time.但是,您的声音可能会随着时间的推移而出现幅度变化。 For example you can play strongly a note of an instrument and then it fades in slowly.例如,您可以强烈地演奏一个乐器的音符,然后慢慢淡入。 The amplitude is thus defined in a short time period.因此,幅度在很短的时间段内被定义。

The sound can also be made up of different frequencies (harmonics, human voice...).声音也可以由不同的频率组成(谐波、人声……)。 A more complete description uses Fourier Transforms and spectrograms .更完整的描述使用傅立叶变换和频谱图

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

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