lundi 6 avril 2015

Resample PCM network stream to 8000Hz 8-bit mono via libsndfile sf_open_virtual function

My goal is to take a PCM stream in Node.js that is, even for example, 44100Hz 16 bit stereo, and then resample it to 8000 Hz 8 bit mono to then be encoded into Opus and then streamed.


My thought was to try making bindings for libsndfile in C++ and using sf_open_virtual function for resampling on the stream. However:



  1. How can I reply to its callback function requesting a certain amount of data (found here: http://ift.tt/1uPRJgn) if my program is still receiving data from the network? Do I just let it hang in a loop until the loop detects that the buffer is a certain percent full?

  2. Since the PCM data is going to be headerless, how can I specify the format type for libsndfile to expect?


Or am I over-complicating things totally?


Aucun commentaire:

Enregistrer un commentaire