# Pico Audio Pack Support

**URL:** https://forums.pimoroni.com/t/pico-audio-pack-support/15969
**Category:** Support
**Created:** [January 23, 2021, 9:48pm UTC](https://forums.pimoroni.com/t/pico-audio-pack-support/15969 "2021-01-23T21:48:49Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![Prof](https://avatars.discourse-cdn.com/v4/letter/p/94ad74/32.png) [@Prof](https://forums.pimoroni.com/u/Prof)
#### Post date: [January 23, 2021, 9:48pm UTC](https://forums.pimoroni.com/t/pico-audio-pack-support/15969/1 "2021-01-23T21:48:49Z")

</div>

I may have missed something but I can’t find any libraries or examples for the Raspberry Pi Pico Audio pack.

The product page refers to the Pico SDK but, other than bit banging the audio into the card using DMA or manually toggling the GPIO pins I can’t see any higher level support.

Have I missed something or am I going to have to start reading up on the DMA, timer and interrupt functions and roll my own driver?

---

<div class="post-metadata">

### Author: ![Shoe](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Shoe](https://forums.pimoroni.com/u/Shoe)
#### Post date: [January 23, 2021, 11:39pm UTC](https://forums.pimoroni.com/t/pico-audio-pack-support/15969/2 "2021-01-23T23:39:36Z")

</div>

The software end of things for the Pico accessories seems a bit underbaked at the moment, I think some boards have hit the shop before the accompanying code is finished. It might be worth poking @Gadgetoid on twitter or Github to see what the deal is, the repo page says that the audio pack has a library, so he may have just forgotten to unhide it?

---

<div class="post-metadata">

### Author: ![edgeeffect](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/edgeeffect/32/4702_2.png) [@edgeeffect](https://forums.pimoroni.com/u/edgeeffect)
#### Post date: [January 24, 2021, 3:14pm UTC](https://forums.pimoroni.com/t/pico-audio-pack-support/15969/3 "2021-01-24T15:14:12Z")

</div>

[https://www.raspberrypi.org/products/raspberry-pi-pico/specifications/](https://www.raspberrypi.org/products/raspberry-pi-pico/specifications/) says that the chip comes with two I2S peripherals but can’t find any examples either at [https://github.com/pimoroni/pimoroni-pico](https://github.com/pimoroni/pimoroni-pico) or [https://github.com/raspberrypi/pico-examples](https://github.com/raspberrypi/pico-examples)

In the 2040 Datasheet there is mention of a “popcorn” media player that uses the I2S but I can’t find any other details of this.

---

<div class="post-metadata">

### Author: ![edgeeffect](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/edgeeffect/32/4702_2.png) [@edgeeffect](https://forums.pimoroni.com/u/edgeeffect)
#### Post date: [January 24, 2021, 3:30pm UTC](https://forums.pimoroni.com/t/pico-audio-pack-support/15969/4 "2021-01-24T15:30:41Z")

</div>

[https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython](https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython) says:

> You’ll note there’s no I2S peripheral… instead of having specific hardware support for serial-data-like peripherals like these, the RP2040 comes with the PIO state machine system which is a … way to create custom hardware logic and data processing blocks. … … … often we bitbang the timing-specific protocol… for the RP2040, we instead use a PIO object that reads in the data buffer and clocks out the right bitstream… Same with I2S audio in or out.

But the lack of I2S does seem to contradict [https://www.raspberrypi.org/products/raspberry-pi-pico/specifications/](https://www.raspberrypi.org/products/raspberry-pi-pico/specifications/)

And there still doesn’t seem to be any example of how to get PIO to do I2S anyway.

But there is something to at least make a start on PIO here: [https://github.com/raspberrypi/pico-examples/tree/master/pio](https://github.com/raspberrypi/pico-examples/tree/master/pio)

---

<div class="post-metadata">

### Author: ![edgeeffect](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/edgeeffect/32/4702_2.png) [@edgeeffect](https://forums.pimoroni.com/u/edgeeffect)
#### Post date: [January 24, 2021, 5:23pm UTC](https://forums.pimoroni.com/t/pico-audio-pack-support/15969/5 "2021-01-24T17:23:46Z")

</div>

In the “readme” for the SDK, it mentions:

> Additional libraries/APIs that are not yet ready for inclusion in the Pico SDK can be found in [https://github.com/raspberrypi/pico-extras](https://github.com/raspberrypi/pico-extras)

And, sure enough, here’s:  
[https://github.com/raspberrypi/pico-extras/tree/master/src/rp2\_common/pico\_audio\_i2s](https://github.com/raspberrypi/pico-extras/tree/master/src/rp2_common/pico_audio_i2s)

Still no examples… but there’s some library source to get started.

---

<div class="post-metadata">

### Author: ![Shoe](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Shoe](https://forums.pimoroni.com/u/Shoe)
#### Post date: [January 24, 2021, 6:08pm UTC](https://forums.pimoroni.com/t/pico-audio-pack-support/15969/6 "2021-01-24T18:08:11Z")

</div>

> But the lack of I2S does seem to contradict [https://www.raspberrypi.org/products/raspberry-pi-pico/specifications/](https://www.raspberrypi.org/products/raspberry-pi-pico/specifications/)

That says I2 **C** , which is not the same as I2 **S**. The RP2040 doesn’t have I2S hardware units, but it’s possible to emulate one using the Programmable IO, which is what your later links are describing.

---

<div class="post-metadata">

### Author: ![SEDur](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/sedur/32/7551_2.png) [@SEDur](https://forums.pimoroni.com/u/SEDur)
#### Post date: [January 30, 2021, 2:54pm UTC](https://forums.pimoroni.com/t/pico-audio-pack-support/15969/7 "2021-01-30T14:54:10Z")

</div>

Has anyone had any luck getting the i2s example from pico-extras working with the pico-audio?  
It certainly isn’t working for me.

Edit: Ok I managed to get a very glitchy looking sinewave out of one of the outs using the example.  
Appears the API expects you to set the GPIO number not the pin number, so its really:

```auto
#define PICO_AUDIO_I2S_DATA_PIN 9
#define PICO_AUDIO_I2S_CLOCK_PIN_BASE 10

```

The web page for the device on the pimoroni store incorrectly tells you to set them to 12 and 14 respectively.  
Now to figure out how to get stereo out before making an i2S API for humans.

---

<div class="post-metadata">

### Author: ![Bouffski](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/bouffski/32/7241_2.png) [@Bouffski](https://forums.pimoroni.com/u/Bouffski)
#### Post date: [February 19, 2021, 10:46pm UTC](https://forums.pimoroni.com/t/pico-audio-pack-support/15969/8 "2021-02-19T22:46:06Z")

</div>

as promised on the product page:  
**Please note that Pico Audio Pack only currently works with the C/C++ Pico SDK! We have Micro Python support planned but it is not available yet.**  
Any idea when this will happen?  
As a newbie to pico, and python, (and so much more) a BUMP from the heart…

---

<div class="post-metadata">

### Author: ![Grumpy\_Mike](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/grumpy_mike/32/10832_2.png) [@Grumpy\_Mike](https://forums.pimoroni.com/u/Grumpy_Mike)
#### Post date: [March 12, 2021, 9:11am UTC](https://forums.pimoroni.com/t/pico-audio-pack-support/15969/9 "2021-03-12T09:11:51Z")

</div>

> Now to figure out how to get stereo out before making an i2S API for humans.

any luck with doing that yet?

---

<div class="post-metadata">

### Author: ![SEDur](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/sedur/32/7551_2.png) [@SEDur](https://forums.pimoroni.com/u/SEDur)
#### Post date: [March 12, 2021, 10:06am UTC](https://forums.pimoroni.com/t/pico-audio-pack-support/15969/10 "2021-03-12T10:06:41Z")

</div>

Sorry Mike not yet, been dead super busy at work and i’ve not had the mental bandwidth to get round to making a friendlier lib. Defo near the top of my todo list tho!

---

<div class="post-metadata">

### Author: ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)
#### Post date: [March 31, 2021, 12:58pm UTC](https://forums.pimoroni.com/t/pico-audio-pack-support/15969/11 "2021-03-31T12:58:15Z")

</div>

Did a quick port of the I2S “sine wave” example from Pico Playground into our repository here: [Add Pico Audio Pack example for #36 by Gadgetoid · Pull Request #113 · pimoroni/pimoroni-pico · GitHub](https://github.com/pimoroni/pimoroni-pico/pull/113)

It still requires Pico Extras, though - [GitHub - raspberrypi/pico-extras](https://github.com/raspberrypi/pico-extras)

MicroPython support depends on MicroPython upstream adding some support for i2s audio, which is still very much in the taking-shape phase: [https://github.com/micropython/micropython/pull/4471](https://github.com/micropython/micropython/pull/4471) (note, the linked discussion is not about Pico, but its conclusion will set the precedent that Pico MicroPython i2s support should try and follow)

It would appear that CircuitPython already supports i2s audio on the Pico - [Playing sounds from the Raspberry Pi Pico using CircuitPython - a journey of discovery - Raspberry Pi Pod and micro:bit base](https://www.recantha.co.uk/blog/?p=20950)

---

<div class="post-metadata">

### Author: ![Grumpy\_Mike](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/grumpy_mike/32/10832_2.png) [@Grumpy\_Mike](https://forums.pimoroni.com/u/Grumpy_Mike)
#### Post date: [April 1, 2021, 5:14am UTC](https://forums.pimoroni.com/t/pico-audio-pack-support/15969/12 "2021-04-01T05:14:31Z")

</div>

Sorry I might be being a bit thick here but I can not find a file that mentions I2S in the pimoroni-pico-main download.

---

<div class="post-metadata">

### Author: ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)
#### Post date: [April 5, 2021, 9:20am UTC](https://forums.pimoroni.com/t/pico-audio-pack-support/15969/13 "2021-04-05T09:20:17Z")

</div>

It’s here - [pimoroni-pico/examples/pico\_audio at main · pimoroni/pimoroni-pico · GitHub](https://github.com/pimoroni/pimoroni-pico/tree/main/examples/pico_audio)

---

<div class="post-metadata">

### Author: ![Grumpy\_Mike](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/grumpy_mike/32/10832_2.png) [@Grumpy\_Mike](https://forums.pimoroni.com/u/Grumpy_Mike)
#### Post date: [April 5, 2021, 11:11am UTC](https://forums.pimoroni.com/t/pico-audio-pack-support/15969/14 "2021-04-05T11:11:29Z")

</div>

Thanks it is there now.  
I kept a copy of what I downloaded after your first announcement above and it wasn’t in it. Maybe it took GitHub a bit of time to serve up the new one. Off to try it, looks a step up from the Raspberry Pi one.

---

<div class="post-metadata">

### Author: ![Grumpy\_Mike](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/grumpy_mike/32/10832_2.png) [@Grumpy\_Mike](https://forums.pimoroni.com/u/Grumpy_Mike)
#### Post date: [April 7, 2021, 4:46am UTC](https://forums.pimoroni.com/t/pico-audio-pack-support/15969/15 "2021-04-07T04:46:43Z")

</div>

Sorry to be so thick again but I can’t get your code to compile. I copied the pico\_audio project and ran a cmake …  
pi@raspberrypi400:~/pico\_audio/build $ cmake … -DPICO\_SDK\_POST\_LIST\_DIRS=/home/pi/pico/pico-extras  
I got a warning saying  
“No cmake\_minimum\_required command is present”  
and another one saying  
" Manually-specified variables were not used by the project:  
PICO\_SDK\_POST\_LIST\_DIRS  
"  
Then a make commend instead of compiling did nothing.  
So I must be missing a step any idea what it is?

I used an other (modified) cmake file that I had used to run the sine\_wave program from the pico-playground. This compiled everything but fell over when it came to linking the modules.

---

<div class="post-metadata">

### Author: ![paulsk](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/paulsk/32/7590_2.png) [@paulsk](https://forums.pimoroni.com/u/paulsk)
#### Post date: [June 14, 2021, 9:32am UTC](https://forums.pimoroni.com/t/pico-audio-pack-support/15969/16 "2021-06-14T09:32:19Z")

</div>

tnx to @gadgetoid for the clarifications and the link to ‘pico\_audio’. I discovered I had that example in an installed clone of the pimoroni-pico repository. After adding to settings.json in VSCode:  
“cmake.configureSettings”: {  
“PICO\_SDK\_PATH”: “${ENV:PICO\_SDK\_PATH}”,  
“PICO\_SDK\_POST\_LIST\_DIRS”: ["${ENV:PICO\_DRV}/pico/pico-extras", “…some other path…”] },  
I was able to successfully build and flash the pico\_audio example to a RPi Pico with back-to-back connected the pico-audio pack. It made the audio working on both a little speaker and on a set of headphones for a mobile phone. Audio worked on either ‘phones’ or ‘line out’.

Btw: ${ENV:PICO\_SDK\_PATH} and ${ENV:PICO\_DRV} are environment variables that I defined in (~/.bashrc) of a MS Windows 10 WSL1/Ubuntu 20.04 session.  
paulsk
