node-red / node-red-ui-nodes

Additional nodes for Node-RED Dashboard
Apache License 2.0
122 stars 83 forks source link

Microphone Wave File Is Sped Up #56

Closed vindicatorr closed 3 years ago

vindicatorr commented 3 years ago

Which node are you reporting an issue on?

node-red-node-ui-microphone 0.3.0

What are the steps to reproduce?

[{"id":"e86c4f38.00efa","type":"ui_microphone","z":"a044eef.753a11","name":"","group":"cd923f52.e02b8","order":0,"width":0,"height":0,"maxLength":5,"maxRecogLength":5,"timeslice":0,"press":"press","mode":"audio","interimResults":false,"x":120,"y":340,"wires":[["9776afc5.4285d"]]},{"id":"9776afc5.4285d","type":"file","z":"a044eef.753a11","name":"","filename":"/tmp/test_nr.wav","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"binary","x":410,"y":360,"wires":[[]]},{"id":"cd923f52.e02b8","type":"ui_group","name":"Default1","tab":"e1a13391.f73d2","order":1,"disp":true,"width":"6","collapse":false},{"id":"e1a13391.f73d2","type":"ui_tab","name":"Home1","icon":"dashboard","disabled":false,"hidden":false}]
$ ffplay -v trace -i /tmp/test_nr.wav

What happens?

Audio is sped up making it sound like a chipmunk.

What do you expect to happen?

Normal speed playback.

Please tell us about your environment:

Compare it with:

$ pacat -r -v --rate=44100 --file-format=wav --format=s16le --channels=1 /tmp/test_pacat.wav
$ ffplay -v trace -i /tmp/test_pacat.wav

I chose the 44100 hz rate since your js shows that hardcoded, but I'm actually using 16000 hz since the deepspeech requires that format, and I just exec ffmpeg to convert it. But that's unrelated. What I showed above will ideally cause the issue for you as well, in addition to having a good audio file (pacat) to compare it with.

dceejay commented 3 years ago

just leave the file out set to default rather than trying to force binary... I don't know why but it generally just works much better when set to default.

[{"id":"e86c4f38.00efa","type":"ui_microphone","z":"78444ab3.45a654","name":"","group":"cd923f52.e02b8","order":0,"width":0,"height":0,"maxLength":5,"maxRecogLength":5,"timeslice":0,"press":"press","mode":"audio","interimResults":false,"x":170,"y":3700,"wires":[["9776afc5.4285d"]]},{"id":"9776afc5.4285d","type":"file","z":"78444ab3.45a654","name":"","filename":"/tmp/test_nr.wav","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":460,"y":3720,"wires":[[]]},{"id":"cd923f52.e02b8","type":"ui_group","name":"Default1","tab":"e1a13391.f73d2","order":1,"disp":true,"width":"6","collapse":false},{"id":"e1a13391.f73d2","type":"ui_tab","name":"Home1","icon":"dashboard","disabled":false,"hidden":false}]
vindicatorr commented 3 years ago

HA! You're right. What an odd thing. Thanks.