如何启动一个音调并让它无限期地运行直到我明确停止它?

发布于 2024-12-27 16:18:16 字数 295 浏览 8 评论 0原文

我正在尝试为我的孩子编写一个钢琴应用程序。我正在做的是在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

℉絮湮 2025-01-03 16:18:16

即使是现在最基本的板载声卡也支持 MIDI(我真的这么认为)。查看此 C# MIDI 工具包

Even the most basic onboard soundcard nowadays supports MIDI (I would really think). Check out this C# MIDI Toolkit.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文