This project has moved. For the latest updates, please go here.

Compressing PCM on the fly

Feb 3, 2011 at 10:31 PM

Hello, I was wondering if it was possible to convert an array of raw 16-bit PCM bytes to some form of compressed data, like MP3, to be transferred over a network, and then decompressed on the other end.

Any elegant way of doing this in NAudio?

Feb 4, 2011 at 5:00 PM
Edited Feb 4, 2011 at 8:08 PM

i would like to know the same.

Feb 4, 2011 at 11:07 PM

You changed your reply there, didn't you?

Anyway, the only compression streams I've seen in NAudio are for decompressing, not compressing.

Feb 5, 2011 at 12:00 PM

I already posted about GSM compression on the fly, but it seems like i'm not getting anywhere. The question is similar to this topic. How can i convert ON THE FLY the input from a microphone to a format such as GSM, which is a speech codec. Please, could i get an example. I have the codec and I already know that the conversion function will not change it from pcm.

Feb 5, 2011 at 11:01 PM

What format is the codec? Is it just a specification? In that case, you can write a WaveStream that converts the PCM into GSM compressed data.

I am unable to use GSM, unfortunately, since I need to stream music.

Coordinator
Feb 6, 2011 at 7:55 PM

the waveformatstream can work on the fly, it takes a WaveStream as an input which could be implemented by anything. You can encode using any ACM codecs present on your system (Windows does not provide many encoding options by default though)

Mark

Feb 6, 2011 at 9:42 PM

Could you supply an example? I am even having issues trying to use it to convert IeeeFloat to PCM16. Just gives me an MmException when I initialize it.

Coordinator
Feb 7, 2011 at 2:24 PM

use Wave32to16ConversionStream instead for converting ieee float to PCM16

Mark