Problems with audio_record


Trying audio_record skill. In the first test, the resulting record contained only silence. Looking at the mycroft internals, the command used to record sound seems to be “arecord …” without any indication of the sound card to be used.

As temporary patch (it should be configurable) a change in file “mycroft/util/”, method “record”, is done to select the correct sound card:

def record(file_path, duration, rate, channels):
    if duration > 0:
        return subprocess.Popen(
            ["arecord", "-r", str(rate), "-c", str(channels), "-d",
             str(duration), "-f", "S16_LE", "-D", "hw:2,0", file_path])
        return subprocess.Popen(
            ["arecord", "-r", str(rate), "-c", str(channels), "-f", "S16_LE", "-D", "hw:2,0", file_path])

with this change, the skill triggers the command:

/usr/bin/arecord "-r" "16000" "-c" "1" "-d" "30" "-f" "S16_LE" "-D" "hw:2,0" "/tmp/mycroft-recording.wav"

that, when started manually, it does correctly the record.

However, when started from mycroft skill, the command fails with message “audio card already in use”. Something that seems logic, because the audio card is, probably, being used by mycroft itself.

What I’m doing wrong?


Temporally solved using “snd-aloop” and gstreamer.