如何启动一个音调并让它无限期地运行直到我明确停止它?
我正在尝试为我的孩子编写一个钢琴应用程序。我正在做的是在 WinForm 中使用 KeyDown 和 KeyUp 事件。这个想法是在 KeyDown 事件中开始通过扬声器发出频率,然后在 Keyup 事件中停止它。就像钢琴一样:)
然而,这是我第一次涉足音频或视频领域。那么,有没有办法做到呢?我有更好的方法来完成我的建议。请注意,我无法访问 midi 或 wav 文件或类似的文件。因此我无法开始使用允许我执行此操作的示例。另请注意,我计划不仅仅选择钢琴频率。
再说一遍,这只是为了让孩子玩得开心(他才 15 个月大:)) 任何帮助表示赞赏。
I am trying to write a Piano application for my kid. What I am doing is using KeyDown and KeyUp Events inside a WinForm. The idea is to start emiting a frequency through the speaker in KeyDown event and then stop it in Keyup event. Just like in a piano :)
However, this is my first dabling in anything with Audio or Video. So, Is there a way to do it? Iz there a better way to do what I am suggesting. Note that I don't have access to midi or wav files or anything similar. Hence I can't start using samples that allow me to do this. Also note that I plan to go for more than just Piano frequencies.
Again, this is just for a kid to have fun (who is just 15 months old :))
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
即使是现在最基本的板载声卡也支持 MIDI(我真的这么认为)。查看此 C# MIDI 工具包。
Even the most basic onboard soundcard nowadays supports MIDI (I would really think). Check out this C# MIDI Toolkit.