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
0
votes
2 answers

How do you convert a stream of PCM audio samples to volume?

I can get an array of unsigned 32 bit ints from a WAV file. 65509 65402 65518 65520 65521 ... How can I convert these ints (or the original bytes) into a volume level for the stream?
Xeoncross
  • 55,620
  • 80
  • 262
  • 364
0
votes
1 answer

mpg123 decode mp3 to pcm in C++

I want to decode a mp3 file to pcm: #include #include #include using namespace std; int main() { mpg123_handle *mh; unsigned char *buffer; size_t buffer_size; size_t done; int err; int channels, encoding; long…
abbas hoseini
  • 453
  • 1
  • 4
  • 11
0
votes
1 answer

Detecting specific frequencies/tones in raw audio (PCM)

I have recorded audio spanning a few seconds and containing two similar tones generated with the same frequency. They are a couple of seconds apart. What I would like to do is detect the end of the first tone and the beginning of the second tone in…
John Smith
  • 307
  • 3
  • 14
0
votes
1 answer

How to play streaming PCM data from server like Android AudioTrack class?

I try to develop iOS PCM streaming app. Before it, I have developed Android app with AudioTrack class, audio playing is very well in long time. In iOS, I use AudioQueue APIs. AudioQueue play streamed PCM data very well for a few seconds, but soon…
user6081283
  • 127
  • 1
  • 8
0
votes
2 answers

How can I decode OGG vorbis data from a ByteBuffer?

The libraries I founded so far only have methods to decode from a file or InputStream. I have a ByteBuffer with OGG vorbis data and I need it decoded to PCM without having to write it to a file first.
Anon
  • 927
  • 1
  • 9
  • 6
0
votes
0 answers

Choppy audio playback with AudioTrack.write

I am using AudioTrack library to play pcm samples that are being streamed via wifi. The problem is the playback is very choppy while playing on Lenovo K900 (4.1.2), whereas it is seamless while playing on OnePlusOne (Marshmallow 6.0.1 cyanogen)…
Debojit Kundu
  • 111
  • 1
  • 13
0
votes
3 answers

ffmpeg audio conversion: encoder pcm_u8 working pcm_s8 not

I need to convert audio inside video to 8 Bit signed PCM. I try it like this: C:\Users\E\Desktop\ffmpeg-20160731-04da20e-win32-static\bin>ffmpeg -i minions.mp4 -vcodec mjpeg -s 800x480 -acodec pcm_s8 -ac 1 out.avi output: ffmpeg version…
patszn
  • 11
  • 1
  • 3
0
votes
1 answer

Apply audio filters in parallel and merge the results buffers

I've implemented an 13 band EQ using EQ10Q filters. Doing some measurements with the smaartV7 software I realized that my bands were overlapping each other giving an extra undesired gain. I think this is because I was applying every filter over the…
DrCachetes
  • 954
  • 1
  • 9
  • 30
0
votes
2 answers

PCMU RTP packet payload has extra length of data

I monitor a WebRTC session, found extra unknown(I don't know) data, now I am composing the same RTP audio session, I need to know it why. Send PCMU (8bit, mono, 8000Hz) frame to WebRTC browser client, each frame is of 20 ms, so the payload size =…
Wen
  • 11
  • 4
0
votes
0 answers

Why two audio files exported the same way have different checksums?

I originally asked this question on Signal Processing but it was off topic. So, here it goes! I tried to export a recording from Audacity twice, each time with the same parameters and tags. The resulting files had different checksums. So I opened up…
Getkey
  • 176
  • 1
  • 9
0
votes
1 answer

How can I visualize PCM data

I have a PCM datafile that I know is valid. I can play it, edit it into pieces, etc. and it will always play, as well as the individual pieces. But when I try to translate it into shorts from bytes bytes[i] | (bytes[i+1] << 8) The file is 16…
Daniel Kaplan
  • 701
  • 7
  • 19
0
votes
1 answer

Mix PCM data from two decoded FFmpeg AVFrame* objects

I'm currently using the FFMpeg AutoGen project (in C# of course) to decode frames from an audio file and add them to a new stream that is being written to a video. This all works correctly, but I was wondering how one would go about mixing two…
William Troup
  • 12,739
  • 21
  • 70
  • 98
0
votes
0 answers

Is a string less bytes than a number?

I am creating a project for streaming microphone audio PCM data to play on another browser and I am currently done the streaming part and am looking to some sort of optimization as I am sending a buffer that is 8192 long. I saw in some very few…
ZeroByter
  • 374
  • 2
  • 8
  • 22
0
votes
1 answer

To much noise when I do sine wave generating on Android with Java

I researched Sine wave generating on Android for a long time and I got some sample code online. However, I still got in confusion when I code by myself. I use the code like following double[] buf = new double[(int) sampleRate]; byte[] buffer = new…
Ori.Lin
  • 421
  • 1
  • 5
  • 13
0
votes
0 answers

Convert audio data to audio buffer and play with AudioQueue

For my special scenario, i want to read an audio file< MP3, AAC...> by buffer, like 512Kb for each buffer, and convert this buffer to PCM data and pass to AudioQueue's play callback. Just like when recording, we have callback like this: static…
The Bird
  • 397
  • 2
  • 8
  • 19