简体   繁体   English

无法获得 winsound.Beep 工作

[英]Can't get winsound.Beep to work

I am trying to make some Beep noises with the winsound.Beep command.我正在尝试使用winsound.Beep命令发出一些Beep噪音。 However when I am using winsound.Beep(500, 500) I do not hear anything.但是,当我使用winsound.Beep(500, 500)我什么也没听到。 With winsound.MessageBeep and winsound.PlaySound however, I DO get to play sounds.但是,使用winsound.MessageBeepwinsound.PlaySound ,我winsound.PlaySound可以播放声音。 Any ideas what I should do?任何想法我应该做什么?

What I am trying to do: I want to write a little practicing program for training intervals: the computer sounds a first tone, then a second tone and you will have to guess what the tone interval is.我想要做的是:我想为训练间隔编写一个小练习程序:计算机发出第一个音调,然后发出第二个音调,您将不得不猜测音调间隔是什么。 For this I need pitched tones, tones for which I can set the frequency.为此,我需要音调,我可以设置频率的音调。 I want to keep it as simple as possible, any pitched sound will do.我想让它尽可能简单,任何高音都可以。 I do not want to have to collect a set of .wav files or whatever.我不想收集一组 .wav 文件或其他任何东西。 I want to make use of a tone generator which I think is available on most soundcards.我想使用我认为在大多数声卡上都可以使用的音调发生器。 winsound.Beep seems like something that can do this trick, but any other suggestions are welcome. winsound.Beep 似乎可以做到这一点,但欢迎任何其他建议。

I had the exact same problem.我有同样的问题。 winsound.Beep used to work just fine and then it suddenly stopped working (or that's what I thought). winsound.Beep 过去工作得很好,然后突然停止工作(或者我就是这么想的)。 The problem was that someone (or some update) had turned off the System sounds, which prevented windows from playing the Beep sound, either manually or through my program.问题是有人(或某些更新)关闭了系统声音,这阻止了 Windows 手动或通过我的程序播放 Beep 声音。 Try right clicking on the Speaker symbol, Open volume mixer and check whether System sounds is off or minimum volume.尝试右键单击扬声器符号,打开音量混合器并检查系统声音是否关闭或最小音量。

I hope that helps!我希望这有帮助!

Are you sure that your computer has a beep?你确定你的电脑有蜂鸣声吗? A lot of recent computer remove the beep because it was annoying and most computer today have soundcard to play wav sound instead (the other sound that you are able to play).许多最近的计算机删除了哔哔声,因为它很烦人,而且今天的大多数计算机都使用声卡来播放 wav 声音(您可以播放的其他声音)。

You can also check to validate if it's activated on this page您还可以检查以验证它是否在此页面上激活

IMO, I think that using the beep for other things than debugging is not a good idea. IMO,我认为将哔声用于除调试之外的其他事情并不是一个好主意。

EDIT编辑

Mayby you can try this code to create a sound using a base wav with synth algorythm也许您可以尝试使用此代码使用带有合成算法的基本 wav 创建声音

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

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