To be honest, it doesn’t sound like something that should be very complicated, but it is. These days, with pulseaudio, you can usually have your sound system set up for you right out of the box. When you are using Linux that is expanded on your Android phone however, things tend to get a little bit complicated.

First, the stats:
Omnirom (equivalent to Android 4.4.4)
Debian Jessie 8.1
Samsung Captivate Glide

For some reason, to which I am still trying to figure out, dbus has some serious issues with Android. Pulseaudio appears to rely on dbus. Hence, no dbus, no pulseaudio. I have installed dbus, but it doesn’t appear to be doing the job it is supposed to do. Looking for a shorter route to working sound, I simply installed all of the Alsa tools.

$ sudo apt-get install alsa-base alsa-tools alsa-tools-gui alsa-utils alsaplayer-alsa alsaplayer-text

Per the Debian wiki, I needed to run the init to get it all configured.

$ sudo alsactl init

And presto! I have sound working, right? Well, not quite. I now had two distinct problems:
#1 – Sound only works for the root user.
#2 – Sound works once, then turns off after playing the sound.

As for the first problem, that is fairly standard and should be easily overcome. I added my user to the audio group, which should give me access to play sounds.

$ sudo adduser trondroid audio

Unfortunately, while adding me to group 29, the audio group, it did not give me permissions for sound. So I added my user to pulse, then pulse-access, etc. Each time, you need to log out and back in, of course to get the new group permissions. Finally, I added my user to root, but still no luck. I can only play sounds as the root user, or with the sudo command. So sudo it is.

As for the second problem, I haven’t figured that out yet either. I was using mocp, a command line media player, to play an mp3 song. No sound came out. When I open up the alsamixer, however, I can adjust the playback to an output, like the headphones, or the speakers. Once I do that, the sound plays. After I quit mocp, though, and try to play some other sound, once again it doesn’t play. I believe that this is Android’s fault. I think that the Android system is trying to conserve power or maintain control by shutting down “rogue” sound systems that are on by muting the outputs when not actually in use. This is probably a great feature for a phone, but is murder on my Linux setup.

Currently, to use the sound natively through Linux, I now have to sudo alsamixer to or sudo alsactl to set the sound device to the appropriate volume and make it ready for playback, I then need to immediately start my sound program with the sudo command to ensure that I have permission to play it. Fortunately, there are such things as scripts, so I can simply set it up and forget about it. Ultimately I plan to figure this out, I just need to take it one step at a time. Right now I’m just glad that I can make the sound work at all!

Linux – keep it simple.

Leave a Reply

Your email address will not be published. Required fields are marked *