English 中文(简体)
在爪哇,有办法合成特定频率的音调吗?
原标题:In Java, is there a way to synthesize a tone of a specific frequency?

org/wiki/Binaural_beats" rel="noreferrer" >binaural beats , 并试图构建一个 Java 应用程序,

在一个完美的世界里,我想给爪哇两个整数输入,440和410, 让爪哇弹回一个440赫兹的音调和一个410赫兹的音调。

鉴于我在javax.sound./code>类中看到的情况, Java似乎只支持相当于钢琴音符的音符.A4@440Hz,然后是A-Sharp-4@466.164Hz,另一个方向是G-Sharp-4@415.305Hz。虽然“相邻”一般在制作双声波节的范围以内,但我想以我的音调频率获得更多的控制。

由于简单的音频合成只不过是频率、强度和时间的长度,在我看来,<它们>会出现 ,在 javax.sound./code> 类的某个地方,有某种查处,我告诉爪哇玩“A4”游戏时,就会发现440Hz。问题在于是否有办法黑进该表说“A4.1”相当于449Hz。

我玩弄了 javax.sound.midi , 尚未探索 javax.sound. sampleed ;似乎我需要试探我的音调,以便使用 sampleed 类;我更愿意合成。如果我弄错了,请给我右键。

我所看到的第三方界面大多是专门针对音乐制作和操控的,因此,他们处理微调的能力有限。 有人有经验或建议解决问题吗?

最佳回答

您可以使用 javax. sound. sampled.\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\可以创建样本并发送到声音卡; 基本上创建一个软件振荡器。

这需要一些知识,

当我创建这个网站时,我正在玩这些分类:http://bobusumisu.net/suggest/bobusynth-alpha1/

以下是我开始的教程:http://www.drdobbs.com/jvm/2300500178

问题回答

这只是为了补充已经提供和接受的答案(我给出了一个加1)。

您可以使用波子来替代在半样本/半合成的飞行类中运行三角函数。 我也可以使用一个正弦波表, 上面有6个独立的光标指向它, 用于调频合成, 并以这种方式复制了几个 Yamaha DX7 补丁 。 但这一切都是通过 javax. sound. samped. samped 完成的。 一旦建立软合成, 您可能想要用底栖图书馆类来控制它 。

以单正弦波的浮点数来显示 1K 阵列。

If you "play" the wave table by incrementing and looping through it and extracting each array member in turn (to write to the sound card via a SourceDataLine), you will get a pitch directly related to your sample rate. For 44100 samples per second, the 1024-member array will cycle 44100/1024 = 43.066... times in to fill that "second" with data (a very low pitch--roughly 43 Hz). If you skip every second table member, the pitch is twice that, etc. To get the pitch 440, one needs to find the correct "increment" to use to step through the wave table array, which can be found: incr = (size of waveTable * desired pitch) / sample rate

For example (1024 * 440 ) / 44100 gives an increment of: 10.21678... Thus, if the first value from the waveTable is at array location 0, the second value to be used would be in between locations 10 and 11. To get a value that lies in between two array locations, use linear interpolation.

我使用这个方法, 使用 Javax. sound. smound. samped library, 用于此链接中的“ spenmin ” 。 显示了一个键盘, 但是您可以在鼠标移动到键盘上时很容易听到/ 看见微子控制 。

http://www.hexara.com/VSL/JInemin.htm" rel=“no follow'>http://www.hexara.com/VSL/JInemin.htm

在上面,鼠标位置(通过鼠标移动听力器)被用于通过此函数计算想要的音轨 :

return Math.pow(2, ((mouseX + tuningLoc) / (octaveWidth)));

此处的八维值是覆盖八维值的像素数。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...