Punching Pulseaudio-RTP through a firewall

As I mentioned in the previous post, I recently set up a network audio server computer using pulseaudio-rtp. Because it would have been a waste of resources to use it only for audio work, I started using it for some other services, too. For security and access control reasons I ended up installing and setting up a firewall there (UFW in my case). Of course, at that point pulseaudio-rtp stopped working…

I do not want to go through all the different setups I tried to make pulseaudio-rtp to work through a firewall, lack of proper documentation made the task quite laborous. Here’s just the working setup:

  1. On the client (i.e. the desktop), in the /etc/pulse/default.pa, set module-rtp-send port=<portofyourchoice>
  2. On the server, in the /etc/pulse/default.pa, set module-rtp-recv sap_address=
  3. In the /etc/default/ufw, set DEFAULT_FORWARD_POLICY="ACCEPT"
  4. In the firewall setup, open the <port>/udp you set up in step 1, and port 9875/udp

I found out about the undocumented port 9875 only after debugging the network traffic with tcpdump and netstat. I couldn’t find any information about that port anywhere in the pulseaudio-rtp documentation (or if it is there, it’s hidden so well that I didn’t find it).

Posted in Linux | Tagged , , , | Leave a comment

M-Audio Audiophile 2496 and Pulseaudio

When I built my previous Linux workstation in 2007, I equipped it with a M-Audio Audiophile 2496 professional audio card. I was very pleased with its quality – superb sound, excellent recording capabilities, S/PDIF and MIDI in/out, and proper RCA connectors instead of the standard crappy 3,5mm jack sockets. Even my untrained ear could hear the difference in sound quality between M2496 and the motherboard’s built-in sound card. It worked excellently with both ALSA and Jack-Audio-Connection-Kit, and as the system was using Gentoo Linux, I was able to keep the system Pulseaudio-free until the end of its lifespan.

I built my current AMD Ryzen-based workstation some 2,5 years ago, and I really wanted to continue using the M2496 card somehow. However, there were two issues: first, the card uses an older PCI bus connector, which isn’t supported on modern motherboards any more (unless you use a some kind of PCI-to-PCIe adapter; not applicable in my case anyway, the water cooling takes too much space).

My solution was to buy an used Intel Atom-based Mini-ITX motherboard with a spare PCI connector, and use it with the M2496 card as an Arch Linux-based sound server. Because you cannot really avoid Pulseaudio on modern Linux desktops any more, I decided to use Pulseaudio’s RTP-based streaming solution between the desktop and the sound server.

And that brings us to the second issue: M-Audio 2496 and other ICE1712-based cards does not work with Pulseaudio out of the box. No sound, period.

