Hi all,

I am trying to make a custom block that implements a MELP vocoder. The block 
takes in audio samples(floats) at 8kHz and outputs bits at 2.4kbps. Given that, 
I think I will need to use a general block to get the correct input/output 
buffer sizes.

The vocoder blocks the audio input to 22.5ms (180 samples) and outputs 54 bits. 
I know that I will need to modify the forecast() function, but I am not sure 
how. My guess would be something like this:

void
  gr::block::forecast(int noutput_items,
                     gr_vector_int &ninput_items_required)
  {
    unsigned ninputs = ninput_items_required.size ();
    for(unsigned i = 0; i < ninputs; i++)
      ninput_items_required[i] = (10/3)*noutput_items;
  }

Then call,

consume_each ((10/3)*noutput_items);

Is this the correct approach or am I missing something here? Once I get this 
working I will likely try to pack the bits into some integer data type for 
efficiency's sake - so I'll need to be to do this for different input/output 
ratios other than 10/3.

Thanks!
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to