Hello

I am trying an experiment using LAME MP3 to control the target bitrate.
I would like the output of the encoded file as below. I was able to play the output anyway.

I introduced a routine that directly changes the bitrateindex in the iteration loop of the cbr mode just before it starts to encode the frame. I mean before the ResvFrameBegin routine in the quantize.c

Encoding
Rate.............<-------length of file------->......or...<-------length of file-------->
128kbps.......=====.................=====.............=====...................=====
.............................=.................=...............................=...................=
........
.............................=.................=...............................=...................=
........
112kbps...............=.................=...............................=........======.........
.............................=.................=...............................=.......=............
........
.............................=.................=...............................=.......=............
........
96kbps..................=========................................=====....................


My question is how best can i do the change of bitrate, can it be done somewhere else in the code like in the MDCT or Pschoacoustic or Huffman coding.

Is this visiable and how?

If yes, how can this be achieved.

I appreciate your answers.

Thanks