我想编写一个语音压力分析工具。我正在打开音频流进行阅读:
TargetDataLine line;
AudioFormat format = new AudioFormat((float) 44100, 16, 1, true, false);
DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);
line = (TargetDataLine) AudioSystem.getLine(info);
line.open(format);
// Begin audio capture.
line.start();
然后循环:
// Read the next chunk of data from the TargetDataLine.
numBytesRead = line.read(externalData, 0, externalData.length);
我得到一个包含字节的数组,因为 externalData 定义如下:
public static byte[] externalData = new byte[1024];
我想知道的是如何解释这些数据?我尝试按字节值绘制它,但我猜这是错误的。
X轴是时间,Y轴是字节值。
PS:在哪里可以找到有关 McQuiston-Ford 算法的更多信息?
最佳答案
您需要将字节转换为幅度并绘制它们。有关如何打点的问题,请参阅此问题:Obtain wave pattern of a audio file in Java
至于算法,维基百科说它是伪科学,我怀疑公共(public)领域不会有太多关于它的内容。
关于java - 如何解释音频字节?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13210894/