Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: u-law encoder (Read 5974 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

u-law encoder

I need to encode a large amount of wav files (22.05 kHz/16-bit/1 channel) to u-law wav files.  Is there any open source library that can do the job?  I am planning to write a command-line encoder and then call it with a shell script.

Thanks in advance.

Michael Lee


u-law encoder

Reply #2
Sox could do the job.

u-law encoder

Reply #3
Quote
Sox could do the job.

Thanks!  SoX is exactly what I need! 

u-law encoder

Reply #4
Quote
I need to encode a large amount of wav files (22.05 kHz/16-bit/1 channel) to u-law wav files.  Is there any open source library that can do the job?  I am planning to write a command-line encoder and then call it with a shell script.

I'm not sure you really want to do that. U-law is fine for 8 kHz speech, but not for 16 kHz and above. The reason is that the dynamic range in the spectrum (energy difference between low and high frequencies) is too high, which creates annoying noise at higher frequencies. I think there's a mu-law standard for wideband but it uses 12 bits/sample (i.e. not a huge gain). Of course, there's always Speex that will get you better quality at lower bit-rate (disclaimer: I'm the Speex author).

u-law encoder

Reply #5
Quote
Quote
I need to encode a large amount of wav files (22.05 kHz/16-bit/1 channel) to u-law wav files.  Is there any open source library that can do the job?  I am planning to write a command-line encoder and then call it with a shell script.

I'm not sure you really want to do that. U-law is fine for 8 kHz speech, but not for 16 kHz and above. The reason is that the dynamic range in the spectrum (energy difference between low and high frequencies) is too high, which creates annoying noise at higher frequencies. I think there's a mu-law standard for wideband but it uses 12 bits/sample (i.e. not a huge gain). Of course, there's always Speex that will get you better quality at lower bit-rate (disclaimer: I'm the Speex author).

I have to do that for a project which involves computer telephony hardware supporting only 8 kHz u-law WAV files and VOX files.

u-law encoder

Reply #6
Quote
I have to do that for a project which involves computer telephony hardware supporting only 8 kHz u-law WAV files and VOX files.

In this case, I strongly suggest that you do some pre-emphasis on the signal first (if you can). It can be something simple like filtering by H(z)=1 - 0.7*z^-1 before converting to u-law and then applying 1/H(z) after decoding.