WHAT IS IT?
I have been running DSP crossovers under Linux on single board computers (e.g. Raspberry Pi) or other small Linux Boxes for several years. I use these in active loudspeaker projects that I build. More info on that here:
Implementing Loudspeaker Crossovers using Ecasound and ACDf LADSPA plugins
I mostly use a tablet to control my systems, but sometimes you just want a physical component that you can touch, a knob to turn, a button to push - something to interact with on the physical level but that controls a computer-based system - something that emulates the feel of ye ole stereo Preamp.
Necessity is the mother of invention and so I created such a thing, which I am calling the "Linux USB Preamp".
The Linux USB Preamp is a physical audio component having an LCD display, five buttons (volume up/down, input and setting increment/decrement, and a select/menu button). I am planning to build this up in a 2U or 3U rackmount form factor, but any sized chassis that can accommodate the controls is possible. The interface was adapted from a now-abandoned project of mine from 2013/2014 that is described here:
PROPOSAL: wireless digital loudspeaker with remote volume and on/off control
Since then I have moved on to doing audio related tasks in SOFTWARE under Linux instead of in hardware. While this approach has worked very well for me I still am interested in having something to touch that controls the system. By control I mean it is at least able to make the system switch between inputs and change the volume. Because it is software based, upgrades to the scope and functionality can be made at any time.
HOW DOES IT WORK?
Inside my preamp box is an Arduino. I wrote some code to display info on the LCD and listen to the preamp controls (volume knob and buttons). The Arduino is connected via a USB cable to the "host" computer that is actually running the audio system. That's the only physical connection required for the preamp (e.g. no "AC power cord", etc.). There is a shell script running on the host that does the actual "control" work. When the user changes some physical control on the preamp (e.g. turns the volume knob) the Arduino sends a message to the host over USB, like "SET VOLUME 50". The host is listening to the serial port, receives the message, and adjusts a control in ALSA that governs the gain for the audio. As a result, turning the physical knob on the preamp controls the host system volume. For input switching I am using ecasound to connect to inputs, perform DSP processing, and route the resulting audio streams to outputs. When the user selects a new input, the existing ecasound process is terminated and a new one is launched. All audio passes between digital and analog domains through an audio interface (multiple ADC and DAC channels) connected to the host computer.
The user is able to configure the system in a couple of different ways. By configure I mean to specify ecasound scripts/commands to route and process audio, to specify settings like the "name" that is shown on the preamp's LCD for each input, what volume and input to use when the system first powers on, etc. These settings are stored in a text file on the host that is read by the host shell script during initialization. The user can log on and edit this file at any time to change the behavior of the system. But many of the parameters are also editable from the preamp itself, that is you can rename inputs and other settings without touching the host computer or logging into it. The only things that cannot be edited are the ecasound commands that control how inputs function, since these tend to be quite long strings of text. When the user is done making changes to a parameter on the premp, the new info is sent up to the host via USB and the configuration file is updated.
IT'S PORTABLE AND WORKS ON MULTIPLE SYSTEMS
Because the system configuration is stored on the host and not on the preamp, the preamp can be disconnected from one host, plugged into the next host, and it will control the new system using the settings stored on that host's hard drive. This makes the preamp totally portable between systems. I have configured the host so that when the USB cable is connected between preamp and host the host automatically launches the shell script, downloads the system configuration, and begins playing as directed. The host computer can be headless, and no login is required.
When it's time to shut off the system, or you want to move the preamp to another system, just unplug the USB cable connecting host and preamp. Playback from the host stops immediately and it returns to a standby state in which waits until the Linux USB Preamp is again plugged into it.
OTHER USES
I sometimes attend DIY audio events and like to show off my loudspeakers. In my home I send audio to my loudspeakers over WiFi using a gstreamer-based streaming audio system that I coded. I can control all the system from a small tablet. Unfortunately this system is not portable to an audio show, so I have been looking for another means to control a DSP crossover system under Linux. That's when I started to look into using the Arduino as the heart of a physical interface and this project grew in part from that thought process.
PROJECT STATUS
I have completed the coding and debugging process using a prototype that consists of the Arduino, some buttons on a solderless breadboard, a 16x2 LCD display, and spaghetti wiring holding it all together. It's not even worth posting a picture of it! The next step is to build a physical box in the rackmount form factor and install the prototype in it. As a first pass I am planning to build this out of wood, since I can drill holes and cut a recessed hole for the LCD using tools I own. I can upgrade to a nicer front panel and get a proper aluminum chassis with some nicer looking buttons at some later date but for now I primarily want to get it all put together and ready to demo at Burning Amp in November.
MEH, WHAT ELSE IS IT GOOD FER?
In the current embodiment, the preamp unit is portable and distinct from one or more computer audio "hosts" connected to loudspeaker systems. But one could combine the preamp with a small SBC host and an audio interface into a single component. You would then have a networkable, expandable, and reconfigurable integrated audio system controller having a physical interface (buttons, knobs) and multi channel outputs leading to amps and speakers. Well, not this year but maybe next.
I have been running DSP crossovers under Linux on single board computers (e.g. Raspberry Pi) or other small Linux Boxes for several years. I use these in active loudspeaker projects that I build. More info on that here:
Implementing Loudspeaker Crossovers using Ecasound and ACDf LADSPA plugins
I mostly use a tablet to control my systems, but sometimes you just want a physical component that you can touch, a knob to turn, a button to push - something to interact with on the physical level but that controls a computer-based system - something that emulates the feel of ye ole stereo Preamp.
Necessity is the mother of invention and so I created such a thing, which I am calling the "Linux USB Preamp".
The Linux USB Preamp is a physical audio component having an LCD display, five buttons (volume up/down, input and setting increment/decrement, and a select/menu button). I am planning to build this up in a 2U or 3U rackmount form factor, but any sized chassis that can accommodate the controls is possible. The interface was adapted from a now-abandoned project of mine from 2013/2014 that is described here:
PROPOSAL: wireless digital loudspeaker with remote volume and on/off control
Since then I have moved on to doing audio related tasks in SOFTWARE under Linux instead of in hardware. While this approach has worked very well for me I still am interested in having something to touch that controls the system. By control I mean it is at least able to make the system switch between inputs and change the volume. Because it is software based, upgrades to the scope and functionality can be made at any time.
HOW DOES IT WORK?
Inside my preamp box is an Arduino. I wrote some code to display info on the LCD and listen to the preamp controls (volume knob and buttons). The Arduino is connected via a USB cable to the "host" computer that is actually running the audio system. That's the only physical connection required for the preamp (e.g. no "AC power cord", etc.). There is a shell script running on the host that does the actual "control" work. When the user changes some physical control on the preamp (e.g. turns the volume knob) the Arduino sends a message to the host over USB, like "SET VOLUME 50". The host is listening to the serial port, receives the message, and adjusts a control in ALSA that governs the gain for the audio. As a result, turning the physical knob on the preamp controls the host system volume. For input switching I am using ecasound to connect to inputs, perform DSP processing, and route the resulting audio streams to outputs. When the user selects a new input, the existing ecasound process is terminated and a new one is launched. All audio passes between digital and analog domains through an audio interface (multiple ADC and DAC channels) connected to the host computer.
The user is able to configure the system in a couple of different ways. By configure I mean to specify ecasound scripts/commands to route and process audio, to specify settings like the "name" that is shown on the preamp's LCD for each input, what volume and input to use when the system first powers on, etc. These settings are stored in a text file on the host that is read by the host shell script during initialization. The user can log on and edit this file at any time to change the behavior of the system. But many of the parameters are also editable from the preamp itself, that is you can rename inputs and other settings without touching the host computer or logging into it. The only things that cannot be edited are the ecasound commands that control how inputs function, since these tend to be quite long strings of text. When the user is done making changes to a parameter on the premp, the new info is sent up to the host via USB and the configuration file is updated.
IT'S PORTABLE AND WORKS ON MULTIPLE SYSTEMS
Because the system configuration is stored on the host and not on the preamp, the preamp can be disconnected from one host, plugged into the next host, and it will control the new system using the settings stored on that host's hard drive. This makes the preamp totally portable between systems. I have configured the host so that when the USB cable is connected between preamp and host the host automatically launches the shell script, downloads the system configuration, and begins playing as directed. The host computer can be headless, and no login is required.
When it's time to shut off the system, or you want to move the preamp to another system, just unplug the USB cable connecting host and preamp. Playback from the host stops immediately and it returns to a standby state in which waits until the Linux USB Preamp is again plugged into it.
OTHER USES
I sometimes attend DIY audio events and like to show off my loudspeakers. In my home I send audio to my loudspeakers over WiFi using a gstreamer-based streaming audio system that I coded. I can control all the system from a small tablet. Unfortunately this system is not portable to an audio show, so I have been looking for another means to control a DSP crossover system under Linux. That's when I started to look into using the Arduino as the heart of a physical interface and this project grew in part from that thought process.
PROJECT STATUS
I have completed the coding and debugging process using a prototype that consists of the Arduino, some buttons on a solderless breadboard, a 16x2 LCD display, and spaghetti wiring holding it all together. It's not even worth posting a picture of it! The next step is to build a physical box in the rackmount form factor and install the prototype in it. As a first pass I am planning to build this out of wood, since I can drill holes and cut a recessed hole for the LCD using tools I own. I can upgrade to a nicer front panel and get a proper aluminum chassis with some nicer looking buttons at some later date but for now I primarily want to get it all put together and ready to demo at Burning Amp in November.
MEH, WHAT ELSE IS IT GOOD FER?
In the current embodiment, the preamp unit is portable and distinct from one or more computer audio "hosts" connected to loudspeaker systems. But one could combine the preamp with a small SBC host and an audio interface into a single component. You would then have a networkable, expandable, and reconfigurable integrated audio system controller having a physical interface (buttons, knobs) and multi channel outputs leading to amps and speakers. Well, not this year but maybe next.
Last edited:
Hi Charlie,
congrats on your project.
I like projects combining PC and peripherals with microprocessors too. Last time I did a small all-in-one PC/cd-player/amp Home * pavhofman/plabs-player Wiki * GitHub . You may want to have a look at inexpensive TFT LCDs, they cost the same as alphanumeric LCDs and are much more fun to play with. Very good graphic libraries are readily available for arduinos, I used Arduino TFT Display and Font Library: 11 Steps. The code is included with my github project.
Should you want to make the mechanical construction more simple and get rid of complicated buttons (nice knobs, holes, difficult to make looking good), you may consider using touch sensors with fixed metal parts. Multichannel touch controllers are actually cheaper than decent push buttons, I use TTP224/TTP226 TTP226 8 Channel Digital Touch Sensor Module Capacitive Touch Switch-in Sensors from Electronic Components & Supplies on Aliexpress.com | Alibaba Group
Good luck with your project!
congrats on your project.
I like projects combining PC and peripherals with microprocessors too. Last time I did a small all-in-one PC/cd-player/amp Home * pavhofman/plabs-player Wiki * GitHub . You may want to have a look at inexpensive TFT LCDs, they cost the same as alphanumeric LCDs and are much more fun to play with. Very good graphic libraries are readily available for arduinos, I used Arduino TFT Display and Font Library: 11 Steps. The code is included with my github project.
Should you want to make the mechanical construction more simple and get rid of complicated buttons (nice knobs, holes, difficult to make looking good), you may consider using touch sensors with fixed metal parts. Multichannel touch controllers are actually cheaper than decent push buttons, I use TTP224/TTP226 TTP226 8 Channel Digital Touch Sensor Module Capacitive Touch Switch-in Sensors from Electronic Components & Supplies on Aliexpress.com | Alibaba Group
Good luck with your project!
Last edited:
Thanks for the feedback! I have looked at those capacitive switches - Adafruit here in the US sells a 12-channel board for example. You can connect wires to thru holes on the board that connect to the actual sensor pads on the front panel. I don't have any experience with this type of sensor, so I would need to get experience with using them and get to know the pitfalls. For now I have some tactile switches with round snap-on caps. These will be easy to implement - I can solder the switch to a small general purpose PCB and back-mount it on the front panel with a round thru-hole for the button cap. It's very easy to machine out the thru-hole since it's round.Hi Charlie,
congrats on your project.
I like projects combining PC and peripherals with microprocessors too. Last time I did a small all-in-one PC/cd-player/amp Home * pavhofman/plabs-player Wiki * GitHub . You may want to have a look at inexpensive TFT LCDs, they cost the same as alphanumeric LCDs and are much more fun to play with. Very good graphic libraries are readily available for arduinos, I used Arduino TFT Display and Font Library: 11 Steps. The code is included with my github project.
Should you want to make the mechanical construction more simple and get rid of complicated buttons (nice knobs, holes, difficult to make looking good), you may consider using touch sensors with fixed metal parts. Multichannel touch controllers are actually cheaper than decent push buttons, I use TTP224/TTP226 TTP226 8 Channel Digital Touch Sensor Module Capacitive Touch Switch-in Sensors from Electronic Components & Supplies on Aliexpress.com | Alibaba Group
Good luck with your project!
I happened to already have the 16x2 LCD from a previous project and while it's not the sexiest type of display out there it does the job and it is all coded, etc. One thing I like about it is that it's on an I2C driver board (also from Adafruit) that also has buttons (although I don't like how they are debounced). This makes it very easy to implement and I am able to run the I2C bus to it at 500kHz, which makes text updates relatively fast. As a result, this LCD will be used in the project prototype. Later I can explore different displays and display types, etc. Some of those TFT displays are IMO too small, but maybe that 2.2" one in the instructables link you provided would work well. As it stands I am pretty busy so just getting all of this into some kind of case in the next month seems like a reasonable goal that I can achieve.
Last edited:
Pi, Arduino and MiniDSP user here. I was not aware of the Pi's potential for DSP. I'll be following / looking into this over the next few months and will download your software as a starting point. Just wanted to say thanks for the heads up.
I am buying the dirt-cheap capacitive sensors from China, they are very simple to use - just connecting one MCU pin for each channel.
The TFT I used is controlled by SPI, simple to connect to arduino. For arduino I have settled on 5V Arduino Mini Pro (at 16MHz, also dirt-cheap under $2) powered by 3.3V as most peripherals run at 3.3V and the TFT refresh takes advantage of the faster clock.
Arduino is fun and provides enough performance for usual tasks. My current project (with 4.5" touch screen) utilizes 32bit 72MHz STM32 (the same price of $2-4) which has almost the same ease of use but offers way more performance than basic arduinos.
The TFT I used is controlled by SPI, simple to connect to arduino. For arduino I have settled on 5V Arduino Mini Pro (at 16MHz, also dirt-cheap under $2) powered by 3.3V as most peripherals run at 3.3V and the TFT refresh takes advantage of the faster clock.
Arduino is fun and provides enough performance for usual tasks. My current project (with 4.5" touch screen) utilizes 32bit 72MHz STM32 (the same price of $2-4) which has almost the same ease of use but offers way more performance than basic arduinos.
I am buying the dirt-cheap capacitive sensors from China, they are very simple to use - just connecting one MCU pin for each channel.
The TFT I used is controlled by SPI, simple to connect to arduino. For arduino I have settled on 5V Arduino Mini Pro (at 16MHz, also dirt-cheap under $2) powered by 3.3V as most peripherals run at 3.3V and the TFT refresh takes advantage of the faster clock.
Arduino is fun and provides enough performance for usual tasks. My current project (with 4.5" touch screen) utilizes 32bit 72MHz STM32 (the same price of $2-4) which has almost the same ease of use but offers way more performance than basic arduinos.
I'm using an Arduino UNO. I bought a few of them back in 2013 when I thought I had some uses for them and then worked up that "digital preamp" project. This time around I just reached into the bin and pulled out what I already had. I don't really need something with more performance anyway. I think at the time I bought the UNOs for around $15 each. I did a quick search and the price is even lower than that these days. They are so easy to use I never bothered to check out the mini and other smaller form factor versions.
I bought a nice piece of birch hardwood for my front panel yesterday. I have to figure out how I can cut out the rectangular LCD hole. I have a friend with lots of power tools and I hope to try his scroll saw for that. I originally thought I could use my router, but setting it up with a cutting template and so on is much more complicated than I originally thought. Hopefully I can make some progress on the chassis in the next week or two.
In the meantime I will be working on an install script for the host computer.
I bought a nice piece of birch hardwood for my front panel yesterday. I have to figure out how I can cut out the rectangular LCD hole. I have a friend with lots of power tools and I hope to try his scroll saw for that. I originally thought I could use my router, but setting it up with a cutting template and so on is much more complicated than I originally thought. Hopefully I can make some progress on the chassis in the next week or two.
You can use your router with a 1/4, or even 1/8" bit to cut out the shape, then use a chisel to get the inside corners nice and square. I've done it many times and it works very well.
Scroll saw can work as well obviously.
In the meantime I will be working on an install script for the host computer.
Depending on how many things need to be installed, setup, etc. this could get complicated in a hurry. I'd be happy to help if you need any pointers, etc.
I'm quite excited to see this, as I think there is much opportunity for community iteration and progression in this space.
Big thank you to you Charlie for putting so much of your time into it, and putting it out for folks to use.
You can use your router with a 1/4, or even 1/8" bit to cut out the shape, then use a chisel to get the inside corners nice and square. I've done it many times and it works very well.
Scroll saw can work as well obviously.
Depending on how many things need to be installed, setup, etc. this could get complicated in a hurry. I'd be happy to help if you need any pointers, etc.
I'm quite excited to see this, as I think there is much opportunity for community iteration and progression in this space.
Big thank you to you Charlie for putting so much of your time into it, and putting it out for folks to use.
I don't think the install will be all that complicated. I might be able to automate everything. There is some udev stuff, a couple of script files, and the main one that controls the system. If I get stuck I will definitely drop you a line since I know you will have some expertise in that area.
As far as the router goes, sure I can do it but it is a little bit complicated because the size of the piece of wood I need to route is only about 4"x24" and is 3/4" thick. My thought was to make a template within which I would run a round plunge base on my router that is about 6" diameter. But to set this up properly I need to find some other scrap pieces about 3/4" thick to place on either side of the workpiece, then put the template over that and clamp everything down securely. To make the template is a little job in itself, too. At the end I will need to square up the corners with a nice sharp chisel that I don't own. Since this may be a one-time thing I think the scroll saw will be the most straightforward way to do it.
I don't think the install will be all that complicated. I might be able to automate everything. There is some udev stuff, a couple of script files, and the main one that controls the system. If I get stuck I will definitely drop you a line since I know you will have some expertise in that area.
Sounds great!
As far as the router goes, sure I can do it but it is a little bit complicated because the size of the piece of wood I need to route is only about 4"x24" and is 3/4" thick. My thought was to make a template within which I would run a round plunge base on my router that is about 6" diameter. But to set this up properly I need to find some other scrap pieces about 3/4" thick to place on either side of the workpiece, then put the template over that and clamp everything down securely. To make the template is a little job in itself, too. At the end I will need to square up the corners with a nice sharp chisel that I don't own. Since this may be a one-time thing I think the scroll saw will be the most straightforward way to do it.
For a one time piece, you are probably better off borrowing your friend's scroll saw.
- Status
- Not open for further replies.
- Home
- Source & Line
- PC Based
- Linux USB Preamp project