本文介绍了改变音频采样频率的字节的阵列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 首先,我得到了一个项目,以改变WAVE文件的频率,我需要在Java中这样做。First of all, I got a project to change the frequency of a WAVE file and I need to do so in Java.我已经使用AudioSystem在Java来获得音频数据的字节(不包括文件头)。现在我得到的数据的字节数组,我想把它从时域到频域和操作频率改变后,我想改回时域。这里的code:I have used AudioSystem in java to get the bytes of the audio data (excluding the file header). Now I get an array of bytes of the data, I want to change it from the time domain into the frequency domain and after manipulating the frequency, I want to change it back into the time domain. Here's the code:public byte[] getWAVByte(){ ByteArrayOutputStream out = new ByteArrayOutputStream(); try{ File f = new File("audio.wav"); AudioInputStream in = AudioSystem.getAudioInputStream(f); int read; byte[] buff = new byte[(int)f.length()]; while ((read = in.read(buff)) > 0) { out.write(buff, 0, read); } out.flush(); byte[] audioBytes = out.toByteArray(); return audioBytes; }catch(Exception e){ e.printStackTrace(); }}现在,我在audioBytes字节数组,我想把它变成在频域的字节另一个数组。我已阅读,你可以用傅立​​叶变换做到这一点,但我的老师说,它真的复杂,这不是我的项目的范围之内。那么,有没有任何其他的方式做到这一点?或者是有任何Java库,可以帮助我得到的字节数组中的频域?Now that I have an array of bytes in audioBytes, I want to change it into another array of bytes in frequency domain. I have read that you can do it with Fourier Transform, but my teacher said that it's really complex and it's not within my project's scope. So is there any other way to do this? Or is there any java library that can help me get the array of bytes in frequency domain?推荐答案的斯蒂芬M. Bernsee 怎么写的频域做到这一点,你可以找到你的源$ C ​​$ C在C中下载,一个人做了一个端口到Java,以你的运气!Stephan M. Bernsee wrote how do it in Frequency Domain, and you can find your source code to download in C, one guy did a port to java to your luck! http://svn.assembla.com/svn/ mm1ws08 / Abgabe2 / src目录/效果/ PitchShift.java是啊,如果你多或您的字节数组除以一个值,你只是增加或减少的幅度信号,改变在时域的频率,你需要找到声门位置点击,在每声门将一个中心窗口位置,现在每个窗口移到新的时间位置,在此步骤中可以添加或排除一些窗口,这改变信号的频率,并在最后进行重叠添加在所有窗口声门,这种方法被称为 PSOLAYeah if you multiple or divide one value by your array of bytes you are just increase or decrease the amplitude signal, to change the Frequency in Time Domain, do you need find the glottal position click, apply one centred window over every glottal position, and now move each window to a new time position, in this step you can add or exclude some window, this change the frequency of the signal, and at the end make a Overlap Add over all windowed glottis, this method is called PSOLA 这篇关于改变音频采样频率的字节的阵列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 01:02