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
9
votes
6 answers

Mixing 16 bit linear PCM streams and avoiding clipping/overflow

I've trying to mix together 2 16bit linear PCM audio streams and I can't seem to overcome the noise issues. I think they are coming from overflow when mixing samples together. I have following function ... short int mix_sample(short int sample1,…
Ragnar
  • 1,387
  • 4
  • 20
  • 29
9
votes
1 answer

how to play pcm raw data in java

I have PCM samples in a short array. What is the best way to play this out? The format is 8000Hz, Mono, 16 bit, big endian. (The PCM samples are generated in the code and not read through some file) Thanks
Geos
  • 1,471
  • 4
  • 14
  • 16
8
votes
1 answer

Adding 'silent frames' to a Node.js stream when no data is received

I am creating a Discord.js bot using Node.js that records the audio of users in a voice channel. It joins a channel and starts listening to each user separately. It records to a .pcm file (so only the raw data). Now, this works, but the nature of…
JasperJ
  • 81
  • 2
8
votes
4 answers

Extract iPod Library raw PCM samples and play with sound effects

I am trying to extract raw PCM samples from an MP3 in the iPod Library so that I can play the song and manipulate the pitch, tempo, and apply sound effects (such as filters). I have already gone down the route of AVPlayer and AVAudioPlayer which…
Dino
  • 566
  • 1
  • 7
  • 19
8
votes
1 answer

How to efficiently unpack float, int16, int32, etc. data from void* array in C++?

I’ve got an array of PCM data; it can be 16-bit, 24-bit packed, 32-bit, etc. It can be signed, or unsigned, and it can be 32 or 64-bit floating point. It is currently stored as a void** matrix, indexed first by channel, then by frame. The goal is to…
Griffin
  • 501
  • 6
  • 14
8
votes
3 answers

Extracting audio channel from Linear PCM

I would like to extract a channel audio from the an LPCM raw file ie extract left and right channel of a stereo LPCM file. The LPCM is 16 bit depth,interleaved, 2 channels,litle endian. From what I gather the order of byte is…
Samuel
  • 238
  • 4
  • 12
8
votes
1 answer

Use (Python) Gstreamer to decode audio (to PCM data)

I'm writing an application that uses the Python Gstreamer bindings to play audio, but I'm now trying to also just decode audio -- that is, I'd like to read data using a decodebin and receive a raw PCM buffer. Specifically, I want to read chunks of…
adrian
  • 1,447
  • 15
  • 24
8
votes
2 answers

I2S and PCM format

Can someone explain what is the difference between I2S interface and PCM interface. Does I2S interface only supports i2s format audio data and not PCM format audio data ?
DJNEXUS
  • 81
  • 1
  • 1
  • 2
8
votes
3 answers

Downsample PCM audio from 44100 to 8000

I've been working on a audio-recognize demo for some time, and the api needs me to pass an .wav file with sample rate of 8000 or 16000, so I have to downsample it. I have tried 2 algorithms as following. Though none of them solves the problem as I…
tristan_jia
  • 93
  • 1
  • 1
  • 9
8
votes
1 answer

Difficulty porting raw PCM output code from Java to Android AudioTrack API

I'm attempting to port an application that plays chiptunes (NSF, SPC, etc) music files from Java SE to Android. The Android API seems to lack the javax multimedia classes that this application uses to output raw PCM audio. The closest analog I've…
alexanderfb
  • 153
  • 2
  • 6
8
votes
2 answers

How to convert headerless ima-adpcm raw file to wav using sox

I am trying to convert a raw file (header-less) to wav It is in ADPCM 16 rate 8000 I have tried three console commands sox -e ima-adpcm -r 8000 input.raw output.wav sox -e ima-adpcm -r 8000 -b 16 input.raw output.wav These trigger the same…
QGA
  • 3,114
  • 7
  • 39
  • 62
8
votes
2 answers

iPhone - how to measure amplitude of a PCM coded signal

here's my problem at hand: I need to analyze audio data in realtime to find out the amplitude of the signal I can't use the AudioQueue metering functionality because it has too much delay for detecting peaks I have studied the aurioTouch…
8
votes
1 answer

Lightweight open source software synth library on pure C (possibly C++). PCM.?

Are there any portable open source libraries that support sample-based synthesis and encapsulate producing and mixing simple PCMs? I really need something minimalistic and decoupled from operating system audio output mechanisms.
Boris Treukhov
  • 17,493
  • 9
  • 70
  • 91
8
votes
1 answer

PCM Web Audio Api Javascript - I am getting distorted sounds

I am receiving an interleaved 16 bit PCM samples over the wire. Each sample is signed I read it as Int16bit array, lets call this ALL_DATA. So each of the array entries is a a 16 bit sample. Because it is interleaved I extract it into 2 channels…
Evren Bingøl
  • 1,306
  • 1
  • 20
  • 32
8
votes
2 answers

AudioTrack - short array to byte array distortion using jlayer(java mp3 decoder)

I'm using jLayer to decode MP3 data, with this call: SampleBuffer output = (SampleBuffer) decoder.decodeFrame(frameHeader, bitstream); This call which returns the decoded data, returns an array of short[]. output.getBuffer(); When I call…
StackOverflowed
  • 5,854
  • 9
  • 55
  • 119
1 2
3
51 52