Raspberry Pi 5 DSP crossover music streamer

My asound.conf file has only two lines
pcm.default pulse
Ctl.default pulse

Sudo raspi-config has pipewire selected, Labwc selected, and audio output to Loopback selected.

On the Pi5 gui desktop audio option (the speaker Icon) I have Loopback Analog Surround 7.1 Output active.
 
Today I connected my Pioneer VSX-32 AV Receiver with ethernet cable to my home network and configured it to use DHCP and obtain an IP address automatically. This is the same network that my RaspberryPi5 is connected to. I use a bash file to power on the VSX-32, set the input to BluRay (where my Pi5 connects with HDMI cable), re-initialize CamillaGUI and CamillaDSP, and play the Radio Paradise main mix with mplayer all with a single command by executing the bash file from the command line.

Your RaspberryPi will need telnet installed for this to work. To my surprise telnet was not included in Raspberry Pi Bookworm by default.

~$ sudo apt-get install telnet

Create a bash file in Linux using the nano text editing program. You can create a script called "scriptexample" from the command line prompt as follows:

~$ sudo nano scriptexample

This will bring up the nano text editor.
Enter the text you want in the nano text editor
Follow the directions at the bottom of the editor screen to save the file with a name and exit.

Make the scriptexample text file executable (chmod) by all users (+x) with the following:
~$ sudo chmod +x scriptexample

Now you can execute the bash file with the following (include the punctuation ./ in front of the filename)
~$ ./scriptexample

The bash file can be edited later without needing to repeat the chmod command.

You can also point a web browser at the Pioneer VSX-32 IP address to bring up its web page which allows a graphical interface.
You can also telnet directly into the Pioneer VSX-32 from the command line.
~$ telnet 192.168.##.##
Trying 192.168.##.##...
Connected to 192.168.##.##.
Escape character is '^]'


give the connection a few seconds. Then you can use the keyboard to enter codes consisting of two characters.
?V
Should elicit a response from the VSX-32 such as
VOL74
Which corresponds to a volume of -43.5dB on the VSX-32 front panel display.
A response of E04 indicates that the command is not recognized.
Enter ctrl+] to break the telnet connection and type quit to exit telnet and return to the command prompt.
^]
telnet> quit

~$

I hope this info is helpful to anyone out there trying to get network automation to work with their Audio equipment. There is still life in these old multi-channel AV Receivers from the early days of HDMI. And these units (with pre-outs!) are available dirt cheap now on Craigslist when they don't have 4K. Combine a vintage +/-2010 HDMI 7.1 AV receiver with a pair of old 3-way (or 2-1/2 way) tower speakers and wire each driver directly to its own channel on the AV receiver and CamillaDSP set up correctly to do the audio crossovers in software and you can really have a surprisingly good sounding system for next to nothing cost wise. Good luck!


The next step is to do the same thing with RaspberryPi5 over a USB adapter to RS-232 connection on the Pioneer VSX-32...
 

Attachments

Connected the Pi5 to the RS-232 port on the Pioneer VSX-32 with a female x female null modem adapter from Amazon and an old USB/RS232 adapter cable. The Pi5 recognized the USB adapter automatically as /dev/ttyUSB0
I installed communication program screen.
Set baud rate with screen /dev/ttyUSB0 9600
Now the Pi5 powers up the VSX-32 with screen /dev/ttyUSB0 PO
All the other commands used over IP work over RS-232.

Use Ctrl+A and K to exit screen and return to the command line.
 
