Skip to content

Country

How to set Up JustBoom HAT or pHAT For Mono Output

How to set Up JustBoom HAT or pHAT For Mono Output

This guide will show you how to merge stereo signals to mono output on either the JustBoom AMP or DAC. We will show you how to configure the ALSA settings using the latest Raspbian Buster OS. When using single speaker configuration with the Raspberry Pi and any DAC or AMP HAT is to use one of the available channels and then configure ALSA so that both signals are then merged into one.

Step 1 – First of all you need to make sure that you have a working HAT or pHAT by adding the correct DToverlay as in the following guide here – View Guide

Step 2 – Login to the Raspberry Pi and open up the terminal window (If using Desktop version). Type in the following commands to edit the alsa.conf file:

cd /usr/share/alsa

sudo nano alsa.conf

Then add the following at the bottom of the file:

pcm.card0 {
  type hw
  card 0
}

ctl.card0 {
  type hw
  card 0
}

pcm.monocard {
  slave.pcm card0
  slave.channels 2
  type route
  ttable {
    # Copy both input channels to output channel 0 (Left).
    0.0 0.5
    1.0 0.5
    # Send nothing to output channel 1 (Right).
    0.1 0
    1.1 0
  }
}

ctl.monocard {
  type hw
  card 0
}

pcm.!default monocard
ctl.!default monocard
Save the changes with CTRL+O & ENTER then CTRL+X to exit.
Step 3 – Reboot for the changes to be made effect and check that you now have a new PCM device:
sudo reboot
Check with:
play -L

Step 4 – Now you can test the output by playing an audio file. For this test I just went and played a YouTube video in the browser and the result was that the output was in mono as configured.

Previous article How to setup your JustBoom HAT as a Bluetooth Speaker
Next article IR Remote Control Support on Raspbian Buster – JustBoom