0

on a raspberry pi i am trying to record audio with gstreamer as a .flac or .wav file.

I want the audio file to be send to the inoffical google speech api server

But my gstreamer pipeline output as a wav

 gst-launch-0.10 -e  alsasrc device=hw:1 ! audioconvert ! audioresample ! audio/x-raw-int, depth=16, rate=16000, channels=1 ! wavenc ! filesink location= o.wav

or as a flac

 gst-launch-0.10 -e  alsasrc device=hw:1 ! audioconvert ! audioresample ! audio/x-raw-int, depth=16, rate=16000, channels=1 ! flacenc ! filesink location= o.flac

get always rejected.

Error: (wrong file format or wrong samplerate)

{"status":5,"id":"11e0fa5e371b2f0a1a87def81f8383bc-1","hypotheses":[]}

Normal recording with sox and encoding with ffmpeg or flac is working so i guess the output file from gstreamer is somehow corrupted or that iam missing something

EDIT: Pipeline running with -v http://hastebin.com/vovefeyewe.vbs added a queue after alsasrc but still the same problem

SOLVED

Additional parameters solved the problem

 gst-launch-0.10 -e -v alsasrc device=hw:1 ! audioconvert ! audioresample ! "audio/x-raw-int, rate=(int)16000, channels=(int)1, endianness=(int)1234, width=(int)16, depth=(int)16, signed=(boolean)true, channles=(int)1" ! wavenc ! filesink location=g.wav

and If there is there no voice or only a random noise google will reject the file with the (wrong format error)

Jeff ck
  • 3
  • 2

1 Answers1

2

Can you add -v option in your pipeline and send the output?

martien9
  • 391
  • 2
  • 6
  • try this pipeline but I am not sure that will works. gst-launch-0.10 -e -v alsasrc device=hw:1 ! audioconvert ! audioresample ! "audio/x-raw-int, rate=(int)16000, channels=(int)1, endianness=(int)1234, width=(int)16, depth=(int)16, signed=(boolean)true, channles=(int)1" ! wavenc ! filesink location=g.wav – martien9 Oct 20 '13 at 21:42
  • It's really strange. I don't known why the pipeline doesn't works. It seems hardware problem. http://opencast.3480289.n2.nabble.com/Audio-recording-alsasrc-cant-record-audio-fast-enough-td6081621.html I have no more idea sorry – martien9 Oct 21 '13 at 07:59
  • Yay it was working. The google speech api will report "status":5 if there is no voice or too much noise. Thank You! – Jeff ck Oct 21 '13 at 08:36