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.

750 questions
72
votes
2 answers

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

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…
David van Geest
  • 1,769
  • 1
  • 18
  • 18
56
votes
2 answers

Getting PCM data of HLS from AVPlayer

This question seems to be asked few times over last few years but none has answer for that. I am trying to process PCM data from HLS and I have to use AVPlayer. this post taps the local…
Mord Fustang
  • 1,465
  • 4
  • 38
  • 69
44
votes
4 answers

Can ffmpeg convert audio from raw PCM to WAV?

I can convert wav file to pcm ffmpeg -i file.wav -f s16le -acodec pcm_s16le file.pcm How can I revert this operation?
xXx_CodeMonkey_xXx
  • 722
  • 1
  • 6
  • 14
37
votes
4 answers

Writing PCM recorded data into a .wav file (java android)

I'm using AudioRecord to record 16 bit PCM data in android. After recording the data and saving it to a file, I read it back to save it as .wav file. The problem is that the WAV files are recognized by media players but play nothing but pure noise.…
Oliver Mahoney
  • 667
  • 1
  • 9
  • 15
34
votes
5 answers

PCM audio amplitude values?

I am starting out with audio recording using my Android smartphone. I successfully saved voice recordings to a PCM file. When I parse the data and print out the signed, 16-bit values, I can create a graph like the one below. However, I do not…
stackoverflowuser2010
  • 29,060
  • 31
  • 142
  • 184
30
votes
1 answer

How to get frequency from fft result?

I have recorded an array[1024] of data from my mic on my Android phone, passed it through a 1D forward DFT of the real data (setting a further 1024 bits to 0). I saved the array to a text file, and repeated this 8 times. I got back 16384 results. I…
Ben Taliadoros
  • 6,068
  • 15
  • 54
  • 84
24
votes
3 answers

PCM to AAC conversion using mediacodec

I am using a media codec class in Android (Jelly Bean) to encode PCM format to AAC. The file was encoded but no music player is able to play that file. I was not able to find any working code or proper documentation on the net. This is my…
tikson
  • 251
  • 1
  • 2
  • 6
22
votes
6 answers

PCM -> AAC (Encoder) -> PCM(Decoder) in real-time with correct optimization

I'm trying to implement AudioRecord (MIC) -> PCM -> AAC Encoder AAC -> PCM Decode -> AudioTrack?? (SPEAKER) with MediaCodec on Android 4.1+ (API16). Firstly, I successfully (but not sure correctly optimized) implemented PCM -> AAC Encoder by …
user1028880
20
votes
3 answers

Creating a WAV file from raw PCM data using the Android SDK

I'm trying to use the AudioRecord class to record a WAV file. The problem is that it only supplies the raw PCM data, and if I write it to a file, there is no header information, so it will not play in any media player. How can I create a WAV file…
user496854
  • 4,639
  • 9
  • 39
  • 74
20
votes
2 answers

PCM Raw Bytes [] To Audio on Android

I currently have a PCM audio in the form of a byte array. The format is signed 16 bit little endian. I would like to convert this to some playable format on the Android, preferably version 3.2 or higher. Does anyone have suggestions on how this can…
ShannonS
  • 354
  • 1
  • 4
  • 13
19
votes
1 answer

Playing PCM stream from Web Audio API on Node.js

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…
Conor Patrick
  • 2,529
  • 5
  • 17
  • 32
17
votes
2 answers

Does "16bit integer PCM data" mean it's signed or unsigned?

I'm using FMOD to develop an application which would immediately start playing the recording of the next/previous sentence exactly from its beginning in a MP3 file which contains speech, without music, when the user clicked the Next/Prev button. I…
xiaokaoy
  • 1,538
  • 3
  • 12
  • 26
16
votes
4 answers

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

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…
filipebarretto
  • 1,692
  • 1
  • 10
  • 24
15
votes
2 answers

how to play PCM sound file in Ubuntu?

I have a PCM sound file with sample rate 16000, sample bit 16 and channel 1. I want to play it , but there's no software can do. I also tried ffplay like : ffplay -ar 16000 -ac 1 snake.raw But still failed. How to play the PCM sound file in Ubuntu?
socket
  • 1,005
  • 3
  • 12
  • 21
14
votes
3 answers

Encode wav to AAC on Android

You can use MediaRecorder to record a stream directly to AAC but there doesn't seem to be a way to encode an existing PCM/WAV file to AAC. The ability to encode to AAC exists natively in Android and I'd like to use that. Is there no way to do it…
Matt
  • 3,033
  • 4
  • 28
  • 42
1
2 3
49 50