Work VAD and AMR encoder from one source

Dimych
Posts: 13
Joined: Tue Feb 05, 2019 6:09 am

Work VAD and AMR encoder from one source

Postby Dimych » Thu Feb 07, 2019 3:12 pm

Hi!
I do not speak the language well, but I hope that you will understand me :-)

Tell me how to implement parallel work VAD и AMR?

If you take data from the ring buffer for VAD, the AMR encoder does not receive them.

Code: Select all

	.....
	audio_pipeline_register(pipeline, i2s_stream_reader, "i2s"); // Read data PDM microphone
        audio_pipeline_register(pipeline, amr_encoder, "Wamr");
        audio_pipeline_register(pipeline, raw_read, "raw");
        const char * test[] = {"i2s", "Wamr", "raw"};
        audio_pipeline_link(pipeline, test, 3); 
        .....
        
        raw_stream_read(i2s_stream_reader, (char *)vad_buff, VAD_BUFFER_LENGTH * sizeof(short));
        // Feed samples to the VAD process and get the result   
        vad_state_t vad_state = vad_process(vad_inst, vad_buff);
        
        ...
        
        uint16_t n = raw_stream_read(raw_read, (char*)buff, 64); // Read result AMR encoder
        
How to parallelize audio data streams from one source? :-)

Dimych
Posts: 13
Joined: Tue Feb 05, 2019 6:09 am

Re: Work VAD and AMR encoder from one source

Postby Dimych » Fri Feb 08, 2019 10:20 am

Faced another problem.
If I try to read data from the main stream - it works. From any other - all other threads hang and only this one works.
The priority of the main thread 1 (changed to 5). The rest - 5. There is no difference.

Code: Select all

	uint16_t n = raw_stream_read(raw_read, (char*)bufff, 256);
I tried to do this:

Code: Select all

        ringbuf_handle_t rb = audio_element_get_input_ringbuf(raw_read);
        int rb_fill = rb_bytes_filled(rb);

        DEBUG("AMR fill: " + String(rb_fill));

        if (rb_fill > 256) 
            uint16_t n = raw_stream_read(raw_read, (char*)bufff, 256);        
So that the function raw_stream_read does not block, at the time of filling with data, in the required volume for reading. Did not solve the problem ...

It’s impossible to share several functions in the chip, there are constant conflicts (

Who is online

Users browsing this forum: No registered users and 80 guests