Skip to content

Assertion `pcm' failed. #9

@flatsiedatsie

Description

@flatsiedatsie

I have some users of the Voco add-on for the Mozilla WebThings Gateway, which uses NanoTTS, which are reporting a PCM error that I am unable to reproduce on my own Pi 4.

2020-05-06 21:27:36.677 ERROR : voco: error: opening pcm device failed No such file or directory
2020-05-06 21:27:36.679 ERROR : voco: nanotts: pcm.c:736: snd_pcm_stream: Assertion `pcm' failed.

(note the two different quotation marks by the way)

This is on a Pi 4. Perhaps they are using USB audio output hardware.

This is the code that calls NanoTTS:

    def speak(self, voice_message="",site_id="default"):
        try:
            # TODO add an environment variable here to set alsa to the USB output device?
            
            
            my_env = os.environ.copy()
            my_env["ALSA_CARD"] = str(self.playback_card_id)
            
            ps = subprocess.Popen(('echo', str(voice_message)), stdout=subprocess.PIPE)
            output = subprocess.check_output((str(os.path.join(self.snips_path,'nanotts')), '-l',str(os.path.join(self.snips_path,'lang')),'-v',str(self.voice),'--speed','0.9','--pitch','1.2','-p'), stdin=ps.stdout, env=my_env)
            ps.wait()
            
        except Exception as ex:
            print("Error speaking: " + str(ex))

So it could be that they are using USB audio output devices, and the environment variables aren't set properly for that case.

I noticed there was a way of compiling NanoTTS without ALSA. Would that perhaps make it more universal/robust/agnostic?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions