Questions tagged [pcm]

Use this tag for questions about the Pulse-Code Modulation representation of sampled signals.

Pulse-Code Modulation (PCM) is a method used to digitally represent sampled analog signals. It is the standard form for digital audio in computers and various Blu-ray, DVD and Compact Disc formats, as well as other uses such as digital telephone systems. A PCM stream is a digital representation of an analog signal, in which the magnitude of the analog signal is sampled regularly at uniform intervals, with each sample being quantized to the nearest value within a range of digital steps. PCM streams have two basic properties that determine their fidelity to the original analog signal: the sampling rate, which is the number of times per second that samples are taken; and the bit depth, which determines the number of possible digital values that each sample can take.

Pulse-code modulation is an uncompressed audio encoding method. PCM is used in the .WAV, and .PCM file formats, and for encoding audio CDs, among many other uses. Digital signal processing algorithms like filters or FFT interact with the data when its in PCM format. When compressed audio format conversions are made, say from aac to flac, the data is converted from the source codec into PCM and then into the target codec. PCM can be considered the fundamental representation of digital time series data (EG. audio, financial ticker prices).

An alternative to PCM, with its sample rate and bit depth measurements, is the notion of storing the curve as a series of one bit samples. Instead of the ADC generating a sample of the absolute location of the height of the input analog curve when using the PCM approach, with this alternative one bit sample approach the ADC generates the relative position of the input analog curve. This one bit approach is memory efficient when performing very high sample rates.

780 questions
8
votes
2 answers

iOS: Playing PCM buffers from a stream

I'm receiving a series of UDP packets from a socket containing encoded PCM buffers. After decoding them, I'm left with an int16 * audio buffer, which I'd like to immediately play back. The intended logic goes something like this: init(){ …
Sergio Morales
  • 2,600
  • 6
  • 32
  • 40
7
votes
2 answers

How to extract frequency out of WAV sample data?

I'm developing an application in c to read simple PCM WAV files. My question is, how should I interpret the samples from the data chunk, so that I can extract the sample's frequency? Given a WAV example, how can the original data represent…
ikyr9999
  • 115
  • 1
  • 1
  • 6
7
votes
3 answers

How can I get frequency data from PCM using FFT

I have an array of audio data I am passing to a reader: recorder.read(audioData,0,bufferSize); The instantiation is as follows: AudioRecord recorder; short[] audioData; int bufferSize; int samplerate = 8000; //get the buffer size to use with…
Ben Taliadoros
  • 7,003
  • 15
  • 60
  • 97
7
votes
3 answers

Android AudioTrack playing .wav file, getting only white noise

When I play a file with the following code: private void PlayAudioFileViaAudioTrack(int ResId) throws IOException { int intSize = android.media.AudioTrack.getMinBufferSize(11025, AudioFormat.CHANNEL_CONFIGURATION_MONO,…
usealbarazer
  • 707
  • 3
  • 10
  • 27
7
votes
1 answer

Determine Number of Frames in a Core Audio AudioBuffer

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 =…
joshwbrick
  • 5,882
  • 9
  • 48
  • 72
7
votes
4 answers

What does interleaved stereo PCM linear Int16 big endian audio look like?

I know that there are a lot of resources online explaining how to deinterleave PCM data. In the course of my current project I have looked at most of them...but I have no background in audio processing and I have had a very hard time finding a…
William Rosenbloom
  • 2,506
  • 1
  • 14
  • 37
7
votes
5 answers

Silverlight 4 - encoding PCM data from the microphone

I've written a basic SL4 application to capture audio data from the microphone using CaptureSource. The trouble is, it's raw PCM output - which means huge and uncompressed. Given that I need this application to run purely within a SL4 environment,…
Richard
  • 1,252
  • 12
  • 23
7
votes
6 answers

Interpreting WAV Data

I'm trying to write a program to display PCM data. I've been very frustrated trying to find a library with the right level of abstraction, but I've found the python wave library and have been using that. However, I'm not sure how to interpret the…
SapphireSun
  • 9,170
  • 11
  • 46
  • 59
7
votes
1 answer

Decoding audio files and re-encoding to desired PCM format: 44,100 kHz, 2 Channels, 16 Bit

I want to decode audio files to raw PCM data to stream it to a playback device in the local network. I use the new MediaExtractor and MediaCodec classes, introduced with API level 16, for that. The device requires the PCM data to be in 44,100 kHz,…
pocmo
  • 660
  • 6
  • 24
7
votes
1 answer

iOS AudioUnit settings to save mic input to raw PCM file

I'm currently working on a VOIP project for iOS. I use AudioUnits to get data from the mic and play sounds. My main app is written in C# (Xamarin) and uses a C++ library for faster audio and codec processing. To test the input/output result I'm…
Boardwish
  • 495
  • 3
  • 16
6
votes
2 answers

Android PCM to Ulaw encoding wav file

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…
Chris Birch
  • 2,041
  • 2
  • 19
  • 22
6
votes
2 answers

Capturing audio data and save to raw PCM file in AudioFlinger

After some research, I find out this is possible to capture the audio data in libaudioflinger of Android. I think the audio data is being written to HAL in here: ssize_t framesWritten = mNormalSink->write((char *)mSinkBuffer + offset, count); Full…
Banana droid
  • 690
  • 1
  • 9
  • 27
6
votes
4 answers

Convert 16 bit pcm to 8 bit

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 -…
gop
  • 2,150
  • 5
  • 26
  • 54
6
votes
1 answer

Discord Save User Voice with VoiceReceiver

When I'm talking on a voice channel the bot says 'I'm listening to xxx', But when I check the /recordings folder there is a .pcm file there but its length is 0 so basically saving an empty .pcm file. Here is the code: const Discord =…
6
votes
1 answer

Remove high frequency sound from streaming audio node js

I have a small app that accepts incoming audio stream from the internet and I'm trying to find the frequency of a tone or continuous beep. At the time of the tone / beep it is the only thing that would be playing. The rest of the audio is either…
Bill
  • 5,478
  • 17
  • 62
  • 95