There’s an open, unresolved bug report on this from more than 10 years ago… quite incomprehensible. I know that Lennart Poettering hates ICE1712-based sound cards, but this is still too much… Well, it just means that M-Audio users need to do everything the hard way, manually editing and creating configuration files.

  1. Make sure that M-Audio is set as the default sound card (usually it is set as a secondary card, check with aplay -l.): create/edit the file /etc/modprobe.d/alsa-base.conf and reboot:

    options snd_ice1712 index=0
    options snd_hda_intel index=1
  2. Add a new rule to /lib/udev/rules.d/90-pulseaudio.rules (this will be overwritten by an update, so make a backup):

    1. LABEL="pulseaudio_check_pci"
    3. + # M-Audio Audiophile 2496
    4. + # ICE1712
    5. + ATTRS(vendor)=="0x1412", ATTRS(device)=="0x1712", ENV(PULSE_PROFILE_SET)="via-ice1712.conf"

    The vendor-string may be different on other ICE1712 cards, please check with lspci -nn.

  3. Finally, create a profile definition in /usr/share/pulseaudio/alsa-mixer/profile-sets/via-ice1712.conf

    ; Via ICE1712 multi-channel audio chipset
    ; This chipset has up to four stereo pairs of input and four stereo pairs of
    ; output, named channels 1 to 8. Also available are separate S/PDIF stereo
    ; channels (input and output), and a separate "system-out" stereo jack that
    ; supports 6-channel hardware mixing.
    ; The S/PDIF stereo channels can be controlled via the mixer for hw:0, and
    ; additionally, the 8 main outputs can be loop-routed to a separate stereo
    ; input pair, available as channels 11 and 12.
    ; Many cards available from vendors do not expose all channels from this chip
    ; to an external port, which effectively reduces the number of channels that
    ; are useful to the user. However, the ALSA driver still exposes all channels
    ; even if they are not connected.
    ; We knowingly only define a subset of the theoretically possible
    ; mapping combinations as profiles here.
    ; See default.conf for an explanation on the directives used here.
    auto-profiles = no
    [Mapping analog-mch-in]
    description = Analog Multi-Channel Main Input
    device-strings = hw:%f,0
    channel-map = aux0,aux1,front-left,front-right,aux2,aux3,aux4,aux5,aux6,aux7,aux8,aux9
    direction = input
    [Mapping analog-mch-out]
    description = Analog Multi-Channel Main Output
    device-strings = hw:%f,0
    channel-map = front-left,front-right,aux0,aux1,aux2,aux3,aux4,aux5,aux6,aux7
    direction = output
    [Mapping digital-stereo]
    description = Digital Stereo Input/Output
    device-strings = iec958:%f
    channel-map = left,right
    direction = any
    [Mapping analog-system-out]
    description = Analog Stereo System-Out
    device-strings = hw:%f,2
    channel-map = left,right
    direction = output
    [Profile output:mch]
    description = Multi-Channel Output Active (Digital Disabled)
    output-mappings = analog-mch-out analog-system-out
    input-mappings =
    priority = 90
    skip-probe = yes
    [Profile output:mch+input:mch]
    description = Multi-Channel Input/Output (Digital Disabled)
    output-mappings = analog-mch-out analog-system-out
    input-mappings = analog-mch-in
    priority = 100
    skip-probe = yes
    [Profile output:spdif]
    description = Digital Output (Multi-Channel Disabled)
    output-mappings = digital-stereo analog-system-out
    input-mappings =
    priority = 80
    skip-probe = yes
    [Profile output:spdif+input:spdif]
    description = Digital Input/Output (Multi-Channel Disabled)
    output-mappings = digital-stereo analog-system-out
    input-mappings = digital-stereo
    priority = 90
    skip-probe = yes
    [Profile output:system]
    description = System Output Only
    output-mappings = analog-system-out
    input-mappings =
    priority = 60
    skip-probe = yes
  4. Restart Pulseaudio:

    pulseaudio -k
    pulseaudio --start

The original source for the Pulseaudio fix can be found here.

Posted in Linux | Tagged , , , , | Leave a comment

How to resurrect an 80’s Hitachi MX-W01 CD Slimline System

Motto: “If you buy a quality product, you don’t need to replace it every 35 years.”

Hitachi MX-W01 original japanese ad

I bought the Hitachi MX-W01 CD Slimline System in 1986, that is, 35 years ago. It was my first proper stereo system, and so far, the only one… I used the receiver/player itself from the 80’s up to about 2011, when I put it in storage. However, the original speakers weren’t up to my standards neither by the look nor the sound quality; after an year of use I sold them to my younger stepbrother and replaced them with a pair of KEF C55 speakers. I wish I still had those, they were very good for 80’s speakers.

Back when I finally stopped using the Hitachi, it had three major issues:

  1. The radio station memory system was practically dead, it lost all stations after just 2-3 hours of power-off. When new, the stations stayed in the memory at least for two weeks without powering the device up.
  2. There was an intermittent bad connection somewhere; I had to occasionally slam it to make the CD-player to wake up.
  3. For the last 10+ years of use it was situated so that before noon the sun was able to shine on it at full force, so it started slowly turning yellow.

