Mycroft Community Forum

AIY Mic input with 3.5mm jack output?

Ok, so I have picroft up and running with the Google AIY Voice kit. The kit uses a hat with a microphone and external speaker. However, the speaker is rather small and I’d like to play music through it.
So I dug out a powered speaker that can plug into the 3.5mm jack on the pi and plugged it in. No sound, so I went through the wizard again and here are the options I’m presented with:

Welcome to Picroft.  This image is designed to make getting started with
Mycroft quick and easy.  Would you like help setting up your system?
  Y)es, I'd like the guided setup.
  N)ope, just get me a command line and get out of my way!
Choice [Y/N]: y

**** Checking for updates to Picroft environment
This might take a few minutes, please be patient...
Checking for mycroft-core updates...
=========================================================================
HARDWARE SETUP
How do you want Mycroft to output audio:
  1) Speakers via 3.5mm output (aka 'audio jack' or 'headphone jack')
  2) HDMI audio (e.g. a TV or monitor with built-in speakers)
  3) USB audio (e.g. a USB soundcard or USB mic/speaker combo)
  4) Google AIY Voice HAT and microphone board (Voice Kit v1)
  5) ReSpeaker Mic Array v2.0 (speaker plugged in to Mic board)
Choice [1-5]: 

I chose option 1 for speakers via 3.5mm, but then later, when it got to the mic setup, I could no longer select the “Google AIY Voice HAT” mic input. I only had these options:

The final step is Microphone configuration:
As a voice assistant, Mycroft needs to access a microphone to operate.
Please ensure your microphone is connected and select from the following
list of microphones:
  1) PlayStation Eye (USB)
  2) Blue Snoball ICE (USB)
  3) Matrix Voice HAT.
  4) Other USB microphone (unsupported -- good luck!)

I pored over the mycroft.conf file, but I don’t see any explicit mentions of jack, AIY or HAT that might indicate how the inputs and outputs are setup.

Any ideas on how I can use the mic from the Voice Hat, but the 3.5mm jack for output?

Thanks!

I think the AIY install disables internal audio on the Pi. So after install, setup and test you could try enabling it again.

edit /boot/config.txt and remove hastag in front of dtparam=audio=on and reboot

# Enable audio (loads snd_bcm2835)
#dtparam=audio=on

Do what @andlo said.
Also raspi-config and force audio through 3.5mm

that is pretty much what audio-setup.sh does but personally find it confuses things so remark out all the settings and just cli amixer commands with a alsactl store to make perm.
Same with /etc/pulse/default.pa where at the end you can set a default source.

Pulseaudio is source, alsa is sink mainly in Mycroft (source = mic / sink = output)
aplay -l
arecord -l
paplay
payrecord
pacmd list-cards
pacmd list-sinks
pacmd list-sources.

If you just do a check that mycroft.conf doesn’t have hardware indexes in it.

{
   "play_wav_cmdline": "aplay -Dhw:0,0 %1",
   "play_mp3_cmdline": "mpg123 -a hw:0,0 %1",
   "enclosure": {
      "platform": "picroft"
   },
   "tts": {
      "mimic": {
         "path": "/home/pi/mycroft-core/mimic/bin/mimic"
      }
   },
   "ipc_path": "/ramdisk/mycroft/ipc/"
}

Just change or remove the -Dhw:0,0 / -a hw:0,0 bit then default linux audio utils will do the rest

#!/bin/bash
# Use this script to execute audio setup actions
sudo amixer cset numid=3 "1" > /dev/null 2>&1
amixer set PCM 79% > /dev/null 2>&1
amixer set Master 79% > /dev/null 2>&1

audio-setup.sh is the same nothing bad but it can confuse so I just remark out and do it cli way with amixer then a alsactl store.

The audio setup scripts if it gets things right makes things very easy, if not it can actually confuse.

1 Like

Man, that was easy.
This is the output of “aplay -l”:

(.venv) pi@picroft:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpigooglevoi [snd_rpi_googlevoicehat_soundcar], device 0: Google voiceHAT SoundCard HiFi voicehat-codec-0 [Google voiceHAT SoundCard HiFi voicehat-codec-0]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
(.venv) pi@picroft:~ $ 

After editing the /boot/config.txt to enable the “dtparam=audio=on”, this is the output of “aplay -l”:

(.venv) pi@picroft:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 6/7
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: ALSA [bcm2835 ALSA], device 2: bcm2835 IEC958/HDMI1 [bcm2835 IEC958/HDMI1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: sndrpigooglevoi [snd_rpi_googlevoicehat_soundcar], device 0: Google voiceHAT SoundCard HiFi voicehat-codec-0 [Google voiceHAT SoundCard HiFi voicehat-codec-0]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

I wasn’t sure which .conf to edit, so I just tried it as is and it worked!

Poking around the config commands, looks like I didn’t need the -hw parameter:

(.venv) pi@picroft:~ $ mycroft-config get play_mp3_cmdline
mpg123 %1
(.venv) pi@picroft:~ $ 

Thanks for your help!