I have a PCM buffer that has to be saved as a file. The raw audio is not distorted and by playing it with the node-red-contrib-play-audio works as expected.
When I try to save it using the file node, the file saved is really distorted.
I use node-red-contrib-wav to add the wav headers.
Here a mini flow to demonstrate the issue:
[{"id":"3f882ab9.642dd6","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"5d269671.055368","type":"wav-headers","z":"3f882ab9.642dd6","name":"","action":"add","channels":1,"samplerate":"11025","bitwidth":"8","x":670,"y":120,"wires":[["dba3db72.3f0a18","5af79fed.b692b"],[]]},{"id":"dba3db72.3f0a18","type":"play audio","z":"3f882ab9.642dd6","name":"","voice":"9","x":890,"y":80,"wires":[]},{"id":"5af79fed.b692b","type":"file","z":"3f882ab9.642dd6","name":"","filename":"/tmp/test.wav","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"binary","x":890,"y":120,"wires":[[]]},{"id":"c7bdab08.cc0088","type":"inject","z":"3f882ab9.642dd6","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":120,"wires":[["8abe4665.7cb898"]]},{"id":"8abe4665.7cb898","type":"http request","z":"3f882ab9.642dd6","name":"","method":"GET","ret":"bin","paytoqs":false,"url":"http://mauvecloud.net/sounds/pcm0811m.wav","tls":"","persist":false,"proxy":"","authType":"","x":270,"y":120,"wires":[["7597b016.b33b3"]]},{"id":"7597b016.b33b3","type":"wav-headers","z":"3f882ab9.642dd6","name":"","action":"del","channels":1,"samplerate":22050,"bitwidth":16,"x":460,"y":120,"wires":[["5d269671.055368"],[]]}]