Quantcast
Channel: NAudio
Viewing all articles
Browse latest Browse all 5831

New Post: Ima Adpcm Error during Compression

$
0
0

Hi,

i am using following Wave Format for recoding a audio file.

waveIn =

New WaveIn ()

waveIn.WaveFormat =New WaveFormat (8000, 1)

inputformat = waveIn.WaveFormat

Now,i need to Encode/Compress these recorded audio file into Ima Adpcm Format.And,I also seen the discussion about this issue in your forum.There you said,

"Simply add a short in there. Extra size means how many extra bytes there are on top of the original WaveFormat structure. You need a variable to hold that data (a short because you have two extra bytes). And you should also set the contents of that extra data according to the specification of the specific WaveFormatTag you are using"

private class MyWaveFormat:WaveFormat
{
short extraData;

public MyWaveFormat(WaveFormatEncoding WaveFormatTag, short BitsPerSample, short Channels, int AverageBytesPerSecond, short BlockAlign, int SampleRate, short ExtraSize)
{
base.extraSize = ExtraSize;
base.averageBytesPerSecond = AverageBytesPerSecond;
base.bitsPerSample = BitsPerSample;
base.blockAlign = BlockAlign;
base.channels = Channels;
base.sampleRate = SampleRate;
base.waveFormatTag = WaveFormatTag;
}
}

But i am not getting how to set  contents "ExtraData" corresponding to Extra Size.

I also tried  to set Extrqa Data using following Methods,but still i am getting the Same Error ""AcmNotPossible Calling the AcmStreamOpen""

ptr=Waveformat.MarshalToPtr (inputformat)

TargetFormat=waveformat.MarshalFromPtr(ptr)

Can you Please guide me About this problem  as early as possible.

Regards,

Chandan k.s

 

 

 


Viewing all articles
Browse latest Browse all 5831

Trending Articles