1

I am using the Lame library in a C++ application to encode wav files to mp3 files.

It works ok for 16-bit wavs, but now I need to convert some 24-bit wavs and I cannot seem to find the way. In particular, I cannot find a function for setting the "bitwidth" parameter taken as a switch by the lame command line. (The command line executable does convert 24-bit wavs correctly when setting "bitwidth" to 24, so I think it must be possible.)

Thank you in advance for any hint!

ACEG
  • 1,981
  • 6
  • 33
  • 61

1 Answers1

1

The command line executable does convert 24-bit wavs correctly when setting "bitwidth" to 24, so I think it must be possible

Perhaps the solution then is to look at the source-code for the command line utility, or even step it in your debugger and see how it does it.

Clifford
  • 88,407
  • 13
  • 85
  • 165
  • I'm sorry for not answering sooner, kind of a hectic period at work. Thank you for the advice! unfortunately lame is internally a big bundle of spaghetti code -- I ended up generating wavs of various bitwidth using MatLab: nice and clean. – ACEG Feb 25 '11 at 11:21
  • @Cristina: That is why I suggested using a debugger; then you only need to follow the thread of execution for your particular invokation. All I would imagine you have to do is track how the 24bit argument is processed. – Clifford Feb 25 '11 at 22:11
  • Yeah, I used a debugger...I don't remember now exactly how it was since it was a long time ago, but there were some odd global variables that came out of nowhere or something like that. Maybe if I had been using C++ for more than just a couple of months, it would have been clearer. Bottomline, for the short time that we had available, it was not worth the trouble ;-) – ACEG Feb 28 '11 at 08:58
  • @Cristina: Trust me, it is awalys worth teh trouble. It should be the second thing you learn about after "hello, world", since it will save you hours. However if you are using a C debugger that is not fully C++ aware, the results may be confusing, but you are unlikley to encoundter such a debugger outside of embedded systems development, where even then debuggers are genereally C++ aware these days. – Clifford Feb 28 '11 at 19:23
  • Yeah, for sure! I totally agree. I realise my previous answers probably came across as "noob who thinks debugging is too esoteric", but in fact I always use debugging in such cases. In that instance, however, it was just the choice between debugging badly structured and undocumented code, or taking the easy way out. If this had been some personal pet project, I would've had no issues with spending some more time in order to find out what was going on. But when you're on a contract deadline, unfortunately it matters whether you do it fast or slow :D – ACEG Mar 01 '11 at 09:14