2

I am converting the wave file into mp3 using lame encoder.
I have reached this answer (Mike Seymour) which does the work very nicely. I am looking to convert this into a c++ equivalent code.

This answer (trodevel) Does the c++ equivalent conversion of the code but I am unable to understand this one.

What I am looking for is to understand how Mike Seymour's answer works?

Why he used a pcm_buffer (size 4 * 8192 bytes) & mp3_buffer (size 8192 bytes)?
Is the ratio between (pcm size) : (mp3 size) = 4:1?

Any help is appreciated.

Codeme
  • 137
  • 2
  • 10
  • Maybe if you comment under his answer, he might tell you right away. – Jin Lee Jul 15 '19 at 06:57
  • 1
    You'll be lucky to get a reply from Mike Seymour, given that he hasn't visited Stack Overflow since 2015. – paddy Jul 15 '19 at 07:01
  • Yes he is not active. and I cannot comment on that post needs some points. – Codeme Jul 15 '19 at 07:08
  • **does the work very nicely.** Then Why are you not using it? For understanding you can use debug mode and check how it flows. Show us your code if you have made changes. Also refer this [How To Ask](https://stackoverflow.com/help/how-to-ask) link for future. – RC0993 Jul 15 '19 at 07:13
  • Note that Mike's answer states that he knocked up the example quickly. It's quite possible that the buffer sizes he chose will not always work. If you read the comments in the LAME header file above `lame_encode_buffer`, it offers a worst-case estimate, which turns out to be 16200 bytes for a _single channel_ input of 8192 PCM samples. Why don't you simply use his answer as a basic tool to get started, and then write your own original code in C++? You should trust the documentation in LAME above anything else. – paddy Jul 15 '19 at 07:24
  • @paddy. Can you post the link for documentation here? I could not find docs in the website – Codeme Jul 15 '19 at 09:31
  • As I said, read the LAME header: _i.e._ `lame.h` – paddy Jul 15 '19 at 23:11

0 Answers0