Start a new topic

Pi Top Speaker without X

 Hi there,

I have a Pi-Top with a Pi-Top Speaker add-on, and I'm unable to make it sound.

I understand it uses i2c to output HDMI audio. In fact, my system has the needed modules loaded:

pi@raspberrypi:~ $ lsmod
Module                  Size  Used by
evdev                  12423  0
snd_bcm2835            24427  0
snd_pcm                98501  1 snd_bcm2835
snd_timer              23904  1 snd_pcm
snd                    70032  3 snd_timer,snd_bcm2835,snd_pcm
i2c_bcm2835             7167  0
fixed                   3285  0
i2c_dev                 6913  0

I can see the device on i2c bus also:

pi@raspberrypi:~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- 0b -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- 73 -- -- -- --                        

However, "omxplayer -o hdmi <video_file>" does not produce any audio.

There's a final step I must me missing, that's not present on the github info.

I DON'T have an X enviroment or it's dependencies and never will, so please help me configure it on TTY console.

Alsamixer audio meter is at 100% too.


Try the command pt-speaker before using the speaker. The scripts set this up to run automatically when xwindows is started.
Rene: I don't have the pt-speaker command. The package containing it depends on X libraries that my system does not have and won't have.
So, what does that command do and how can I do it manually instead?
I just need the speaker to work without any X dependencies.



For more information please feel free to visit our official pi-top GitHub repository:

Thank you.

All the best,


Hi Peter,

did you get this to work in the end? If, as Alan suggests, you download and install their Python library (pi-topSPEAKER) from GitHub, and then follow the "Manual Initialisation" page's instructions on the associated wiki, that will almost get you there. Two additional points though:

1) the wiki instructions are not quite correct; they say to use:

from ptspeaker import configuration as ptspeakercfg

if ptspeakercfg.enable():
    print("Successfully enabled pi-topSPEAKER")
    print("Failed to enable pi-topSPEAKER")

but that call to enable() requires a parameter. From your i2cdetect trace, you have a single speaker set to mono mode, so use:

from ptspeaker import configuration as ptspeakercfg

if ptspeakercfg.enable("m"):
    print("Successfully enabled pi-topSPEAKER")
    print("Failed to enable pi-topSPEAKER")

 to set it up.

Then, you need to make sure audio is routed via HDMI. The call ptspeakercfg.set_audio_output_hdmi() should do this, but if that returns an error (as it does on my system when running baseline Raspbian), you can just call (from a shell):

/usr/bin/amixer -c 0 cset numid=3 2

to do this.

Once the above two things are done speaker output should work until you power cycle.

hth, sakaki

I am still struggling to get the pitop speaker to work manually.

The updated instructions on the WIKI say that the script is:


#! /usr/bin/python3
from ptspeaker import configuration as speakercfg

# The library needs to know what hardware it is running on.
# For the pi-top v2 use 4, for all other platforms use 1
host_device_type = 1 

speakercfg.initialise(host_device_type, "pi-topSPEAKER-v1"):
enabled, reboot_required, v2_hub_hdmi_to_i2s_required = speakercfg.enable_device()

if (reboot_required):
    print("Reboot required")
elif (v2_hub_hdmi_to_i2s_required):
    print("HDMI to I2S required")
elif (enabled):
    print("Successfully enabled pi-topSPEAKER")
    print("Failed to enable pi-topSPEAKER")

 Well, running that causes a python syntax error:


i@raspberrypi:~ $ 
  File "/home/pi/bin/", line 8
    speakercfg.initialise(host_device_type, "pi-topSPEAKER-v1"):
SyntaxError: invalid syntax

 So what's wrong there, please?

Also, I simplified the script to this:


#! /usr/bin/python3
from ptspeaker import configuration as speakercfg

host_device_type = 1 

speakercfg.initialise(host_device_type, "pi-topSPEAKER-v1")

 No errors reported this way, but I get no sound either :(

Hi Peter,

have you tried using the wiki script, but just with the trailing colon on line 8 deleted? Your simplified script appears to be missing the "speakercfg.enable_device()" call, which presumably is required.

Best, sakaki

@Sakaki, thanks a lot for your answer. I tried without the trailing colon. I get this:


pi@raspberrypi:~ $ topspeak
[19:33:39.549105 E] Error - unrecognised device: pi-topSPEAKER-v1
Failed to enable pi-topSPEAKER


I also looked at and it seems to have errors: in lines 228 and 229, it says "pi-topSPEAKER-v1-" instead of "pi-topSPEAKER-v1".

So I went and used


speakercfg.initialise(host_device_type, "pi-topSPEAKER-v1-")

 on my script, but then I get:


pi@raspberrypi:~ $ topspeak
Traceback (most recent call last):
  File "/home/pi/bin/topspeak", line 9, in <module>
    enabled, reboot_required, v2_hub_hdmi_to_i2s_required = speakercfg.enable_device()
  File "/usr/lib/python3/dist-packages/ptspeaker/", line 230, in enable_device
    mode_first_lower_char = mode_long[0].lower()
IndexError: string index out of range

 So these scripts are plain broken, I believe. What a mess...

Hi Peter - try using "pi-topSPEAKER-v1-m".

(I posted another message to that effect but as it had a github link in it, the board appears to have swallowed it).

Best, sakaki

@Sakaki: tried that, and now I get:


pi@raspberrypi:~ $ topspeak
[20:33:24.045948 E] Unable to verify I2S mode. [Errno 2] No such file or directory: '/usr/bin/pt-i2s'
[20:33:24.054166 I] Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/ptcommon/", line 99, in get_i2s_state
    i2s_output = _SystemCalls._get_cmd_resp([_SystemCalls.PTI2S_CMD]).splitlines()
  File "/usr/lib/python3/dist-packages/ptcommon/", line 33, in _get_cmd_resp
    resp = check_output(cmd_arr)
  File "/usr/lib/python3.5/", line 316, in check_output
  File "/usr/lib/python3.5/", line 383, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.5/", line 676, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/", line 1282, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/pt-i2s'

[20:33:24.054622 E] Unable to determine I2S mode. Current: None, Next: None
[20:33:24.117463 I] Initialising speaker (mode m)
[20:33:24.117881 I] Enabling write to pi-topSPEAKER (115)
[20:33:24.118429 I] Writing config data to pi-topSPEAKER
[20:33:24.140729 I] Disabling write to pi-topSPEAKER (115)
Successfully enabled pi-topSPEAKER


Well that's some progress anyway ^-^ Do you get sound now? If not try (from a shell prompt)


/usr/bin/amixer -c 0 cset numid=3 2

to route HDMI output to the speaker.

Otherwise you may need the /usr/bin/pt-i2s software installed?

Best, sakaki


I assume you are using:

  • a version 1 Pi-Top (no sliding keyboard)
  • a mk1 Pi-Top speaker, with the switch set to 'm'
If that's so, the caught exception due to the missing pt-i2s software you report is probably not going to stop the thing working (it does appear to go on to configure the speaker over I2C, and finishes by reporting "Successfully enabled pi-topSPEAKER").

If that's the case, and you select HDMI output using
/usr/bin/amixer -c 0 cset numid=3 2

 and ensure the output volume is non-zero, you may be able to get some output sound...

@Sakaki: I have got it working with the BCRM graphics stack, but I need it to work with the VC4 overlay, which is what I use. What parameters should I use on the amixer command line to get it working on the VC4 overlay, please?

Login or Signup to post a comment