Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想为整数生成声音,例如整数 1 到 10 的音调,然后将其发送到声卡。例如,1 500 Hz 的 440 Hz 音调到 3 的 2 600 Hz 等等……频率不是问题。问题是为许多整数生成音调,然后将这些音调保存到 .wave 文件中,然后播放该波形文件。
最简单的方法是设置频率 = 现有的音乐标准。
var a = Math.Pow(2.0, 1.0/12.0); var b = // Your Integer Here; var f = 440 * Math.Pow(a, b);
这将为您提供半音阶的频率。如果你想要一个主要的规模,你可以使用b = 0, 2, 4, 5, 7, 9, 11, or 12
b = 0, 2, 4, 5, 7, 9, 11, or 12
音符公式链接:http ://www.phy.mtu.edu/~suits/NoteFreqCalcs.html