-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to write G.711u (ulaw / mulaw) to wav? #29
Comments
The problem lies with the last argument. TL;DR: Details: WAV format allows storage of audio data in various encodings, such as raw data, compressed formats, etc. Therefore, you should explicitly set the µ-law compression format in the header. This ensures that media players recognize and play back the audio correctly. In your example, passing "1" means "uncompressed pulse code modulated samples." This is incorrect since your data is actually encoded in a different, compressed format. Although the original author of the issue may no longer need assistance due to the passage of time, I thought it would be helpful to present the solution for future readers. I also suggest closing this issue. @mattetti |
FWIW for my use-case encoding the Twilio Stream websocket
|
it works |
Issue
I have a 8Khz 8-bit PCM ulaw byte slice that I would like to convert to a WAV file. When I try to convert it using this library, I get audio that is loud and choppy, sounding a bit like the following issue.
go-audio/audio#16
I'm using an
Encoder
as follows:I'm not quite sure how to convert the raw byte slice into an
audio.IntBuffer
so I'm doing the following, which results in the poor quality audio.Any tips on how to get this library to work for this?
Alternative 1 - Works
As an alternative, the following raw approach results in good sounding audio where I can write out the bytes without transformation.
I've added this here for easy reuse:
https://github.com/grokify/simplego/blob/master/audio/ulaw/ulaw.go
Alternative 2 - Works
The text was updated successfully, but these errors were encountered: