STMicroelectronics / STBLESensor_Android

"ST BLE Sensor" Android application source code.
https://www.st.com/en/embedded-software/stblesensor.html
Other
110 stars 57 forks source link

Speech to text encoding #4

Open mmrobert opened 5 years ago

mmrobert commented 5 years ago

Hi, it is me again.

Hi, there, I am working in NeuronicWorks, Toronto, as a mobile developer.

Now I am using your development kit for your blue tooth (chip) device.

private final Feature.FeatureListener mAudioListener = (f, sample) -> { short[] audioSample = FeatureAudioADPCM.getAudio(sample); };

In above method, the "audioSample" is Linear PCM encoded data (also decompressed), is it right?

As I need to use Google stream speech API, so how do I transform this short[] format to byte[]?

Best regards,

Boqian

GiovanniVisentiniST commented 5 years ago

Hi Boqian,

yes it the LinearPCM decopressed byte stream. to convert short to bytes you can use this class: https://github.com/STMicroelectronics-CentralLabs/STBlueMS_Android/blob/398575b3d5572cb3b7b435db5b2be6e522754037/BlueMS/src/main/java/com/st/BlueMS/demos/Audio/SpeechToText/util/BytesConverterUtil.java#L46

or something like the AudioBuffer class: https://github.com/STMicroelectronics-CentralLabs/STBlueMS_Android/blob/398575b3d5572cb3b7b435db5b2be6e522754037/BlueMS/src/main/java/com/st/BlueMS/demos/Audio/Utils/AudioBuffer.java#L91

Best regards, Giovanni

EktaRathod commented 4 years ago

Hi, I am using fp-sns-allmems2 libraby for sensiBLE device but it could not turn on the bluetooth after flashing the same code with bootloader. And no issue was there while loading fp-sns-allmems1 libraby. So if anyone has faced the same problem please help me.

Best Regards, Ekta