本文介绍了在java中将wav文件转换为字节数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目是阿塞拜疆语的语音识别".我必须编写一个将 wav 文件转换为字节数组的程序.

My project is 'Speech Recognition of Azeri speech'. I have to write a program that converts wav files to byte array.

如何将音频文件转换为字节[]?

How to convert audio file to byte[]?

推荐答案

基本上如第一个答案中的代码段所描述的那样,但不是 BufferedInputStream 使用 AudioSystem.getAudioInputStream(File) 获取InputStream.

Basically as described by the snippet in the first answer, but instead of the BufferedInputStream use AudioSystem.getAudioInputStream(File) to get the InputStream.

使用从 AudioSystem 获得的音频流将确保标头被剥离,并且输入文件解码为一个字节 [] 代表实际的声音帧/样本 - 然后可以使用用于FFT等

Using the audio stream as obtained from AudioSystem will ensure that the headers are stripped, and the input file decode to a byte[] that represents the actual sound frames/samples - which can then be used for FFT etc.

这篇关于在java中将wav文件转换为字节数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 00:39
查看更多