Very cool combination of "vintage" (can't quite make myself call ~2010 era vintage just yet) and modern stuff.

To my surprise telnet was not included in Raspberry Pi Bookworm by default.
It's not really used anymore apart from sometimes connecting to legacy stuff like with your use case. The protocol being unsecured/unencrypted has little place in a modem environment.
 
Yes, agreed on the unsecured nature of telnet.
There were a few bugs in the script file that I attached previously.
FN25 should be 25FN to set the HDMI to BD (BluRay)
0005S should be 0005SR to set the Listening Mode to Pure Direct
Also there is no need in the bash for a break command or a quit command. This is only necessary if you telnet direct from the command line.
 
Success connecting the RPi5 to the Pioneer VSX-32 over RS-232. See bash script below.

#!/bin/bash
#This script sends commands via /dev/ttyUSB0 to VSX-32 RS-232 port from RPi5 with USB-to-RS-232 converter.
#The Pioneer VSX-32 RS-232 port is male. Use female x female null-modem adapter to connect a male RS-232 cable.
SERIAL_PORT="/dev/ttyUSB0" #your USB-to-RS-232 adapter may be assigned a different port depending on your connected devices.
BAUD_RATE=9600 #The Pioneer only communicates at 9600
stty -F "$SERIAL_PORT" $BAUD_RATE raw
sleep 1 #Sleep to allow RS-232 time to wake up and respond after every command
echo "Sending data to $SERIAL_PORT at $BAUD_RATE"
sleep 1
echo -e "\r" > "$SERIAL_PORT" #carriage return
sleep 1
echo -e "PO\r" > "$SERIAL_PORT" #Power On
sleep 1
echo -e "25FN\r" > "$SERIAL_PORT" #Input=BluRay
sleep 1
echo -e "0005SR\r" > "$SERIAL_PORT" #Pure Direct Listening Mode
echo "Data sent." #Confirmation echo to command line
 
Problem: rePhase FIR filters don't have the expected crossover point when loaded into CamillaDSP.

Using free program rePhase tab 'Linear-Phase Filters' I have created FIR filters for
High Pass 2khz Linkwitz-Riley 24dB/octave
Low Pass 2khz Linkwitz-Riley 24dB/octave
Low Pass 300hz Linkwitz-Riley 24dB/octave

On every filter I use 65000 taps, format=24 bits LPCM mono (.wav) with all other options as the default.
(FFT length = 131072 samples, centering = middle/use closest perfect impulse, windowing = hann, optimization = none to -100 dB, rate = 44100hz.)

These filters are all copied to the RPi5 folder ~/camilladsp/coeffs and loaded into CamillaDSP as new (+) filters of type= Conv subtype = Wav. I use these FIR filters to substitute for the corresponding IIR (biquad) filters which are 4th order Linkwitz-Riley in CamillaDSP running on the RPi5. With the same crossover points and slopes, any differences between the FIR and the IIR filters should be related to phase, provided the FIR filters are constructed properly.

The filter gain curve plots correctly in the rePhase window with 6dB down at the Crossover Frequency. However CamillaDSP tab Filters >plot shows the Crossover Frequency for a 2khz Low Pass filter as 6dB down at 9khz instead. The same thing (ratio of about 9/2) happens on the 2khz High Pass and also the 300hz low pass filter. And even my old ears can definitely tell that the FIR filter was basically muting the tweeter, and forcing the mid and woofers to play way too high hz.

I have now generated the rePhase FIR filters with Crossover points at a multiplier of 2/9 so that instead of the crossover point at 2000hz, I used 450hz. And for the crossover point of 300hz I used 60hz. Now the filters plot correctly in CamillaDSP and my ears are feeling much better! The FIR and the IIR filters are sounding much more similar Critical listening will be needed to compare them. See .png format CamillaDSP plots attached. CPU with FIR is averaging 14%, with IIR (biquads) was averaging 1.9%.

In any event I suspect the 9/2 ratio in the expected vs actual FIR crossover points has something to do with the rePhase parameter selections.
 

Attachments

  • FIR_Low_Pass_300Hz.png
    FIR_Low_Pass_300Hz.png
    163.1 KB · Views: 2
  • FIR_Low_Pass_2khz.png
    FIR_Low_Pass_2khz.png
    73.7 KB · Views: 3
  • FIR_High_Pass_2K.png
    FIR_High_Pass_2K.png
    74.3 KB · Views: 2
One additional note I realized. My initial listening test with the "original" FIR filters was directly on-axis at my usual listening position about 9ft away from the speakers. Working on my PC I'm near field (3ft away) and 45deg off axis from the right speaker. With the FIR filters applied, the tweeter was essentially muted below about 7500hz, my 8in woofers driving up to 9khz beaming like crazy and on-axis I was still hearing the highs on-axis. But off-axis all the highs vanished with the (uncompensated) FIR filters. The IIR filter was giving normal off-axis performance from the tweeter (2khz high pass) and keeping the 8in woofer where it belonged 2khz low-pass. (my speakers are Klipsch KSF-10.5 with horn tweeter and dual 8in woofers sharing the space space).

Compensating the FIR crossover points restored the speaker performance and the off-axis performance is back to "normal".

When listening to your speakers in an A/B comparison, I suggest on-axis and off-axis listening. Off-axis can reveal major problems you might not notice on-axis.
 
Found mistake in the FIR filter and corrected.
I have CamillaDSP capture rate set at 192khz.
The rePhase FIR filter must use the same rate.
I originally had the FIR filter rate at 44100.
Setting the rePhase Linear-Phase Filter rate = 192000 hz has solved the issue.
 
CamillaDSP response plot question.
I have CamillaDSP 2.0.3
pyCamilla2.0.2
Backend 2.1.0

In the Camilla GUI Filters tab, I plot my FIR High Pass 2K filter (RePhase linear-phase High Pass Linkwitz-Riley 24dB slope 2khz) and it appears as expected. No phase shift and no group delay.
FIR_High_Pass_2K (2).png

But in the Pipeline tab when I "Plot Response of this Step" it shows the gain curve correctly, but phase and group delay are a mess.
Filterstep_3.png

Is this just a bug in the filter response plot?