Wav File Converter Ulaw

0 views
Skip to first unread message

Melia Hazinski

unread,
Aug 5, 2024, 10:34:34 AM8/5/24
to libacklumi
Whataudio format is installTap buff? How can I do to got ulaw data format?I can got it from AVAudioRecorder but I'm not to got a file.Do change format settings 'AVFormatIDKey=kAudioFormatULaw' will got crash.

A phone system provider has asked me to provide an audio voice greeting in ulaw 8kHz 8bit Mono. He very specifically asked that the file be saved with a .ulaw extension and that it NOT be saved as a .wav file. Can I save the file in the .wav codec and just change the extension to .ulaw? Is this the exact same thing as a .ulaw file?


Hi all, I have mgcp gateways that are connected via to our pbx's. The gateway configuration on the cucm has the codec on the pri interface as alaw. But i've noticed when I do the 'show voice call sum' on the gateway, it shows ulaw in use. I assume that this is showing the ip side of the call? But if that is the case is there transcoding happening on the router between alaw and ulaw automatically?


Could I ask a follow on: if the cucm is also interacting with third party piece of kit over a sip trunk, and the bit of kit only uses alaw. I've noticed that the cucm stays involved in the call, rather than passing off to the endpoints, i.e. 3rd party kit and gateway, unlike when its to a phone, when it does drop out. And the call leg from the cucm to the gateway uses ulaw, whilst the sip trunk uses alaw, do you think this is why i'm seeing mtp resources being used on the cucm, or is it just that the gateway is non rfc2833 compliant.


An MTP can be used to transcode G.711 a-law audio packets to G.711 mu-law packets and vice versa, or it can be used to bridge two connections that utilize different packetization periods (different sample sizes).


Prerequisite Set up a batch processor. Procedure In the Batch Processor window, do one of the following: In the Watch Folders window, select Functions > Add Watch Folder Task . In the Watch Folders ...


Or simply use a Task Automation software, Robotask for example, that can watch for file creation inside a folder and run a command on it, for example start the free command line audio file converter SOX and delete the original file after compression. SOX is frequently used for conversion to uLaw and ALaw. It is the Swiss Army knife of sound conversion / processing programs. I was using that when i was working in the VOIP market. Free and good quality.


Mu-law coding is a form of compression for audio signals includingspeech. It is widely used in the telecommunications field because itimproves the signal-to-noise ratio without increasing the amount ofdata. Typically, mu-law compressed speech is carried in 8-bit samples. It is a companding technqiue. That means that carries more informationabout the smaller signals than about larger signals.


On SUN Sparc systems have a look in the directory /usr/demo/SOUND. Included are table lookup macros for ulaw conversions. [Note howeverthat not all systems will have /usr/demo/SOUND installed as it isoptional - see your system admin if it is missing.]


I have sent raw audio from my Arduino to a Web Host and saved it as a file. How can I play it on my PC? iPhone? Browser? There is no Wav header. No compression. Just raw 8-bit per sample PCM data. I'd like to make it easy for the end user. But first I need an idea that I can test myself no matter how difficult it is?


In telephony, a standard audio signal for a single phone call is encoded as 8,000 analog samples per second, of 8 bits each, giving a 64 kbit/s digital signal known as DS0. The default signal compression encoding on a DS0 is either ?-law (mu-law) PCM (North America and Japan) or A-law PCM (Europe and most of the rest of the world). These are logarithmic compression systems where a 12 or 13-bit linear PCM sample number is mapped into an 8-bit value. This system is described by international standard G.711.


I can change the sample rate to any reasonable value. I have an algorithm to convert to ulaw before I even send it. But how do I play it back to test it myself? How do I make it easier for the end user? Would it help to make a Wav header? I have done this years ago. Not sure if that goes with ulaw compression.


Since the PCM samples are originating from the Arduino, why don't you add the header before sending it?

You know the sample rate, the number of channels and bits per sample so it's straight forward.

The wav format is pretty simple and the Arduino is more than capable of adding the header with very little overhead.


A note of warning though, since you want to be able to play the resulting sound in all sorts of browsers (pc, smarthones, tablets), first make sure that the browsers on those devices do actually support the wav format.

(see attached table for Win 7 support of wav in some common browsers).


Does the web host you refer to have any cgi capabilities?

If so, you could write a script in Perl/PHP/ASP to automatically add the header or even convert it to other formats that could not be easily done on the Arduino, like MP3 or Ogg.


