audioformat

playback audio file from byte code (audio file format is CCITT A-Law)

送分小仙女□ 提交于 2020-01-04 13:40:05
问题 I want to playback audio file from byte code. I already have byte code for audio file. But when I playback with System.Media.SoundPlayer, I got error as "{Sound API only supports playing PCM wave files."}. My audio file format is (CCITT A-Law). Can any one who have this knowledge share with me pls?? Thanks. 回答1: The standard G.711 tells you how to convert 8 bit A-law into 16 PCM. Here's a code snippet 回答2: WAV files can be encoded in many ways, usually PCM or MP3. .NET only supports PCM. Use

How to calculate the decibel of audio signal and record the audio in java?

跟風遠走 提交于 2019-12-24 21:43:42
问题 public TargetDataLine targetDataLine; private static AudioFormat getAudioFormat() { return new AudioFormat(16000, 16, 2, true, false); } AudioFormat a = getAudioFormat(); DataLine.Info info = new DataLine.Info(TargetDataLine.class, a); targetDataLine = (TargetDataLine) AudioSystem.getLine(info); targetDataLine.open(a); targetDataLine.start(); AudioInputStream ais = new AudioInputStream(targetDataLine); AudioSystem.write(ais, AudioFileFormat.Type.WAVE, new File("record.wav")); How can i

Is there anything special I have to do to create a 24-bit WAV file?

空扰寡人 提交于 2019-12-23 03:47:08
问题 I can successfully create a 16-bit wav file, but when creating a 24-bit file, all I hear is white noise. I'm setting 24-bit signed integer data chunks. Do I have to set some special audio format at byte 20 in the wav file header? I'm currently using format 1. Edit #1 The wBitsPerSample field is set to 24. The wAvgBytesPerSec (byte rate) field is set to // 44100 * (2 * 3) sampleRate * blockAlign and wBlockAlign is set to // 2 * 3 numChannels * bytesPerSampe Assuming you already did, the data

Recording mp3 instead of caf file

隐身守侯 提交于 2019-12-20 05:56:06
问题 I'm looking at this example: https://developer.apple.com/library/ios/#samplecode/SpeakHere/Introduction/Intro.html I modified it ( the AQRecorder.mm)to record mp3 instead of caf file. I changed from kAudioFileCAFType to kAudioFileMP3Type but it does not create the file. The code became void AQRecorder::SetupAudioFormat(UInt32 inFormatID) { memset(&mRecordFormat, 0, sizeof(mRecordFormat)); UInt32 size = sizeof(mRecordFormat.mSampleRate); XThrowIfError(AudioSessionGetProperty(

Recording PCM audio in silverlight 4

允我心安 提交于 2019-12-11 06:17:54
问题 I have encountered a strange behavior in Silverlight application and couldn't be able to resolve it after trying many hours. Since I cannot access AudioFormat 's internal constructor in my code (even using reflection caused silverlight security policies to raise an exception), How can I change audio format (in my class which is derived from AudioSink class. Right now, I override the method in my MemoryAudioSink class as follows: protected override void OnFormatChange(AudioFormat audioFormat)

How can I convert a wav file in java

江枫思渺然 提交于 2019-12-10 18:36:40
问题 How can I convert a wav file in java AudioFormat targetFormat = new AudioFormat( sourceFormat.getEncoding(), fTargetFrameRate, 16, sourceFormat.getChannels(), sourceFormat.getFrameSize(), fTargetFrameRate, false); in result Exception : java.lang.IllegalArgumentException: Unsupported conversion: ULAW 8000.0 Hz, **16 bit**, mono, 1 bytes/frame, **from** ULAW 8000.0 Hz, **8 bit**, mono, 1 bytes/frame it is possible in java? I need get wav file 16 bit, from 8 回答1: Here is a method that will

AudioRecord - Invalid audio buffer size

我是研究僧i 提交于 2019-12-08 06:50:04
问题 I have a problem with below lines when using AudioFormat.ENCODING_PCM_8BIT as AudioFormat. When using AudioFormat.ENCODING_PCM_16BIT these work fine. bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_8BIT); audio = new AudioRecord(MediaRecorder.AudioSource.CAMCORDER, sampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_8BIT, bufferSize); logcat: 03-26 10:03:49.643: E/AndroidRuntime(19949): FATAL EXCEPTION: main 03-26 10:03

What does interleaved stereo PCM linear Int16 big endian audio look like?

我的梦境 提交于 2019-12-07 11:21:36
问题 I know that there are a lot of resources online explaining how to deinterleave PCM data. In the course of my current project I have looked at most of them...but I have no background in audio processing and I have had a very hard time finding a detailed explanation of how exactly this common form of audio is stored. I do understand that my audio will have two channels and thus the samples will be stored in the format [left][right][left][right]... What I don't understand is what exactly this

What does interleaved stereo PCM linear Int16 big endian audio look like?

被刻印的时光 ゝ 提交于 2019-12-05 12:23:29
I know that there are a lot of resources online explaining how to deinterleave PCM data. In the course of my current project I have looked at most of them...but I have no background in audio processing and I have had a very hard time finding a detailed explanation of how exactly this common form of audio is stored. I do understand that my audio will have two channels and thus the samples will be stored in the format [left][right][left][right]... What I don't understand is what exactly this means. I have also read that each sample is stored in the format [left MSB][left LSB][right MSB][right