How to transmit respeaker's data to usb otg port

info about ReSpeaker series products

Moderators: lily.li, violet, seth.welday

Post Reply
joeccmou
Pre-kindergarten
Pre-kindergarten
Posts: 8
Joined: Tue May 22, 2018 4:19 pm

How to transmit respeaker's data to usb otg port

Post by joeccmou » Thu Aug 16, 2018 4:36 pm

I want to get the original data of the 6 mics to analyze the Beam-forming effect and i find the example code on the website as follows. (http://respeaker.io/librespeaker_doc/ma ... ample.html)

Code: Select all

// init libsndfile
    SNDFILE *file ;
    SF_INFO sfinfo ;
    memset (&sfinfo, 0, sizeof (sfinfo)) ;
    sfinfo.samplerate   = rate ;
    sfinfo.channels     = num_channels ;
    sfinfo.format       = (SF_FORMAT_WAV | SF_FORMAT_PCM_24) ;
    if (! (file = sf_open ("record_base_agc_test.wav", SFM_WRITE, &sfinfo)))
    {
        cout << "Error : Not able to open output file." << endl;
        return -1 ;
    }
    while (!stop)
    {
        data = respeaker->Listen();		//the raw data I need
        frames = data.length() / (sizeof(int16_t) * num_channels);
        sf_writef_short(file, (const int16_t *)(data.data()), frames);
        cout << "." << flush;
    }
    cout << "stopping the respeaker worker thread..." << endl;
    respeaker->Stop();
    cout << "cleanup done." << endl;
    sf_close (file);
 
I don't want to put the raw data into a file and need to transmit it throught the USB OTG port.
The sample rate is from 4KHz to 24KHz so the max bandwidth is 24000Hz*6*16bit = 2250Kbit/s. Considering a redundant throughput, it takes 2250*2=4500Kbit/s to fulfill my needs.
Now the USB OTG has been fixed on 115200 bit/s, how to change the speed of the USB OTG ?

bill.yu
Junior-7
Junior-7
Posts: 735
Joined: Mon Apr 02, 2018 11:05 am

Re: How to transmit respeaker's data to usb otg port

Post by bill.yu » Fri Aug 17, 2018 11:51 am

Hi there, OTG port is usb2.0, the fast speed is 48MB/s. So you shall be able to do real time audio transfer. thanks.

Bill

Post Reply