pcm

Java - Adjust playback speed of a WAV file

拈花ヽ惹草 提交于 2019-12-23 05:15:25
问题 I'm likely dense but I cannot seem to find a solution to my issue ( NOTE: I CAN find lots of people reporting this issue, seems like it happened as a result of newer Java (possible 1.5?). Perhaps SAMPLE_RATE is no longer supported? I am unable to find any solution) . I'm trying to adjust the SAMPLE_RATE to speed up/slow down song. I can successfully play a .wav file without issue, so I looked into FloatControl which worked for adjusting volume: public void adjustVolume(String audioType, float

How to play two sine wave on left and right channel separately with 16-bit format?

北慕城南 提交于 2019-12-23 04:23:15
问题 I need to generate 2 sine wave tones with different frequency and play them separately into right and left channel in stereo mode on Android. This is my code: int sample; double sampleRate; double duration; double time; double f1; double f2; double amplitude1; double amplitude2; double sineWave1; double sineWave2; float[] buffer1; float[] buffer2; byte[] byteBuffer1; byte[] byteBuffer2; byte[] byteBufferFinal; int bufferIndex; short x; short y; AudioTrack audioTrack; @Override public void

PCM Data Pitch Change in C#

为君一笑 提交于 2019-12-22 12:38:27
问题 I have a program that downloads PCM data from a Web Server, which it uses later to play through a standard PCM player. I want to be able to allow users to change the pitch of the PCM data while its being played. Does anyone know how to do this? 回答1: I don't know any digital signal processing library for C#, but this seems to be a complete source sample for pitch shifting in .net.: http://sites.google.com/site/mikescoderama/pitch-shifting 回答2: The simplest solution is to play back the sound at

Convert audio linear pcm to mp3 ( using LAME ) with the help of AudioQueueServices example in iOS

徘徊边缘 提交于 2019-12-22 11:06:00
问题 I am new in ios developement.I am encoding a LinearPCM to MP3 in iOS.I'm trying to encode the raw PCM data from microphone to MP3 using AudioToolbox framework and Lame.And although everything seems to run fine if i record .caf format . i am getting only noise and distortions present in the encoded stream. I'm not sure that I setup AudioQueue correctly and also that I process the encoded buffer in the right wat... My code to setup audio recording: sample project https://github.com/vecter/Audio

Clicks while using LAME to encode from PCM to MP3 in iOS

风流意气都作罢 提交于 2019-12-22 10:06:40
问题 I am not the first to have this type of issue, however, I have no been able to solve it. I am encoding a LinearPCM to MP3 in iOS. It is working though I am experiencing clicks between each buffer. memset(&mEncodedBuffer, 0, sizeof(mEncodedBuffer)); int encodedBytes = lame_encode_buffer(gfp, (short*)inBuffer->mAudioData, NULL, inNumberPacketDescriptions, mEncodedBuffer, MP3_BUFFER_SIZE); NSData* data = [NSData dataWithBytes:mEncodedBuffer length:encodedBytes]; Then, I do the following with the

PCM音量控制

≡放荡痞女 提交于 2019-12-22 02:23:37
http://blog.jianchihu.net/pcm-volume-control.html 一.声音的相关概念 声音是介质振动在听觉系统中产生的反应。声音总可以被分解为不同频率不同强度正弦波的叠加(傅里叶变换)。 声音有两个基本的物理属性: 频率 与 振幅 。声音的振幅就是音量,频率的高低就是指音调,频率用赫兹(Hz)作单位。人耳只能听到20Hz到20khz范围的声音。 模拟音频 (Analogous Audio),用连续的电流或电压表示的音频信号,在时间和振幅上是连续。在过去记录声音记录的都是模拟音频,比如机械录音(以留声机、机械唱片为代表)、光学录音(以电影胶片为代表)、磁性录音(以磁带录音为代表)等模拟录音方式。 数字音频 (Digital Audio),通过采样和量化技术获得的离散性(数字化)音频数据。计算机内部处理的是二进制数据,处理的都是数字音频,所以需要将模拟音频通过采样、量化转换成有限个数字表示的离散序列(即实现音频数字化)。 采样频率 (Sampling Rate),单位时间内采集的样本数,是采样周期的倒数,指两个采样之间的时间间隔。采样频率必须至少是信号中最大频率分量频率的两倍,否则就不能从信号采样中恢复原始信号,这其实就是著名的香农采样定理。CD音质采样率为 44.1 kHz,其他常用采样率:22.05KHz,11.025KHz

Connecting AVAudioMixerNode to AVAudioEngine

谁都会走 提交于 2019-12-21 20:59:08
问题 I use AVAudioMixerNode to change audio format. this entry helped me a lot. Below code gives me data i want. But i hear my own voice on phone's speaker. How can i prevent it? func startAudioEngine() { engine = AVAudioEngine() guard let engine = engine, let input = engine.inputNode else { // @TODO: error out return } let downMixer = AVAudioMixerNode() //I think you the engine's I/O nodes are already attached to itself by default, so we attach only the downMixer here: engine.attach(downMixer) /

How to mix PCM audio sources (Java)?

别来无恙 提交于 2019-12-21 19:25:36
问题 Here's what I'm working with right now: 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] & 0xFF); // Automatically converts to unsigned int 0...65535 // Normalize for simplicity. float normalizedSample1 = sample1 / 65535.0f; float normalizedSample2 =

Android PCM to Ulaw encoding wav file

走远了吗. 提交于 2019-12-21 16:57:11
问题 I'm trying to encode raw pcm data as uLaw to save on the bandwidth required to transmit speech data. I have come across a class called UlawEncoderInputStream on This page but there is no documentation! :( The constructor takes an input stream and a max pcm value (whatever that is). /** * 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

Deinterleaving PCM (*.wav) stereo audio data

大憨熊 提交于 2019-12-21 12:41:55
问题 I understand that PCM data is stored as [left][right][left][right]... . Am trying to convert a stereo PCM to mono Vorbis (*.ogg) which I understand is achievable by halving the left and the right channels ((left+right)*0.5). I have actually achieved this by amending the encoder example in the libvorbis sdk like this, #define READ 1024 signed char readbuffer[READ*4]; and the PCM data is read thus fread(readbuffer, 1, READ*4, stdin) I then halved the two channels, buffer[0][i] = ((((readbuffer