pcm

Can I get raw PCM data from MediaPlayer or SoundPool?

故事扮演 提交于 2019-12-01 08:53:59
i use eclipse with android sdk 4.0.3 api lvl 15 to create a basic music player application. I read and found that there are two main classes to play sounds. MediaPlayer and SoundPool. SoundPool has more flexibility regarding sound priority and rate of played sound. I would also like to draw a visualization graph of the audio. is there a way to get raw PCM data from the loaded audio asset in order for me to be able to draw the graph ? is there a way to manipulate the raw data before it's being played on realtime? for example if i want to add real time effects. is that possible with these

Convert raw PCM to FLAC?

牧云@^-^@ 提交于 2019-12-01 08:12:52
EDIT: I've updated the code below to resemble the progress I have made. I'm trying to write the .wav header myself. The code does not work properly as of now, the audio is not being written to the file properly. The code does not contain any attempts to convert it to a .flac file yet. I am using a Raspberry Pi ( Debian Linux ) to record audio with the ALSA library . The recording works fine, but I need to encode the input audio into the FLAC codec. This is where I get lost. I have spent a considerable amount of time trying to figure out how to convert this raw data into FLAC , but I keep

Convert raw PCM to FLAC?

谁说胖子不能爱 提交于 2019-12-01 06:42:20
问题 EDIT: I've updated the code below to resemble the progress I have made. I'm trying to write the .wav header myself. The code does not work properly as of now, the audio is not being written to the file properly. The code does not contain any attempts to convert it to a .flac file yet. I am using a Raspberry Pi (Debian Linux) to record audio with the ALSA library. The recording works fine, but I need to encode the input audio into the FLAC codec. This is where I get lost. I have spent a

Can I get raw PCM data from MediaPlayer or SoundPool?

心不动则不痛 提交于 2019-12-01 06:25:56
问题 i use eclipse with android sdk 4.0.3 api lvl 15 to create a basic music player application. I read and found that there are two main classes to play sounds. MediaPlayer and SoundPool. SoundPool has more flexibility regarding sound priority and rate of played sound. I would also like to draw a visualization graph of the audio. is there a way to get raw PCM data from the loaded audio asset in order for me to be able to draw the graph ? is there a way to manipulate the raw data before it's being

Convert two bytes into signed 16 bit integer in JavaScript

丶灬走出姿态 提交于 2019-12-01 01:58:46
问题 In JavaScript, I need to convert two bytes into a 16 bit integer, so that I can convert a stream of audio data into an array of signed PCM values. Most answers online for converting bytes to 16 bit integers use the following, but it does not work correctly for negative numbers. var result = (((byteA & 0xFF) << 8) | (byteB & 0xFF)); 回答1: You need to consider that the negatives are represented in 2's compliment, and that JavaScript uses 32 bit integers to perform bitwise operations. Because of

Create valid wav file header for streams in memory

南楼画角 提交于 2019-11-30 22:09:32
I have raw-headerless wav audio data as MemoryStream s. Stream rawAudioStream = Producer.GetRawAudioFileStream(...); I know those streams data format: // WaveFormat(int rate, int bits, int channels); WaveFormat waveformat = new WaveFormat(8000, 16, 1); What I want is to add programmatically right header info for those memory streams without writing them to a physical file. How can I do that? PS: I checked the NAudio Library but only found a way to create a header by writing streams to really-physical files which is not suitable for my situation . var waveformat = new WaveFormat(8000,16,1); var

java pcm to wav

橙三吉。 提交于 2019-11-30 22:07:44
I have a pcm file, and I want to convert it to a wav file. Is there any suitable api or code for this? devflow it's My Code /** * Write PCM data as WAV file * @param os Stream to save file to * @param pcmdata 8 bit PCMData * @param srate Sample rate - 8000, 16000, etc. * @param channel Number of channels - Mono = 1, Stereo = 2, etc.. * @param format Number of bits per sample (16 here) * @throws IOException */ public void PCMtoFile(OutputStream os, short[] pcmdata, int srate, int channel, int format) throws IOException { byte[] header = new byte[44]; byte[] data = get16BitPcm(pcmdata); long

Create valid wav file header for streams in memory

一笑奈何 提交于 2019-11-30 17:25:07
问题 I have raw-headerless wav audio data as MemoryStream s. Stream rawAudioStream = Producer.GetRawAudioFileStream(...); I know those streams data format: // WaveFormat(int rate, int bits, int channels); WaveFormat waveformat = new WaveFormat(8000, 16, 1); What I want is to add programmatically right header info for those memory streams without writing them to a physical file. How can I do that? PS: I checked the NAudio Library but only found a way to create a header by writing streams to really

How can I resample wav file

眉间皱痕 提交于 2019-11-30 16:20:15
问题 Currently I'm recording an audio signal with following specs: Channels: 1 SamplesPerSecond: 8000 BitsPerSample: 16 How can I convert this .wav-file to eg following specs (pure c# is preferred): Channels: 1 SamplesPerSecond: 22050 BitsPerSample: 16 回答1: Windows API (one of) to resample audio is Audio Resampler DSP. This transform class is pretty straightforward to set up input and output types, then push input data and pull output. Another task you would possible deal additionally with is

Interpreting WAV Data

≡放荡痞女 提交于 2019-11-30 12:18:32
问题 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 data. The wave.getparams function returns (2 channels, 2 bytes, 44100 Hz, 96333 frames, No compression, No compression). This all seems cheery, but then I tried printing a single frame:'\xc0\xff\xd0\xff' which is 4 bytes. I suppose it's possible that