discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] C++ General Blocks and the forecast() function


From: Salahi, Mert E
Subject: [Discuss-gnuradio] C++ General Blocks and the forecast() function
Date: Thu, 1 Nov 2018 00:58:05 +0000

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!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]