Tag: pcm

如何混合PCM音频源(Java)?

这就是我现在正在使用的内容: for (int i = 0, numSamples = soundBytes.length / 2; i < numSamples; i += 2) { // Get the samples. int sample1 = ((soundBytes[i] & 0xFF) << 8) | (soundBytes[i + 1] & 0xFF); // Automatically converts to unsigned int 0…65535 int sample2 = ((outputBytes[i] & 0xFF) << 8) | (outputBytes[i + 1] […]

Android PCM到Ulaw编码wav文件

我正在尝试将原始pcm数据编码为uLaw,以节省传输语音数据所需的带宽。 我在这个页面上遇到了一个名为UlawEncoderInputStream的类,但是没有文档! 🙁 构造函数接受输入流和max pcm值(无论是什么)。 /** * Create an InputStream which takes 16 bit pcm data and produces ulaw data. * @param in InputStream containing 16 bit pcm data. * @param max pcm value corresponding to maximum ulaw value. */ public UlawEncoderInputStream(InputStream in, int max) { 查看代码后,我怀疑我应该使用提供的函数计算这个“最大”值: maxAbsPcm 。 问题是,我真的不明白我的意思是什么! 我正在将原始pcm记录到SD卡上的文件中,因此我没有一个连续的内存驻留数据块传递给它。 /** * Compute the […]

如何使用FFT从PCM获取频率数据

我有一个传递给读者的音频数据: recorder.read(audioData,0,bufferSize); 实例化如下: AudioRecord recorder; short[] audioData; int bufferSize; int samplerate = 8000; //get the buffer size to use with this audio record bufferSize = AudioRecord.getMinBufferSize(samplerate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT)*3; //instantiate the AudioRecorder recorder = new AudioRecord(AudioSource.MIC,samplerate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT,bufferSize); recording = true; //variable to use start or stop recording audioData = new short [bufferSize]; //short array that […]

如何在java中播放pcm原始数据

我有一个短arrays的PCM样本。 玩这个的最好方法是什么? 格式为8000Hz,单声道,16位,大端。 (PCM样本在代码中生成,而不是通过某些文件读取) 谢谢

将16位pcm转换为8位

我有pcm音频存储在一个字节数组中。 每个样本16位。 我想让每个样本音频为8位。 谁能建议一个好的算法来做到这一点? 我没有提到比特率,因为我认为这对算法并不重要 – 对吗?

如何从wav文件中获取PCM数据?

我有一个.wav文件。 我想从该声音文件中获取PCM数据,以便我可以从声音中获取单个数据块并对其进行处理。 但我不知道该怎么做。 谁能告诉我怎么做? 到目前为止我做到了这一点: public class test { static int frameSample; static int timeofFrame; static int N; static int runTimes; static int bps; static int channels; static double times; static int bufSize; static int frameSize; static int frameRate; static long length; public static void main(String[] args) { try { AudioInputStream ais = AudioSystem.getAudioInputStream(new File(“music/audio.wav”)); […]