Discussion:
WAV to PCM conversion
(too old to reply)
S***@gmail.com
2006-05-11 10:18:47 UTC
Permalink
Hi all,

I've recorded a wav file at 8KHz with an 8bit sample size. I now want
to write code to convert the data from the wav file to PCM, so that I
can send it over my ISDN Card to a phone. I've read that a wav file is
basicaly the PCM data with some headers. If this is true, it shouldnt
be that difficult to convert it. However, I havent been able to figure
out how to do this....

Could someone please help me out...
Kinfe Tadesse
2006-05-11 12:05:59 UTC
Permalink
Hi,

Did you have a look at the following very simple to use algorithm?

http://www.cobalt.chem.ucalgary.ca/ps/hobby/audiochat/g711.c

Best regards,

Kinfe T.
Post by S***@gmail.com
Hi all,
I've recorded a wav file at 8KHz with an 8bit sample size. I now want
to write code to convert the data from the wav file to PCM, so that I
can send it over my ISDN Card to a phone. I've read that a wav file is
basicaly the PCM data with some headers. If this is true, it shouldnt
be that difficult to convert it. However, I havent been able to figure
out how to do this....
Could someone please help me out...
Tobias Erichsen
2006-05-11 12:12:41 UTC
Permalink
Post by S***@gmail.com
Hi all,
I've recorded a wav file at 8KHz with an 8bit sample size. I now want
to write code to convert the data from the wav file to PCM, so that I
can send it over my ISDN Card to a phone. I've read that a wav file is
basicaly the PCM data with some headers. If this is true, it shouldnt
be that difficult to convert it. However, I havent been able to figure
out how to do this....
You should not record with 8bit sample-size - this would leave your
sound-quality at reduced quality. Record at 16bit/mono and convert
with one of the PCM16->aLaw converters found on the network.

G.711 (aLaw & muLaw) is 8bit, but actually it is a 13bit sample
logarithmically companded down to 8bit - so the perceived
quality for the ear is 13bit - which is definately an improvement
over using plain 8bit.

Tobias
S***@gmail.com
2006-05-12 05:04:14 UTC
Permalink
Thanks Tobias... I'm new to DSP, so I dont realy know what muLaw and
aLaw is... Is it some sort of compression technique? The thing is....
if I send anything other than a raw 8-8 PCM stream, the phone and the
DSP chip on my ISDN card wont recognize it...
Tobias Erichsen
2006-05-12 08:29:13 UTC
Permalink
Post by S***@gmail.com
Thanks Tobias... I'm new to DSP, so I dont realy know what muLaw and
aLaw is... Is it some sort of compression technique? The thing is....
if I send anything other than a raw 8-8 PCM stream, the phone and the
DSP chip on my ISDN card wont recognize it...
ALaw & muLaw are defined in ITU-Spec G.711. There are quite a few
implementations
of G.711 <> PCM16 conversion on the web.

So in fact, you will stream 8bit data-units (often called octets in
telecommunication)
for each sample - but those 8bit have a perceived quality of 13bit - so your
source-
material should have at least 13bit of precision or you will loose
audio-quality.

One thing to keep in mind is that CAPI sends G.711 data "upside down" (in
contrast
to the G.711 specification) - which means what would normally be the highest
bit
in the octet will be the lowest and vice versa - this has historical reasons
due to the
fact that the Siemens B-channel-controlller-chips widely used on passive
ISDN-cards,
provided audio-data in this format.

If you use www.deja.com, you will find quite a few posts concerning G.711
and
audio-streaming on this newsgroup (and others as well).

Also there are some open-source applications on the web that use CAPI for
voice-streaming - so this should really give you a good start on how to use
CAPI for voice-applications.

Best regards,
Tobias

Continue reading on narkive:
Loading...