A few weeks ago I decided to try to refurbish/resurrect the dear old Hitachi. Here’s how it went:

  1. There’s no battery in the radio memory system, but instead a large (2200 µF 6.3v) electrolytic capacitor combined with a diode, thus giving the radio circuit enough power to keep its memory working when the rest of the device is powered down. That capacitor’s electrolyte had obviously dried out during the 25 years of use. The replacement was easy enough: because there has been some development in electrolytic capacitors during the last 35 years, I was able to replace the original with an electrically larger, but physically equal sized 3300 µF 10v capacitor.

    Radio/display board

    The memory capacitor is the big black cylinder in the middle.

  2. The bad connection issue fixed itself while I removed and refitted the radio/display board for capacitor replacement. Also, all the other switches & connectors I could reach without dismantling the device completely were disconnected/reconnected and cleaned out with PRF Contact Cleaner.
  3. The plastic housings and other parts of most electronic devices made since the 60’s are made of ABS plastic. In pure form ABS burns quite easily, which is bad news safety-wise. Consequently a flame-retardant chemical (bromide or equivalent) was added to the plastic… but that chemically-treated plastic has a nasty habit of turning yellow-brown over time when exposed to ultraviolet radiation from the sun.

    So much sickly yellow on these dismantled MX-W01 parts… Not nice.

    Ugly yellow
    Fortunately, at some point someone noticed that hydrogen peroxide (H₂O₂) has the power of reversing the yellowing process. That phenomenon has been utilized in the famous “retr0bright” process, However, I didn’t feel like sourcing and mixing the chemicals myself, so I used the second best option from a local supermarket: a hair color removing product “Garnier Nutrisse Truly Blond – Bleach Maximum Lightener L+++“, which of course also contains hydrogen peroxide. Other similar products may work equally well. If you have a choice, choose the strongest possible “blonding” agent.

    Now I’ll give the usage instructions of that “blonding” agent: Disassemble every part you are going to bleach (especially remember to remove every metal part, hydrogen peroxide will damage them). Clean the parts thoroghly with normal cleaning methods to remove grease etc. and then let dry. Refer to the package instructions of mixing the blonding agent paste. Apply the paste to the part with a brush to create an even ~1mm layer and IMMEDIATELY wrap it in a piece of plastic wrap film to prevent the paste from drying. Repeat with every part. Work fast because the hydrogen peroxide keeps evaporating from the paste. When all parts are wrapped up check that the paste is evenly spread under the film and fix if necessary. Leave them to be for 24 hours, if possible under a constantly burning plant lamp or a fluorescent lamp. (It may seem counter-productive, but in this case a little UV light helps hydrogen peroxide to do its job.) After the parts are ready remove the film and wash the parts in warm water. Let dry and reassemble. You’re done…

    MX-W01 parts under wraps… literally.

    Wrapped up parts with hydrogen peroxide paste
    With the MX-W01 parts the abovementioned process worked almost perfectly. The white body was completely back to its original, slightly pearl-white shade. In some of the grey parts they were still very slight darker areas, but you need to know where to look to notice them in the finished product. Maybe the paste layer wasn’t even enough, or the time of 18 hours I used wasn’t long enough… Cannot say for sure.

    Here’s the Hitachi MX-W01 in all its glory looking like a new deck, instead of a 35 year old! And everything is working, including the radio station memory and that wonderfully bright and clear VFD (vacuum fluorescent) display. It is a shame that manufacturers stopped using VFDs after the 80’s, instead opting for the clumsy and ugly, but cheaper and less power-hungry LCD technology.
    The sound goes from the 6.3mm headphone jack via an analog mixer to the Alesis M1 620 active studio monitors.

    Resurrected Hitachi MX-W01 CD Slimline System

Posted in Music | Tagged , , | Comments Off on How to resurrect an 80’s Hitachi MX-W01 CD Slimline System

Useful snippets #5: GTK3 dark theme with Firefox

A long-standing problem with Firefox on Linux, when an user is using a dark GTK3 theme like Adwaita:dark, is the “bleeding” of the desktop colors to the actual web page. Because almost all web developers assume that everyone is using a light theme anyway, that “bleeding” can in some cases cause the web page to become unusable, and in any case it looks ugly.

There’s a widget.content.gtk-theme-override setting in about:config, which is supposed to fix the issue, but I’ve never managed to make it work on any Firefox version.

However, I noticed almost accidentally that, if firefox is started for example with a script

  1. #!/bin/bash
  3. firefox

then the “bleeding” does not happen. It seems that when the GTK3 theme-defining environment variable GTK_THEME is an empty string, Firefox get confused and defaults to the light theme on web pages, but the UI still respects the gtk-application-prefer-dark-theme = 1 setting in ~/.config/gtk-3.0/settings.ini.

Posted in Linux | Tagged , , | Comments Off on Useful snippets #5: GTK3 dark theme with Firefox

Light in a Box

Added a lightbox plugin to the site for easier viewing of the pictures. Should have done that years ago…

Posted in Uncategorized | Tagged , | Comments Off on Light in a Box