esp-adf icon indicating copy to clipboard operation
esp-adf copied to clipboard

关于lyrat_mini无法使用google-sr (AUD-4305)

Open HongYan12345 opened this issue 3 years ago • 6 comments

我使用lyrat-mini在调用例子中的google-traslate时发现google-sr无法调用,google-tts没有问题,但是google-sr调用后返回的是空值 image api调用成功了但是并没有值在里面

HongYan12345 avatar Dec 26 '22 11:12 HongYan12345

@HongYan12345 您看下服务端是否参数发生了变化导致请求无效?

jason-mao avatar Jan 09 '23 07:01 jason-mao

@HongYan12345 您看下服务端是否参数发生了变化导致请求无效?

@jason-mao 我用v4.3执行一样的代码就没有任何问题,返回空的原因是没有声音录进去

HongYan12345 avatar Jan 09 '23 09:01 HongYan12345

Hi! Were you able to solve this? I have the same issue :(

PrathamG avatar Dec 20 '23 15:12 PrathamG

Hi @PrathamG Please refer to Issue 939

shootao avatar Dec 21 '23 14:12 shootao

Hi @shootao , I tried with the patch, but still getting the same result :(

I (73258) GOOGLE_SR: Got HTTP Response = { "totalBilledTime": "3s", "requestId": "1085991790643842495" }

PrathamG avatar Jan 24 '24 07:01 PrathamG

Solved! After going through the sdcard recording example, I realized the I2S configuration is different for this board.

For LyraT-Mini I had to change the following in google_sr.c, function google_sr_init(google_sr_config_t *config):

Replace this part:

    i2s_stream_cfg_t i2s_cfg = I2S_STREAM_CFG_DEFAULT();
    i2s_cfg.type = AUDIO_STREAM_READER;
    sr->i2s_reader = i2s_stream_init(&i2s_cfg);

with this:

    i2s_stream_cfg_t i2s_cfg = I2S_STREAM_CFG_DEFAULT();
    i2s_cfg.type = AUDIO_STREAM_READER;
    i2s_cfg.i2s_port = 1;
    i2s_cfg.i2s_config.channel_format = I2S_CHANNEL_FMT_ONLY_RIGHT;
    sr->i2s_reader = i2s_stream_init(&i2s_cfg);

google-sr gives a proper response now:

I (31408) GOOGLE_SR: Got HTTP Response = { "results": [ { "alternatives": [ { "transcript": "hello hello hello how are you hello", "confidence": 0.93190706 } ], "resultEndTime": "2.890s", "languageCode": "en-us" } ], "totalBilledTime": "3s", "requestId": "1111744560565211375" }

PrathamG avatar Feb 02 '24 10:02 PrathamG