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

Error: not a wave file in API call #253

Open
TheMasterRoot opened this issue Aug 11, 2020 · 0 comments
Open

Error: not a wave file in API call #253

TheMasterRoot opened this issue Aug 11, 2020 · 0 comments

Comments

@TheMasterRoot
Copy link

TheMasterRoot commented Aug 11, 2020

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant