How to drop audio input data in synchronized mode on wearable device
How to drop audio input data in synchronized mode on wearable device
BY 30 Jul 2016Native Application Development
I am writing an app which recogized specific voice type, which needs to be real-time responsing. I am using the audio input api in wearable device based on 2.3.1 sdk.
I want to check the audio every 0.3s, if it detects something useful, then it record the PCM audio and stop, or it will keep detecting.
the pseudo code looks like this:
#include <audio_io>
audio_in_h input;
audio_in_create(SAMPLE_RATE, AUDIO_CHANNEL_MONO, AUDIO_SAMPLE_TYPE_S16_LE, &input);
ecore_thread_run(synchronous_recording, NULL, NULL, NULL);
void synchronous_recording(void *data, Ecore_Thread *thread)
{
audio_in_prepare(input);
bool captured = false;
while(captured == false){
audio_in_read(input, buffer, buffer_size);
check the buffer , if the data satisfied some constraint then set captured to true
}
audio_in_unprepare(input);
}
audio_in_destroy(&input);
If i need to keep looping , i think i need to drop that previous data before the next loop like in the asynchronized mode “audio_in_peek/audio_in_drop”.
But i just could find a function like audio_in_drop.
Unlike the sdk 2.4.0 of the mobile version, it has an api like “audio_in_flush” which could do that cleaning-previous-buffer jobs.
So what should i do ?
How to drop audio input data in synchronized mode on wearable device
I am writing an app which recogized specific voice type, which needs to be real-time responsing. I am using the audio input api in wearable device based on 2.3.1 sdk.
I want to check the audio every 0.3s, if it detects something useful, then it record the PCM audio and stop, or it will keep detecting.
the pseudo code looks like this:
#include <audio_io>
audio_in_h input;
audio_in_create(SAMPLE_RATE, AUDIO_CHANNEL_MONO, AUDIO_SAMPLE_TYPE_S16_LE, &input);
ecore_thread_run(synchronous_recording, NULL, NULL, NULL);
void synchronous_recording(void *data, Ecore_Thread *thread)
{
audio_in_prepare(input);
bool captured = false;
while(captured == false){
audio_in_read(input, buffer, buffer_size);
check the buffer , if the data satisfied some constraint then set captured to true
}
audio_in_unprepare(input);
}
audio_in_destroy(&input);
If i need to keep looping , i think i need to drop that previous data before the next loop like in the asynchronized mode “audio_in_peek/audio_in_drop”.
But i just could find a function like audio_in_drop.
Unlike the sdk 2.4.0 of the mobile version, it has an api like “audio_in_flush” which could do that cleaning-previous-buffer jobs.
So what should i do ?
BY
16 Apr 2025
Tizen Studio
BY
04 Nov 2024
Tizen Studio
BY
02 Apr 2024
Tizen Studio