简体   繁体   English

减少python windsound中的“雨滴”声音。

[英]Reduce “raindrop” sound in python windsound.Beep

I was making a python program that uses winsound.Beep(int, int) , and I noticed that after it plays each beep it makes a loud annoying "raindrop" sound. 我当时正在制作一个使用winsound.Beep(int, int)的python程序,我注意到在播放每次蜂鸣声之后,它会发出令人讨厌的“雨滴”声。 Is there a way to fix this? 有没有办法解决这个问题?

It sounds like what you're experiencing is what's know as clicks in the audio world. 听起来您正在体验的就是音频世界中的点击。 They occur when an audio signal jumps rapidly in a value. 它们在音频信号快速跳变值时发生。 They also occur when a signal suddenly stops but hasn't reached the zero crossing point. 当信号突然停止但尚未达到零交叉点时,也会发生它们。 The diagram on this page here shows what's happening pretty well; 本页上的图表显示了发生的一切;

http://www.soundonsound.com/sos/oct06/articles/pcmusician_1006.htm http://www.soundonsound.com/sos/oct06/articles/pcmusician_1006.htm

I've never used winsound.Beep, but looking at the documentation, it seems pretty high level. 我从没使用过winsound.Beep,但是从文档上看,它似乎相当高级。 It's probably using a square wave and you hear the pop sound when the value is at 1 and then the signal stops. 可能是方波,当该值为1时您会听到爆裂声,然后信号停止。 The speaker probably jumps back to its rest position and results in the raindrop sound you are hearing. 扬声器可能会跳回其静止位置,并产生您听到的雨滴声。 You could, if you're really bothered, go into the code itself and edit it so that every time a sound is going be generated it is filtered through an amplitude envelope to get rid of these clicks, but this is way more time than it's worth. 如果您真的很烦,则可以进入代码本身并对其进行编辑,以便每次生成声音时,都会通过振幅包络对其进行过滤以消除这些咔嗒声,但这要比花费更多的时间。价值。 My advice is to change your method being used for generating your tones. 我的建议是更改用于生成声音的方法。

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

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