pcm

c# pcm

时间秒杀一切 提交于 2019-11-28 05:57:55
using System; using System.IO; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; namespace WindowsFormsApplication2 { public partial class Form2 : Form { /// <summary> /// ERROR MESSAGE /// </summary> const string ERRFILENOTEXITS = "File is Not Exits."; const string ERRFILEISNOTWAVE = "File is not Wava."; /// <summary> /// Wave Hander information /// </summary> struct HeaderType { public byte[] riff; /*RIFF类资源文件头部 4byte*/ public uint file_len; /*文件长度4byte*/ public byte[] wave; /*"WAVE"标志4byte*/ public byte[] fmt; /*"fmt"标志4byte*/ public uint NI1; /*过渡字节4byte*

PCM audio amplitude values?

我的梦境 提交于 2019-11-28 03:58:14
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 understand the amplitude values along the y-axis. What exactly are the units for the amplitude values? The values are signed 16-bit, so they must range from -32K to +32K. But what do these values represent? Decibels? If I use 8-bit values, then the values must range from -128 to +128. How would that get mapped to the volume/"loudness" of the 16-bit values

Can ffmpeg convert audio from raw PCM to WAV?

≯℡__Kan透↙ 提交于 2019-11-28 03:57:59
I can convert wav file to pcm ffmpeg -i file.wav -f s16le -acodec pcm_s16le file.pcm How can I revert this operation? The wav container just adds a simple header to the raw PCM data. The header includes the format, sample rate, and number of channels. Since the raw PCM data does not include this information, you will need to specify it on the command line. Options are specified before the file they apply to, so options before the input file may be used to specify the format of the input file, and options after the input file and before the output file may be used to specify the desired format

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

旧街凉风 提交于 2019-11-27 18:27:59
问题 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 the file incrementally rather than reading the whole file into memory. Some specific questions: How can I accomplish this with Gstreamer? With pygst specifically? Is there a particular "sink" element I need to use to read data from the stream? Is

how to play pcm raw data in java [closed]

狂风中的少年 提交于 2019-11-27 18:18:32
问题 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 回答1: With the javax.sound.sampled package it's pretty much straightforward, but you have to use some boilerplate. Here's a good tutorial on that: www.wikijava.org/wiki/Play_a_wave_sound_in_Java Basically you have to create an InputStream from your array and use that to create an

Extract iPod Library raw PCM samples and play with sound effects

北城以北 提交于 2019-11-27 18:03:25
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 both do not allow very much control over the playback at all. The code below is as far as I have gotten with this. I am at a point now where I do not know what to do with the CMSampleBufferRef's in my while loop because I do not know which framework to use in order to playback the audio and apply such effects. Any idea what would be the best approach

Playing Raw pcm audio data coming from NSStream

两盒软妹~` 提交于 2019-11-27 17:03:08
问题 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? 回答1: 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

Determine Number of Frames in a Core Audio AudioBuffer

妖精的绣舞 提交于 2019-11-27 16:51:39
问题 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];

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

南楼画角 提交于 2019-11-27 12:26:15
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 from this raw data? Or alternatively, is there any other way to record sound in Android to a WAV file (or, alternatively MP3)? Oh, and I know that MediaRecorder can'y be used because it doesn't support either WAV or MP3 formats. OK, I've got this figured out. This post was crucial in helping me: http://computermusicblog.com/blog/2008/08/29/reading-and