PiCroft with I2S Audio?


#1

Hi there,
I’m planning on building a PiCroft powered “smart radio” using an old radio. I’d like to output the sound using an I2S DAC/Amplifier combo like this one: https://www.adafruit.com/product/3006

Has anybody used something like this before? :slight_smile:

All the best,
Moritz


#2

That sounds like a fun project and could be made :slight_smile:

I only have experiance whith google voicehat, but if the adafruit thing is working on the pi I cant see why it couldnt work on a pi whith mycroft installed.
The Picroft image is basicly a raspbian strech installation whith mycroft preeinstalled and a script helping you to get started.
So I would revomend installing picroftimage, and then the adafruit and get that to work by changeing relevant alsa and config settings when you get sound out and in by testng whith aplay and arecord mycroft should work to.


#3

Hi @schmolmo,
I haven’t used that exact breakout board before but I have used an I2C DAC with picroft and hooked that to a separate amplifier. I did consider using the one you mentioned but I already had this other one on hand. The small purple board in top left of the attached image is the I2C DAC that I used. From memory it doesn’t take too much configuration to get it going.


#4

Great, I’ll try that. Thanks!


#5

Hey there,

I’ve just started messing around with the I2S chip and the PS3 Eye Mic and can’t get it working :confused:
I’ve set the I2S up using `this tutorial. The soudn playback in the setup wizard is working, but when I get to the Mic test, I receive this:
Playing WAVE ‘/tmp/test.wav’ : Signed 16 bit Little Endian, Rate 16000 Hz, Mono
aplay: set_params:1305: Channels count non available
An error occured while playing back audio (1)

Any ideas?

all the best, schmolmo


#6

I’ve had similar problems, that I’ve yet to solve. If I attempt to record with arecord with format of S16_LE I get a wav file, but the contents are all 0. If I use arecord but with a format of S32_LE I get good sound data. I notice that doing the mycroft_mic_test the audio file (which has the right number of bytes but they’re all null bytes) the format is S16_LE which might be the problem I’ve encountered using the adafruit I2S microphone.

I don’t know if there is anyway to tell it to use the S32_LE format for recording, but if there’s another solution someone has found I’m happy to try it.


#8

@schmolmo - It’s possible to set the listener channels manually using mycroft.conf

Here’s a fairly long example configuration but roughly half way down you’ll see the “listener” attributes can be set with:

"listener": {
    "channels": 1
}

#9

It’s easy to set the format of playback via mycroft.conf but I don’t think we have support for different recording formats. Let me see what I can dig up…

So, have talked to Ake and he’s confirmed that the mic format comes directly from the Microphone base class in the python package we use. It should be possible to override this, however no one has tried this so big disclaimer - editing source code can break things…

If you wanted to do this and don’t mind breaking Mycroft if it doesn’t work, try adding the following after the init method of that super class:

self.format = self.pyaudio_module.paInt32
self.SAMPLE_WIDTH = self.pyaudio_module.get_sample_size(self.format) # size of each sample

#10

Thanks for the reply, we’ve decided to use a different audio approach and it’s working much better. We’re using the SeeeStudio Mic Array and it’s much better than the previous I2S. Recently got the websocket monitoring the MyCroft messages to integrate the light ring on the Mic Array card and it works and looks great.

Keep up the good work!!