Skip to content
This repository was archived by the owner on Aug 30, 2020. It is now read-only.
This repository was archived by the owner on Aug 30, 2020. It is now read-only.

Error: not a wave file in API call #253

@TheMasterRoot

Description

@TheMasterRoot

im trying to use speech-to-intent api but im getting this error:

root@raspbx:/var/lib/asterisk/agi-bin# ./speech_cmd.py have-a-good-weekend.wav

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3240  100    22  100  3218    186  27271 --:--:-- --:--:-- --:--:-- 27457
Error: not a WAVE file

i have the following code:

#!/usr/bin/python3
import sys
sys.dont_write_bytecode = True
import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument('fileName', type=str, help='Nome do audio a ser identificado')
args = vars(parser.parse_args())

fileName = args['fileName']
if fileName:
	#print(fileName)
	#sys.exit(0)
	ret = os.popen("sox /var/spool/stt/"+fileName+" -L -e signed-integer -c 1 -r 16000 -b 16 /var/spool/stt/sox_"+fileName+"").read()
	print(ret)
	#content = os.popen("cat /var/spool/stt/"+fileName).read()
	output = os.popen("curl -X POST 'http://192.168.240.215:12101/api/speech-to-intent' -H 'accept: application/json' -H 'Content-Type: audio/wav' -d '@/var/spool/stt/sox_"+fileName+"'").read()
	print(output)

i dont know what is the problem. becouse this same audio file that is generated by sox works in audio upload in rhasspy panel and rhasspi api test

in command line with other file in getting it:

root@raspbx:/var/spool/stt# curl -X POST "http://192.168.240.215:12101/api/speech-to-intent?nohass=true&outputFormat=rhasspy" -H "accept: application/json" -H "Content-Type: audio/wav" -d "./@teste.wav"
Error: file does not start with RIFF id

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions