Home

Recent notes

Tue 2019-12-31 20:57

  • Posted:
  • Edited:

I've used PulseAudio on many Linux laptops and workstations over the years, and it usually works so well, so consistently that I've never felt the need to dig around under the covers. It was basically this magical software that I installed and my computer had sound.

Over the holiday break, I had some spare time to tinker and I thought it might be nice to finally put together some kind of audio streaming solution for the apartment. Sort of a "whole house audio" system - without the wiring. I setup a music server running MPD on an older Intel NUC I had sitting in my parts drawer, and NFS-mounted my music library from the NAS. Then I enlisted a couple of old Raspberry Pi 2B's I had sitting around collecting dust, added a USB WiFi adapter to each, and made them my audio receivers to connect to speakers.

The question then was, how to get music from the MPD server to the RPis?

It turns out the answer was pretty simple and - as you've probably guessed already - it involved PulseAudio. Did you know that PulseAudio has a network transport? I didn't. It was time for me to learn some new stuff about an old tool.

First off, because no one would be logged into a desktop session on these devices I had to set PulseAudio on the music server and the RPis to run in system mode. Some tweaking was involved to accomplish this (see the linked docs) and all of the config lines I used below go in /etc/pulse/system.pa rather than /etc/pulse/default.pa.

For strangers to the innards of PulseAudio, first grasp the basic concept that PulseAudio defines inputs and outputs as "sources" and "sinks". My first step was to create a new fake sink (a "null" sink) to receive the system audio, and transport the audio sent to that null sink (captured by the "monitor" of that sink) via RTP stream to my RPis.

On the server:


load-module module-null-sink sink_name=rtp 
load-module module-rtp-send source=rtp.monitor mtu=1408 destination_ip=[remote IP 1] 
load-module module-rtp-send source=rtp.monitor mtu=1408 destination_ip=[remote IP 2]

On the RPis:


load-module module-rtp-recv sap_address=[local IP]

Well, that was actually pretty simple. I configured MPD to use PulseAudio as an output, restarted both PulseAudio and MPD, and started playing a song in MPD. BINGO! Synchronous streaming audio to the RPis and their connected speakers, and the apartment was filled with music in every room.

I played with this setup for a day or so: adding music playlists to MPD, setting up M.A.L.P. on my phone to remote control MPD, etc. Then I thought, wouldn't it be cool if I could take the output from my SiriusXM receiver and stream that audio to every room, also? It turns out that yes - it is cool. But it was a task not without some challenges to accomplish.

For starters, my NUC didn't have a stereo line-in port so I picked up a no-name $15 USB sound card that did. Then I thought it would be a simple matter of plugging in the stereo out from the SiriusXM receiver to the line-in on the USB card, but nothing is ever that simple. I had to go back to the PulseAudio docs and this time learn about the loopback module, which acts like a virtual mixer.

First, I had to create an additional null sink dedicated for MPD:


load-module module-null-sink sink_name=mpd_out

Next, I had to tell MPD to send its output to that sink (in /etc/mpd.conf):


audio_output {
    type    "pulse"
    name    "Pulse Output"
    sink    "mpd_out" 
}

Then I had to use pactl list sources to find the cryptic ass name PulseAudio had given to the USB sound card interface, which turned out to be:


alsa_input.usb-0d8c_USB_Sound_Device-00.analog-stereo

Say that five times fast.

Finally, I had to mux the monitor of the MPD sink and the line-in source together by sending them both through the loopback module to the RTP stream sink:


load-module module-loopback source=mpd_out.monitor sink=rtp
load-module module-loopback source=alsa_input.usb-0d8c_USB_Sound_Device-00.analog-stereo sink=rtp

I turned on the SiriusXM receiver and... nothing. The USB sound card has both a mono mic port and a stereo line-in port, and for whatever reason the mic port has a higher default priority and the system preferred it as the capture device. I had to tell PulseAudio to prefer the line-in port instead. While I was at it, I set the volume on the line-in port to normalize it with the MPD output, and made sure the port was not muted:


set-source-port 1 analog-input-linein
set-source-volume 1 15000
set-source-mute 1 0

