Skip to content

"Invalid 'audio_in': audio frame length is too long" on Raspberry Pi Zero #48

@albertreed

Description

@albertreed

Thanks so much for the great library. I'm running into a problem getting it working on a Raspberry Pi Zero W.

When running the mic-speaker example I'm seeing this error after it runs for a short moment. Nothing else is logged.

(With verbose:true passed into the record call)

Say something!
Recording with sample rate 16000...
Recording 65536 bytes
Recording 16384 bytes
Recording 16384 bytes
Conversation Error: { Error: 3 INVALID_ARGUMENT: Invalid 'audio_in': audio frame length is too long.
    at Object.exports.createStatusError (/home/pi/madison/gassist/node_modules/grpc/src/common.js:87:15)
    at ClientDuplexStream._emitStatusIfDone (/home/pi/madison/gassist/node_modules/grpc/src/client.js:235:26)
    at ClientDuplexStream._receiveStatus (/home/pi/madison/gassist/node_modules/grpc/src/client.js:213:8)
    at Object.onReceiveStatus (/home/pi/madison/gassist/node_modules/grpc/src/client_interceptors.js:1316:15)
    at InterceptingListener._callNext (/home/pi/madison/gassist/node_modules/grpc/src/client_interceptors.js:590:42)
    at InterceptingListener.onReceiveStatus (/home/pi/madison/gassist/node_modules/grpc/src/client_interceptors.js:640:8)
    at /home/pi/madison/gassist/node_modules/grpc/src/client_interceptors.js:1136:18
  code: 3,
  metadata: Metadata { _internal_repr: {} },
  details: 'Invalid \'audio_in\': audio frame length is too long.' }
Recording 16384 bytes
Recording 16384 bytes
Recording 4096 bytes
Recording 12288 bytes
  • I've tested the code on a mac, works fine
  • On device, aplay and arecord with no extra parameters work. I can create and playback a 16k audio file.
  • The code below successfully records an audio file that when played back is reported as: "Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono" by aplay.
var record = require('node-record-lpcm16')
var fs = require('fs')

var file = fs.createWriteStream('test.wav', { encoding: 'binary' })

const mic = record.start();
mic.on('data', data => {
	file.write(data);
})

// Stop recording after three seconds
setTimeout(function () {
  record.stop()
}, 3000)

The error implies that the recroding rate isn't correct but aside from the threshold:0, my test app records exactly the same way and the file is reported with a correct frame length. I'm assuming google's "audio frame length" is referring to the same value as "Rate" within aplay.

I'm on 0.5.1

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions