pcm

Playing Raw pcm audio data coming from NSStream

痴心易碎 提交于 2019-11-29 02:46:17
I am trying to play the pcm data from NSInputStream. Can anyone provide me the right approach or code to do so. I got the Audio in StreamHasData event with following code. uint8_t bytes[self.audioStreamReadMaxLength]; UInt32 length = [audioStream readData:bytes maxLength:self.audioStreamReadMaxLength]; Now how can i play bytes audio data in iphone? I worked on a similar problem, and I in the end solved it. Here is the basic of what I did. I am using a library for the sockets The below class is responsible for getting the audio and making it available to connected clients. #import <Foundation

Determine Number of Frames in a Core Audio AudioBuffer

前提是你 提交于 2019-11-29 02:24:09
I am trying to access the raw data for an audio file on the iPhone/iPad. I have the following code which is a basic start down the path I need. However I am stumped at what to do once I have an AudioBuffer. AVAssetReader *assetReader = [AVAssetReader assetReaderWithAsset:urlAsset error:nil]; AVAssetReaderTrackOutput *assetReaderOutput = [AVAssetReaderTrackOutput assetReaderTrackOutputWithTrack:[[urlAsset tracks] objectAtIndex:0] outputSettings:nil]; [assetReader addOutput:assetReaderOutput]; [assetReader startReading]; CMSampleBufferRef ref; NSArray *outputs = assetReader.outputs;

Playing PCM stream from Web Audio API on Node.js

别说谁变了你拦得住时间么 提交于 2019-11-29 00:28:43
问题 I'm streaming recorded PCM audio from a browser with web audio api. I'm streaming it with binaryJS (websocket connection) to a nodejs server and I'm trying to play that stream on the server using the speaker npm module. This is my client. The audio buffers are at first non-interleaved IEEE 32-bit linear PCM with a nominal range between -1 and +1. I take one of the two PCM channels to start off and stream it below. var client = new BinaryClient('ws://localhost:9000'); var Stream = client.send(

How to convert .pcm file to .wav or .mp3?

妖精的绣舞 提交于 2019-11-28 23:54:35
I am currently developing an Android Application that has audio recording and playing. I am new to dealing with audio and I'm having some trouble with encoding and formats. I am able to record and play the audio in my application, but when exporting I am not able to reproduce the audio. The only way I found was exporting my .pcm file and converting using Audacity. This is my code to record the audio is: private Thread recordingThread private AudioRecord mRecorder; private boolean isRecording = false; private void startRecording() { mRecorder = new AudioRecord(MediaRecorder.AudioSource.MIC,

语音文件 pcm 静默判断

和自甴很熟 提交于 2019-11-28 22:13:02
转载: http://www.voidcn.com/relative/p-fwdkigvh-bro.html pcm 文件存储的是 原始的声音波型二进制流,没有文件头。 (1)首先要确认 pcm文件的每个采样数据 采样位数,一般为8bit或16bit。 (2)然后确定是双声道还是单声道,双声道是两个声道的数据交互排列,需要单独提取出每个声道的数据。 (3)然后确定有没有符号位,如采样点位16bit有符号位的的范围为-32768~32767 (4)确定当前操作系统的内存方式是大端,还是小端存储。具体看http://blog.csdn.net/u013378306/article/details/78904238 (5)根据以上四条对pcm文件进行解析,转化为10进制文件 注意:对于1-3可以在windows使用cooledit 工具设置参数播放pcm文件来确定具体参数,也可以使用以下java代码进行测试: 本例子的语音为: 静默1秒,然后说 “你好”,然后静默两秒。pcm文件下载路径:http://download.csdn.net/download/u013378306/10175068 package test; import java.io.File; import java.io.FileInputStream; import java.io

pcm音频的格式类型

ぃ、小莉子 提交于 2019-11-28 19:29:50
【文章内容属于多方转载内容】 PCM Parameters PCM audio is coded using a combination of various parameters. Resolution/Sample Size This parameter specifies the amount of data used to represent each discrete amplitude sample. The most common values are 8 bits (1 byte), which gives a range of 256 amplitude steps, or 16 bits (2 bytes), which gives a range of 65536 amplitude steps. Other sizes, such as 12, 20, and 24 bits, are occasionally seen. Some king-sized formats even opt for 32 and 64 bits per sample. Byte Order When more than one byte is used to represent a PCM sample, the byte order (big endian vs.

Can ffmpeg convert audio to raw PCM? If so, how?

微笑、不失礼 提交于 2019-11-28 15:30:06
问题 I'm currently using ffmpeg to convert FLV/Speex to WAV/pcm_s16le , successfully. However, I now need the output format to be RAW, that is, PCM signed 16-bit little endian, without the WAV header. I tried the following: ffmpeg -y -i input.flv -vn -acodec pcm_s16le output.raw But ffmpeg responds with: Unable to find a suitable output format for 'output.raw' I also tried using output.pcm and output as output file names, with the same result. I also tried the -f flag to specify raw format, but

Convert 16 bit pcm to 8 bit

我们两清 提交于 2019-11-28 11:30:18
I have pcm audio stored in a byte array. It is 16 bits per sample. I want to make it 8 bit per sample audio. Can anyone suggest a good algorithm to do that? I haven't mentioned the bitrate because I think it isn't important for the algorithm - right? I can't see right now why it's not enough to just take the upper byte, i.e. discard the lower 8 bits of each sample. That of course assumes that the samples are linear; if they're not then maybe you need to do something to linearize them before dropping bits. short sixteenBit = 0xfeed; byte eightBit = sixteenBit >> 8; // eightBit is now 0xfe. As

How to get PCM data from a wav file?

时光毁灭记忆、已成空白 提交于 2019-11-28 09:32:57
I have a .wav file. I want to get the PCM data from that sound file, so that I can get the individual data chunks from the sound and process it. But I don't know how to do it. Can anyone tell me how to do it? I have done this so far: 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

How to get PCM data from microphone in C++ (os Windows)?

╄→尐↘猪︶ㄣ 提交于 2019-11-28 09:31:39
问题 I need to capture PCM data from microphone in C++. I'm a beginner. How to do it? 回答1: You can do this with the waveInOpen() and waveInStart() API functions. There's a sample project available here. 回答2: Check out The Synthesis Toolkit. They have a class called RtAudio that works on multiple platforms including Windows, OS X, and Linux. Beyond just giving you the PCM data, there are options for generating your own data, processing the data, and saving it to a standard file format. 回答3: It