jstrait / wavefile

A Ruby gem for reading and writing sound files in Wave format (*.wav)
https://wavefilegem.com
MIT License
208 stars 24 forks source link

How to work with 24 bits per sample .wav files? #9

Closed richorton closed 10 years ago

richorton commented 10 years ago

Hi All,

Is there strictly no way that WaveInfo will support 24 bits per sample .wav audio tracks? I am pretty deep into the process of building a web application that needs to be able to convert 24 bits per sample files into 192/320 MP3's. At the moment I am using LAME as my Encoder of choice.

I have tried to research into this a bit further but I am no audio expert so it's all a bit confusing!

Any help on the matter would be greatly received :)

Edit: I have tested the process of reading a 24-bit file as a 32-bit file, but this simply throws an "UnsupportedFormatError" exception.

jstrait commented 10 years ago

Hi Rich,

Currently, the WaveFile gem supports reading/writing files with these sample formats:

PCM 8, 16, 32-bit Floating Point 32, 64-bit

Any other formats, including PCM 24-bit, will raise UnsupportedFormatError.

I started working on supporting reading/writing 24-bit files last night, which would also include the ability to read a 24-bit file into 32-bit buffers (which it sounds like you might need from the other linked issue). It looks feasible, and I'll release a new version of the gem when it's in place. FYI though, I'll be going out of town for a few days for the Thanksgiving holiday so I won't be able to do a release until after then.

Thanks! Joel

richorton commented 10 years ago

Hi Joel,

I did comment on the linked issue on lame, but just incase you didn't get a notification I though I'd comment here too..

I'm truly very grateful for this, it's going to make my life a hell of a lot easier once it's implemented. My client should be pretty happy when I let them know tomorrow too!

Don't stress about a release date either. I completely understand that we all have other things going on. I've put a patch in place on the application I am working on now anyway, so it's not like I have had to "down tools" whilst I find a fix or anything as drastic as that.

Please let me know if there's anything I can do to help too (i'll try my best!)

Thanks, Rich

jstrait commented 10 years ago

Hey Rich,

Sure, no problem! I just released a new version (0.6.0) which should let you read/write 24-bit files, as well as convert 24-bit files to the other supported formats. Let me know if you run into any issues. Hope this helps!

Thanks, Joel

richorton commented 10 years ago

Hi Joel,

That's brilliant, thanks for letting me know. I'll be sure to let you know how I get on as soon as I get a chance to implement the changes.

Thanks, Rich