![](/img/trans.png)
[英]How can I record the sound that a javasound application is currently playing?
[英]How can I read info from .wave file using JavaSound (Java, Java Sound)
嗨,我需要从.wave文件读取SampleRate,SignalFrequency和Amplitude。 如何使用JavaSound做到这一点?
您可以通过获取AudioFormat
对象的句柄来获得采样率:
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(new File("test.wav"));
AudioFormat audioFormat = audioInputStream.getFormat();
一旦有了,就可以按以下方式获得采样率:
float sampleRate = audioFormat.getSampleRate();
至于振幅,基本上就是原始的.wav文件数据,您可以通过调用任何read()
方法直接从audioInputStream
访问该数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.