speech-command playRawAudio plays blank audio

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js): No
  • OS Platform and Distribution: Windows10
  • TensorFlow.js installed from: npm
  • TensorFlow.js version: 3.2.0
  • speech-command version: 0.5.2
  • Browser version: Version 88.0.4324.192 (Official Build) (x86_64)

Describe the current behavior
I’m trying to use playRawAudio method by providing RawAudioData object. Float32Array as data and sampleRateHz:44100.

There’s an audio playing with the same duration of data, but the audio is blank (no audio)

I provided Float32Array array from SpeechCommandRecognizerResult.spectrogram.data in listen function, then concatenated the array using concatenateFloat32Arrays util function

Describe the expected behavior
Expected to play the correct audio, not a blank audio.

Standalone code to reproduce the issue
Example in Codesandbox

1 possible answer(s) on “speech-command playRawAudio plays blank audio

  1. If you have a transferRecognizer with collectExample({includeRawAudio = true}). And then get the rawAudio from tranferRecognizer.getExamples()[0].example.rawAudio.

    If you just want a generic solution, you need to implement your own.