I think we're on the right track with the WAV header. But then I can't use uLaw compression? I'm sure I can figure out how to play a WAV file by referencing the file URL with a specific browser. How can I make it easy for everyone else regardless of their browser? Is there some sort of website where I can pass the WAV file URL and it will play thru the browser?


wav files do support compression but I cannot tell you if uLaw is specifically supported and under which platforms.

If there is any compression, it is usually indicated in the header (offset 20).

You will have to do some research on that.


sbright33:

I'm sure I can figure out how to play a WAV file by referencing the file URL with a specific browser. How can I make it easy for everyone else regardless of their browser? Is there some sort of website where I can pass the WAV file URL and it will play thru the browser?


I don't quite understand your question.

I was under the impression that you upload your sound file to a server (web host as you put it) thus it will already have a URL associated with it.

For example:


Now if it has a header (whether inserted by the Arduino or a server-side script) then you simply point the user to that URL

and provided that their browser plays wavs, they will hear it.


Js is not server-side it's client side so that would mean the users device would first have to download the audio, cache it locally, process it then only play it.

With flash, the swf will have to be either "pre-compiled" or compiled on the fly then you hope/assume that the user has flash on his/her device.

If you have to process the raw audio on the server, then rather use something like Perl or PHP to take the raw samples and make a more generic mp3 out of it.

Consult with your hosting provider as many already have Perl or PHP enabled and the libs for them to create mp3 (or something else) are easily available.

The conversion would be automatic as you would post to the script, it would process the data and place it in a predefined directory on the server and thus you will have the URL.


I second the suggestion to have the Arduino add the wav header. There are plenty of tools on line to convert .wav files into something else, so if necessary you could post two versions of each file (.mp3 ?) side by side on your web site. When users click on a link, the browsers are supposed to know how to handle the file extension, even if Internet Explorer doesn't know what to do with Micro$oft's .wav.


Since I already have uLaw data, I can add a much simpler header, only a few bytes. Then play with this Flash Player on most browsers, but not iPhone. The advantage is half the data size and more customization.


I had reason to playback some raw g.711 audio data. I made the following script to convert the data to a .au file that is playable. From the AU file spec.. which is way simple by the way: You just need to add 6 32-bit header flags. raw2au.py: import...


I should explain to prevent confusion. The audio files are generated in real time. I cannot convert them to MP3 or any arbitrary format in advance thru a manual process because the data is constantly changing.


sbright33:

I should explain to prevent confusion. The audio files are generated in real time. I cannot convert them to MP3 or any arbitrary format in advance thru a manual process because the data is constantly changing.


Well there is real time and nearly realtime (delayed by perhaps a few hundred milliseconds).

Keep in mind that if you upload the wav file (already with header added by arduino) to the servers script, it will take that server very little time to make that file in wav available and automatically convert that wav to mp3 and make that available as well.


You also mention that the uploading is only done when triggered by an event, so it's not as if it's like streaming mpeg video like in a IPTV setup and presumably you have a few hundred milliseconds to spare between events that trigger the upload.


The audioop module contains some useful operations on sound fragments.It operates on sound fragments consisting of signed integer samples 8, 16, 24or 32 bits wide, stored in bytes-like objects. All scalar items areintegers, unless specified otherwise.


Return a fragment which is the addition of the two samples passed as parameters.width is the sample width in bytes, either 1, 2, 3 or 4. Bothfragments should have the same length. Samples are truncated in case of overflow.


Decode an Intel/DVI ADPCM coded fragment to a linear fragment. See thedescription of lin2adpcm() for details on ADPCM coding. Return a tuple(sample, newstate) where the sample has the width specified in width.


Return a factor F such that rms(add(fragment, mul(reference, -F))) isminimal, i.e., return the factor with which you should multiply reference tomake it match as well as possible to fragment. The fragments should bothcontain 2-byte samples.


Try to match reference as well as possible to a portion of fragment (whichshould be the longer fragment). This is (conceptually) done by taking slicesout of fragment, using findfactor() to compute the best match, andminimizing the result. The fragments should both contain 2-byte samples.Return a tuple (offset, factor) where offset is the (integer) offset intofragment where the optimal match started and factor is the (floating-point)factor as per findfactor().

3a8082e126
Reply all
Reply to author
Forward
0 new messages