简体   繁体   English

Java读取/操作Wav文件

[英]Java Reading/Manipulating Wav File

So I can get an array of all the bytes of a wav file, I just want to know how I can decode the raw sound data to something I can use to tell when the singer is speaking/his beat (I don't know the proper musical terms, sorry) 所以我可以得到wav文件所有字节的数组,我只想知道如何将原始声音数据解码为可以用来告诉歌手何时说话/他的节拍的东西(我不知道正确的音乐用语,对不起)

If there is an API or tutorial out there that someone could link me to, that would be swell since I can't seem to find anything good. 如果那里有人可以将我链接到的API或教程,那会很不错,因为我似乎找不到任何好的东西。

In general, detecting "the instances when something beats" in a wave file is not as one may imagine at the first thought. 通常,在波形文件中检测“某些东西跳动的实例”并不是一开始就想到的。

A possible first step is to transform your .wav into a so-called "spectrogram." 可能的第一步是将.wav转换为所谓的“频谱图”。 I don't think Java has a dedicated API for this purpose, but googling "java spectrogram" would give you a number of third-party examples. 我认为Java没有为此目的使用专用的API,但是使用谷歌搜索“ java频谱图”将为您提供许多第三方示例。

I also found this question might be relevant. 我也发现这个问题可能是相关的。

PS I'm not a specialist in signal processing, so corrections are welcome. PS我不是信号处理专家,因此欢迎进行更正。

Will you know this beat in advance? 你会提前知道这个节奏吗? If so, you could cross correlate the two signals and the highest peak in this output would correspond to the time delay. 如果是这样,则可以使两个信号互相关 ,并且此输出中的最高峰值将与时间延迟相对应。

Other than that, depending on the sound before the beat starts, you could convert to frequency domain (via FFT ) and have a look at what frequencies are present and see whether there's a significant change when the beat begins. 除此之外,根据节拍开始之前的声音,您可以转换到频域(通过FFT ),查看出现了哪些频率,并查看节拍开始时是否有重大变化。

Some examples/extra detail would help. 一些示例/更多细节会有所帮助。

If you're trying to detect the tempo of said beat, please ignore everything most of what I've said. 如果你想检测所述节拍的节奏,请忽略我所说的 一切 最。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM