Console.Beep在行动 [英] Console.Beep in action

查看:101
本文介绍了Console.Beep在行动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道......我可以用这段代码听到创建的声音:

I just wonder ... I can hear a created sound with this code :

Console.Beep(32767, 5000);





那么,我怎么能听到它?我知道人类听不到超过20千赫的声音而且我也不是一个孩子(我的意思是我听到的不够年轻,听不到20千赫兹)!但似乎我听到超过32千赫​​!



那么,这段代码有什么不同吗?有什么不对?!



也许我是濒临灭绝的物种:D!



So , How can I hear it ?! I know the human can't hear sound more than 20 kilohertz and I am not a child too (I mean my hears is not young enough to hear 20 kilohertz) !!! but it seems that I hear more than 32 kilohertz !!!

So , Is this code different ?! What is wrong ?!

Maybe I am an endangered species :D !

推荐答案

可能是什么:谐波,有缺陷的硬件,你非常非常年轻(你可以听到的范围随着年龄的增长而变化)。



或者可能是因为在你的电脑上产生嘟嘟声的频率发生器在高频时不是很好。

所以试试一个实验。

这样做,每次降低频率千赫兹。你连续听到了吗?音调是否会持续变得更深?

如果确实如此,一直下来,那么是的,你是一个怪人!:笑:

如果它没有那么它可能是硬件。



如果它有帮助,我也会听到它,但它会随着频率下降而淡化直到我能听到它,听到它,然后当它下降到正常的人类范围时它再次响亮 - 所以它几乎肯定是一个频率生成问题。
Could be anything: harmonics, faulty hardware, you being very, very young (the range you can hear changes as you age).

Or it could be that the frequency generator that produces the beep in your PC is just not very good at high frequencies.
So try an experiment.
Do that, and reduce the frequency by a thousand Hz each time. Do you hear it continuously? Does the tone get "deeper" continuously?
If it does do, all the way down, then yes you're a freak!:laugh:
If it doesn't, then it's probably hardware.

If it helps, I hear it as well, but it "fades" as the frequency drops until I can;t hear it, then it gets louder again as it drops through the "normal human range" - so it's almost certainly a frequency generation problem.


我也能听到它,主观地,痛苦地高音。 (华友世纪!我又年轻了!)但我也可以在这里低频点击。听觉频率没有错;并且音乐音调听起来很逼真(如果它们不是太低,则离散化误差相当大)。但是语气很脏。



这还不能证明什么。但后来我用几百赫兹降低了你的音调,并且......高音的主观音调没有改变。这已经错了。此外,当我将音调降低2 / 3,3 / 4和1/2(完美第五完美第四 octave 时,由于人类听觉的明显物理特征,人类年度最清晰地感知和检测到的间隔是最谐波的,可听音......完全消失,尽管它应该变得更接近正常的人类听觉域。



可能你不应该太认真对待这一代。



但问题非常好,我很感激。< br $> b $ b

-SA
I can hear it, too, subjectively, painfully high pitch. (Hurray! I'm young again!) But I also can here low-frequency clicks. Nothing wrong is perceived for audible frequencies; and the musical tones sound realistic (if they are not too low, where discretization errors are considerable). But the tone is pretty dirty.

This does not yet proof anything. But then I lowered your tone by some hundreds of hertz, and… subjective tone of high pitch did not change. It's already wrong. Moreover, when I lowed the tone by 2/3, 3/4 and 1/2 (perfect fifth, perfect fourth and octave, the intervals most distinctly perceived and detected by human year as most harmonic, due to obvious physical characteristics of human hearing), the audible tone… completely disappeared despite the fact that it should become closer to the normal human-audible domain.

Probably, you should not take this generation too seriously.

But the question is very good, I appreciate it.

—SA


有2个命题可以考虑:



a)你可以听到20kHz以上的声音

b)扬声器没有在32kHz振动



要测试建议 a 你的设备完全不合适。为什么听觉实验室拥有他们拥有的设备和设施?因此,现在让我们排除这一点。



命题 b 似乎最有可能。音频放大器可以提供32kHz的电压,但即使在神秘高保真的世界中,一个能够在32kHz振动的高音扬声器也是非常罕见的。扬声器响应输入以其他频率振动,我的猜测是它的共振频率 - 可能是几kHz。



这个测试很有启发性: />


There are 2 propositions one can consider:

a) You CAN hear way above 20kHz
b) The speaker is NOT vibrating at 32kHz

To test proposition a your equipment is totally inadequate. Why do auditory labs have the equipment and facilities they have? So lets rule that out for the moment.

Proposition b seems most likely. The audio amplifier may supply a 32kHz voltage but even in the world of esoteric hifi a tweeter capable of vibrating at 32kHz is very rare. The speaker is vibrating at some other frequency in response to the input and my guess would be it's resonant frequency - probably a few kHz.

This test is illuminating:

for (int freq = 100; freq < 32767; freq += 300)
{
    Console.WriteLine(freq);
    Console.Beep(freq, 200);
}





频率的感知增长在上限之前很久就会停止。这是音频系统无法跟随输入的地方。



如果我们考虑这个例子:

https://msdn.microsoft.com/en-us/library/4fe3hdb1(v = vs.110 ).aspx [ ^ ]



并添加:





The perceived increase in frequency stops long before the upper limit. This is where the audio system stops being capable of following the input.

If we consider this example:
https://msdn.microsoft.com/en-us/library/4fe3hdb1(v=vs.110).aspx[^]

and add:

// Define the octave multiplier.
protected enum Octave
{
    same = 1,
    one = 2,
    two = 4,
    three = 8,
    four = 16,
    five = 32,
    six = 64,
}



和:




and:

// Play the notes in a song.
protected static void Play(Note[] tune, Octave octave = Octave.same)
{
    foreach (Note n in tune)
    {
        if (n.NoteTone == Tone.REST)
            Thread.Sleep((int)n.NoteDuration);
        else
            Console.Beep((int)n.NoteTone * (int)octave, (int)n.NoteDuration);
    }
}



然后我们可以这样做:




then we can do:

// Play the song
Play(Mary, Octave.two);



通过八度音符5音符开始听起来相同,这意味着我们达到了系统的极限以忠实地再现输入。


By octave 5 the notes are starting to sound the same which means we are reaching the limit of the system to faithfully reproduce the input.


这篇关于Console.Beep在行动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