# Speaker phat help

**URL:** <https://forums.pimoroni.com/t/speaker-phat-help/4166>\
**Category:** Support\
**Created:** [March 5, 2017, 11:50am UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166 "2017-03-05T11:50:21Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidclancy](https://avatars.discourse-cdn.com/v4/letter/d/71c47a/32.png) [@davidclancy](https://forums.pimoroni.com/u/davidclancy)\
**Post date:** [March 5, 2017, 11:50am UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/1 "2017-03-05T11:50:21Z")

</div>

trying to get this to work how do I play music through the speaker phat

---

<div class="post-metadata">

**Author:** ![sandyjmacdonald](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/sandyjmacdonald/32/393_2.png) [@sandyjmacdonald](https://forums.pimoroni.com/u/sandyjmacdonald)\
**Post date:** [March 5, 2017, 9:45pm UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/2 "2017-03-05T21:45:15Z")

</div>

Hi David. Have you tried our one-line installer? There are some details in GitHub repo. readme file here -\> [https://github.com/pimoroni/speaker-phat](https://github.com/pimoroni/speaker-phat)

Let us know how you get on!

---

<div class="post-metadata">

**Author:** ![davidclancy](https://avatars.discourse-cdn.com/v4/letter/d/71c47a/32.png) [@davidclancy](https://forums.pimoroni.com/u/davidclancy)\
**Post date:** [March 6, 2017, 5:56am UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/3 "2017-03-06T05:56:07Z")

</div>

Hi thanks for the reply. I have installed the software ok but r forgive my ignorance but what do I do next to play music. As you may have guessed that am pretty new at this just need a few step by steps please.

---

<div class="post-metadata">

**Author:** ![sandyjmacdonald](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/sandyjmacdonald/32/393_2.png) [@sandyjmacdonald](https://forums.pimoroni.com/u/sandyjmacdonald)\
**Post date:** [March 6, 2017, 10:42am UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/4 "2017-03-06T10:42:27Z")

</div>

What sort of music do you want to play? There are loads of choices. Probably the easiest is just to use YouTube, or YouTube playlists through the Chromium browser in Raspbian. If you’re on a Pi Zero, you might struggle a little with this as the weight of Chromium can cause the Zero to struggle a bit, although a Pi 2 or Pi 3 should give much better performance.

If you have an iPhone, we’ve just published a tutorial on how to stream music to your Pi (using a Speaker pHAT, pHAT BEAT, pHAT DAC, or just the built-in audio) using AirPlay - [https://learn.pimoroni.com/tutorial/sandyj/streaming-airplay-to-your-pi](https://learn.pimoroni.com/tutorial/sandyj/streaming-airplay-to-your-pi)

We should have a tutorial coming in the next few days on how to set up something called Mopidy, which has a bunch of plugins that let you do things like stream music from Spotify, Soundcloud, Google Music, internet radio, or just local mp3 files and such.

Hope that helps a little.

---

<div class="post-metadata">

**Author:** ![davidclancy](https://avatars.discourse-cdn.com/v4/letter/d/71c47a/32.png) [@davidclancy](https://forums.pimoroni.com/u/davidclancy)\
**Post date:** [March 6, 2017, 5:37pm UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/5 "2017-03-06T17:37:36Z")

</div>

Got the sound working on the speaker Phat but no led,s any ideas

---

<div class="post-metadata">

**Author:** ![RogueM](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/roguem/32/311_2.png) [@RogueM](https://forums.pimoroni.com/u/RogueM)\
**Post date:** [March 6, 2017, 6:08pm UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/6 "2017-03-06T18:08:15Z")

</div>

what are you using to play music back, airplay? is this on Raspbian Jessie Lite or full Pixel?

---

<div class="post-metadata">

**Author:** ![pi2003](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/pi2003/32/1613_2.png) [@pi2003](https://forums.pimoroni.com/u/pi2003)\
**Post date:** [March 6, 2017, 8:48pm UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/7 "2017-03-06T20:48:49Z")

</div>

If you are doing airplay then I can’t get the leds going either and let me tell you I have been on a bit of a journey with rogue to get to that stage. My theory is that is something to do with i2c (as rogue has apa102s working fine (which run of a different protocol) ) and being unable to use it when connected ( my evidence for this is that when I change the vu output to a scroll phat hd, which uses i2c, I can not get that showing anything through airplay but works fine as a vu meter through mp3s. As I say I am no expert but that is the conclusion I have come to.

---

<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 7, 2017, 11:21am UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/8 "2017-03-07T11:21:04Z")

</div>

`i2c` permissions are handled by a different group than `gpio` I believe, which would certainly cause that problem.

One, probably overly-permissive, solution to giving PiVUMeter i2c access is to set up the `/etc/udev/rules.d/60-i2c.rules` file as documented in the top of this gist: [https://gist.github.com/Gadgetoid/375f9dc0089f8518262dffb5179a56f7](https://gist.github.com/Gadgetoid/375f9dc0089f8518262dffb5179a56f7)

```auto
KERNEL=="i2c-1", GROUP="i2C", MODE="0777"

```

The rest of the gist is irrelevant, ignore it!

Edit: I’m tentatively working on a Client/Server implementation of Pi VU Meter that hands the actual GPIO access off to another process to avoid all of these user context problems. Other suggestions welcome :D ALSA turned out to be more painful than I’d expected.

---

<div class="post-metadata">

**Author:** ![RogueM](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/roguem/32/311_2.png) [@RogueM](https://forums.pimoroni.com/u/RogueM)\
**Post date:** [March 7, 2017, 12:25pm UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/9 "2017-03-07T12:25:07Z")

</div>

I don’t think that the issues from last week are due to user-context personally. I think there was a number of issues with sample rate handling, which I believe are in control now, that could well have cured other seemingly unrelated VU issues.

… I would encourage whoever has not ran the `speakerphat` installer in the last 24 hours to do so, and see if things have improved in their particular environment.

I’m also about to set up a full Raspbian Pixel to see what evil lurks in the background and may (still) cause problem… pretty icons don’t make a desktop experience necessary great ;-)

---

<div class="post-metadata">

**Author:** ![frakman1](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/frakman1/32/2374_2.png) [@frakman1](https://forums.pimoroni.com/u/frakman1)\
**Post date:** [May 11, 2017, 1:21am UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/10 "2017-05-11T01:21:08Z")

</div>

I can’t get the LEDs to work when used in AirPlay mode.  
I tired the 60-i2c.rules tip but that didn’t work either.  
I am using it on PiZero-W. Latest Jessie Build  
$uname -a  
Linux raspberrypi 4.4.50+ #970 Mon Feb 20 19:12:50 GMT 2017 armv6l GNU/Linux

---

<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:** [May 11, 2017, 1:22pm UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/11 "2017-05-11T13:22:18Z")

</div>

The client/server implementation I was working on above has come a long way since then, but it’s still very much in development and there’s not much in the way of documentation for getting it up and running.

If you’re comfortable cloning the `devel` branch from GitHub and making a config tweak, you should check it out: [https://github.com/pimoroni/pivumeter/tree/devel/python\_server](https://github.com/pimoroni/pivumeter/tree/devel/python_server)

---

<div class="post-metadata">

**Author:** ![frakman1](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/frakman1/32/2374_2.png) [@frakman1](https://forums.pimoroni.com/u/frakman1)\
**Post date:** [May 11, 2017, 3:23pm UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/12 "2017-05-11T15:23:42Z")

</div>

Thank you. I just did.

```
git clone https://github.com/pimoroni/pivumeter.git
cd pivumeter/
git checkout devel
./setup.sh
sudo nano /etc/asound.conf #change output-device from speaker-phat to socket

```

Unfortunately, this did not work. Not only that, but it broke the existing LED lights functionality so that even locally played files don’t work. Opening an mp3 using vlc displays this error during startup:

> [b4100e08] core input debug: `file:///home/pi/music/VPPP.mp3’ successfully opened  
> [b4100e08] core input debug: Buffering 0%  
> [b4100e08] core input debug: Buffering 8%  
> [b3c034d8] mpeg\_audio decoder debug: MPGA channels:2 samplerate:44100 bitrate:192  
> [002dd178] core playlist debug: reusing audio output  
> [b4100e08] core input debug: Buffering 17%  
> [b4100e08] core input debug: Buffering 26%  
> [b4100e08] core input debug: Buffering 34%  
> [b4100e08] core input debug: Buffering 43%  
> [b4100e08] core input debug: Buffering 52%  
> [b4100e08] core input debug: Buffering 60%  
> [b4100e08] core input debug: Buffering 69%  
> [b4100e08] core input debug: Buffering 78%  
> [b4100e08] core input debug: Buffering 87%  
> [b4100e08] core input debug: Buffering 95%  
> [b4100e08] core input debug: Stream buffering done (313 ms in 43 ms)  
> Using device: socket  
> connect() failed  
> [001fc3f0] alsa audio output debug: using ALSA device: default  
> [001fc3f0] alsa audio output debug: Plug PCM: Meter PCM  
> Slave: Soft volume PCM  
> Control: PCM  
> min\_dB: -51  
> max\_dB: 0  
> resolution: 256  
> Slave: Direct Stream Mixing PCM  
> Hardware PCM card 0 ‘snd\_rpi\_hifiberry\_dac’ device 0 subdevice 0  
> Its setup is:  
> stream : PLAYBACK  
> access : MMAP\_INTERLEAVED  
> format : S16\_LE  
> subformat : STD  
> channels : 2  
> rate : 48000  
> exact rate : 48000 (48000/1)  
> msbits : 16  
> buffer\_size : 8192  
> period\_size : 1024  
> period\_time : 21333  
> tstamp\_mode : ENABLE  
> period\_step : 1  
> avail\_min : 1024  
> period\_event : 0  
> start\_threshold : 1  
> stop\_threshold : 1073741824  
> silence\_threshold: 0  
> silence\_size : 1073741824  
> boundary : 1073741824  
> appl\_ptr : 0  
> hw\_ptr : 0  
> [001fc3f0] alsa audio output debug: device name :  
> [001fc3f0] alsa audio output debug: device ID : HifiBerry DAC HiFi pcm5102a-hifi-0  
> [001fc3f0] alsa audio output debug: subdevice name: subdevice #0  
> [001fc3f0] alsa audio output debug: initial hardware setup:  
> ACCESS: MMAP\_INTERLEAVED MMAP\_NONINTERLEAVED MMAP\_COMPLEX RW\_INTERLEAVED RW\_NONINTERLEAVED  
> FORMAT: S8 U8 S16\_LE S16\_BE U16\_LE U16\_BE S24\_LE S24\_BE U24\_LE U24\_BE S32\_LE S32\_BE U32\_LE U32\_BE FLOAT\_LE FLOAT\_BE FLOAT64\_LE FLOAT64\_BE MU\_LAW A\_LAW IMA\_ADPCM S24\_3LE S24\_3BE U24\_3LE U24\_3BE S20\_3LE S20\_3BE U20\_3LE U20\_3BE S18\_3LE S18\_3BE U18\_3LE U18\_3BE  
> SUBFORMAT: STD

---

<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:** [May 11, 2017, 3:31pm UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/13 "2017-05-11T15:31:29Z")

</div>

You need to also run the relevant Python code/library for the ALSA plugin to connect to.

Drop into “python\_server/library” and run:

```auto
sudo python setup.py install

```

Then go to the “examples” folder and try: `./speakerphat-server.py`

---

<div class="post-metadata">

**Author:** ![frakman1](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/frakman1/32/2374_2.png) [@frakman1](https://forums.pimoroni.com/u/frakman1)\
**Post date:** [May 11, 2017, 9:30pm UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/14 "2017-05-11T21:30:31Z")

</div>

Thank you. I ran those commands. When I run the speakerphat-server in the background (`./speakerphat-server.py &`), and then run VLC to play a local file, it seems to see the ‘socket’ device and works normally. However, AirPlay still doesn’t light the LEDs when I play from my iPhone so I am back where I started. Am I missing something?

---

<div class="post-metadata">

**Author:** ![RogueM](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/roguem/32/311_2.png) [@RogueM](https://forums.pimoroni.com/u/RogueM)\
**Post date:** [May 12, 2017, 11:38am UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/15 "2017-05-12T11:38:26Z")

</div>

does adding user `shairport-sync` to the `i2c` group help? well, I am assuming you are using shairport-sync. If so, how did you install it, from source or via our convenience installer?

---

<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:** [May 12, 2017, 12:52pm UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/16 "2017-05-12T12:52:07Z")

</div>

Tested here for sanity’s sake- I can get AirPlay lighting the LEDs using this setup. But you must make sure `speakerphat-server.py` is running at all times. I plan to rewrite it into a daemon at some point so it can be customised and installed properly and become one less thing to worry about.

You may need to pause/resume audio to ensure ALSA connects to `speakerphat-server.py` if you’ve just fired it up.

---

<div class="post-metadata">

**Author:** ![frakman1](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/frakman1/32/2374_2.png) [@frakman1](https://forums.pimoroni.com/u/frakman1)\
**Post date:** [May 12, 2017, 2:35pm UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/17 "2017-05-12T14:35:18Z")

</div>

@RogueM.  
I am not sure what shairport-sync is. All I did was install the convenience installer:  
`curl https://get.pimoroni.com/airdac | bash`  
In any case, I checked and shairport-sync is already in the i2c user group:

> $ groups shairport-sync  
> shairport-sync : shairport-sync audio i2c

@gadgetoid.  
I don’t see how your setup would be different than mine. I simply installed Jessie (2017-04-10-raspbian-jessie) from scratch, ran the convenience installer, then added the steps you outlined above. I am also running speakerphat-server.py in the background with the `&` operator

I’ve tried starting and stopping, connecting and reconnecting several times but the result is always the same. I can get audio via AirPlay but no LEDs light up unless it is a local file/stream on the pi zero.

I am using a Pi Zero Wireless if that makes a difference.

Incidentally, your instructions above about making a change to the 60-i2c.rules, has the “GROUP” set to “i2C” with an uppercase ‘C’. Is that right? On my pi, when I type “groups”, I see “i2c” with a lowercase ‘c’. In any case, I changed that line to use the lowercase “i2”, rebooted, and reran the python server script “speakerphat-server.py” in the background but no change.

---

<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:** [May 15, 2017, 4:23pm UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/18 "2017-05-15T16:23:43Z")

</div>

I think the trouble is that I was testing on a lightning quick Pi 3, versus you testing on a Pi Zero. I ran into problems getting lights to show up on the Pi 3, and within the output of `./speakerphat-server.py` (or in my case it was `./phatbeat-server.py`) I was seeing `Client connected` and then `Client disconnected` before any audio started playing.

You might be having the same problem. I’ve pushed up a fix for it: [https://github.com/pimoroni/pivumeter/commit/cf95c8b7b1d53124b1dea8afd231c9ea4ad0a62c](https://github.com/pimoroni/pivumeter/commit/cf95c8b7b1d53124b1dea8afd231c9ea4ad0a62c)

Try running a `git pull` then re-running `sudo python ./setup.py` install in the library dir.

---

<div class="post-metadata">

**Author:** ![frakman1](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/frakman1/32/2374_2.png) [@frakman1](https://forums.pimoroni.com/u/frakman1)\
**Post date:** [May 15, 2017, 4:50pm UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/19 "2017-05-15T16:50:46Z")

</div>

Can you please clarify your post on March 7th.  
Is `GROUP` in `/etc/udev/rules.d/60-i2c.rules` supposed to be `i2C` or `i2c` ?

---

<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:** [May 15, 2017, 5:04pm UTC](https://forums.pimoroni.com/t/speaker-phat-help/4166/20 "2017-05-15T17:04:17Z")

</div>

It doesn’t matter for Pi VU Meter’s “socket” interface, it doesn’t use i2c directly at all, so those rules wont make any difference. Still it’s most probably supposed to be `i2c` and the uppercase c would be a typo

[Next page](https://forums.pimoroni.com/t/speaker-phat-help/4166.md?page=2)
