Thursday, 18 May 2017

Wrong inputTranscript in the lex response

I am trying to test amazon web node api sdk for lex for audio input and output and successfully configured it, but when I test it, it sends me garbage inputTranscript(like "yeah", "oh no", "um yeah", etc.) in response.

The request parameters are as below,

var params = {
        botAlias: 'Test', /* required */
        botName: 'Revert', /* required */
        contentType: 'audio/l16; rate=16000; channels=1', /* required */    
        inputStream: <Buffer 52 49 46 46 80 55 02 00 57 41 56 45 66 6d 74 20 10 00 00 00 01 00 02 00 80 3e 00 00 00 7d 00 00 04 00 10 00 64 61 74 61 54 55 02 00 00 00 00 00 00 00 ... >, /* required */
        userId: '12321', /* required */
        accept: 'audio/*',
        sessionAttributes: {"firstName": "Joe"} 

};

The response I am getting as below,

{ contentType: 'audio/mpeg',
  sessionAttributes: { firstName: 'Joe' },
  message: 'Sorry No Match',
  dialogState: 'ElicitIntent',
  inputTranscript: 'yeah',
  audioStream: <Buffer 49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00 00 0f 00 00 03 4c 61 76 66 35 37 2e 35 36 2e 31 30 31 00 00 00 00 00 00 00 00 00 00 00 ff f3 60 c4 00 ... > }

For voice recording I am using my laptop inbuilt mic and RecordRTC api as,

recorder = RecordRTC(microphone, {
            type: 'audio',
            recorderType: StereoAudioRecorder,
            desiredSampRate: 16000
        });

The recorded voice is encoded into base64 and sent to node server where it is decoded back and sent to lex api in buffer format.



via Satys

No comments:

Post a Comment