I restarted PulseAudio and the SiriusXM output started piping to all of the speakers in the house. So cool. Now I have a whole house audio system with a choice of either playlists from my music library or live SiriusXM satellite radio. I think my next project will be to setup an IR receiver/repeater system so I can change the radio station while sitting on the couch in the other room.

Mon 2019-09-23 06:51

In my younger years I remember reading in cyberpunk fiction about the concept of technoshock: a state where technology advances faster than the average person can incorporate it into their lives, causing a sort of psycho-social backlash effect. I figure we're about five minutes from that point because even technologies that are commonplace are apparently beyond the ability of some people to master. Case in point:

For the last six months or so, a woman who likely has a similar name to my own has been using an old Gmail address of mine to do such things as create accounts on clothing retailers' websites and buy plane tickets. Far beyond a one-time mistake, this person has used the wrong email address many, many times, and continues to do so on a regular basis. Setting aside that clearly many websites still don't do email confirmations for new accounts, I guess she should consider herself lucky that I am the recipient of this mistake. My personal code of ethics prevents me from resetting the passwords on her accounts, locking her out, potentially accessing her saved payment and address information, stealing her identity, or in the most recent case - claiming or cancelling her airline boarding pass. The only thing I've done thus far is unsubscribe my own address from those website mailing lists. You'd think by this point she'd start to wonder why she doesn't get the sales announcements, order confirmations, or airline notifications, and realize she had been using the wrong email address all this time. But you'd be wrong.

For another case, there is the gentleman in Charlotte, NC who is apparently confused about his own phone number and for the last few months has been giving out one of my private numbers to apparently every single person he ever meets (based on the volume of calls and texts I get looking for 'Mont'). My cellphone's caller block list now contains nearly a hundred 704 and 980 numbers belonging to people trying insistently and at all hours of the night to reach this fellow. To the point that I now set my phone to Do Not Disturb before going to bed, as it's the only way to prevent waking up to a midnight caller looking for this other person. When I have answered - knowing the call isn't for me - the callers have usually hung up immediately. If the call rolls to voicemail I often receive a succinct, cryptic message like "tryin' to gitcha, holla back quick." I won't conject as to the business 'Mont' engages in, but he certainly keeps odd hours and markets his contact information prolifically. I've considered using a call filter app to forward all calls received on that number from area codes 704 and 980 to 404-893-7000. Seems like there would be potential there for karmic lulz.

But really, phone numbers and email addresses are decades-old technologies, and some people apparently have a problem navigating them successfully. That doesn't bode well for these same folks in the fast-paced, AI-centric, automated, app-driven, technocratic future we're hurtling towards. These people probably already feel like their grasp of the technology upon which they rely is tenious at best. How are they going to feel in another 5-10 years when they (and probably most other people) will no longer have any idea how practically anything works?

Technoshock... incoming.

Wed 2019-08-28 00:12

Have you ever been in a discussion with someone, where they're telling you how to do something and you feel like they're kind of talking to you like you're an idiot. So you draft a lengthy email with screenshots and descriptive text explaining to them that you've tried doing what they said, and as you can see in the screenshots it isn't working. You click Send and recline in your chair with a sense of smug satisfaction at your own vindication that you are not the idiot - they are.

And then... you happen to look at your sent mail and notice in the very screenshot you took that one thing you've been missing and which was there all along but you failed to notice. That one thing that solves your problem. And then the revelation pours over you like a bucket of ice water... you are an idiot. And you just made a complete ass of yourself.

Have you ever had that happen to you? I have. Just now.

Latest articles

How much is data ownership worth?

From email to chat, cloud storage to social networking, there are personal financial costs to self-hosting your own information services infrastructure and freeing your data from centralized platforms like Google and Facebook. Looking at those costs may show you how much your data is worth to the companies that siphon it up.

Read more

Project updates

Repository Last commit Updated (UTC)
redball million dollar bug 2019-11-21 04:46
ELLIS updated links 2019-09-30 00:09
personal-shortener re-enabled silent fetch 2019-05-12 06:16
personal-pastebin re-enabled silent fetch 2019-05-12 06:15
dotfiles OCD is a PITA 2019-05-03 00:36

Newest photos