If you want to just buy a thing that exists, you could look for one of the "high end" networked audio interfaces out there with on-board DSP mixing + network control, e.g. MOTU AVB interfaces support that (e.g. MOTU 16A + some TOSlink to analog stereo out for the 17th/18th channel would be completely sufficient for your project). You would only have to develop the automation to remote control the volumes / routing and integrate it into your home automation, or if you want to get fancy, you could connect that to a PC and do literally anything you could imagine. Keep in mind that this will cost quite some money and I have no idea how much you want to spend on this project, but it will also give you high quality and low latency audio.
If you want to build it yourself and if you want to keep it cheap and simple: integrating an ADC or DAC on a custom board isn't that hard, at least if you don't need "perfect" "audiophile" audio quality; usually the datasheets of the ADC / DAC chips already tell you exactly how you're supposed to use them + external components you need and so on. In your case, you'll probably want to use a cheap FPGA for mixing (think of Spartan-6 or newer), since that can easily handle dozens of channels, unlike cheap MCUs which usually don't support the number of channels you'd need. With MCUs the limit isn't necessarily how much you could mix in software, but how many ADC/DAC channels you can physically attach to the chip. For zigbee (or whatever network protocol you prefer) you can find dozens of small chips which can interact with that. Since it sounds like your system is wired anyway, you could also think about Ethernet for the network. When you start playing around with this, I'd recommend building a simple and minimal prototype first with e.g. a stereo in/out + network, to keep the manufacturing costs low in case you mess up the design, and once this works as intended, build the "full" 14x18ch module. Don't forget to add some simple debug port like e.g. RS232, it's cheap to add and it makes your life during development much easier.
Thank you for the reply! I'll look into the MOTU devices... I had not heard of them before!
I was hoping to keep the cost at sub-$1k (although that is by no means a hard limit), but you are correct in that I already have the speakers wired in. Basically all cables come to a single location, which is where the amps need to go (speakers are not powered). It seems that the previous owner just ran the same 2 channels to all rooms in an on/off configuration.
I didn't think about the RS232 for debugging, but that's a good idea.
I know that the datasheets give external components, but when I was looking at this ~6 months ago, it seemed that most of the options were surface mount, and I've only done breadboard designs, so I didn't know how to work with that for prototyping purposes. This may be my biggest sticking point.
Also, I didn't know if FPGA or something more familiar (such as a RPi) would be better for mixing. I have a PhD in CS, but I've never worked with FPGAs!!! lol I only know what they are in theory!
I'm not against rolling up my sleeves and working, I just didn't know where to start. Even the smallest MVP (stereo in, mixer, stereo out) has too many parts with which I am unfamiliar.
If you want to do it in the digital domain, FPGA is the obvious choice to go with here. It'd be difficult to get enough channels connected to a 'custom' design any other way, but yes the learning curve will be steep if you go that route.
There is enough bandwidth on a USB 2.0 HS port for many channels of audio, you could just buy a couple decent multichannel USB 2.0 HS audio interfaces. They are pretty readily available with 8 in / 8 out (mono) channels in one box for a few hundred bucks. You can plug these into a RPi and it probably has enough grunt to do the processing using JACK or pipewire or some similar audio router with some custom code to manage it. Full-pipeline latency could be problematic, especially if you need to stay in sync with the TV and whatnot that is pretty noticeable and often can't be compensated. This is probably the simplest way to get something that 'works-ish' though. People use similar (smaller) setups for realtime room/speaker compensation filters and it seems to work alright, and this application isn't too far off from that. In fact, you might want to do that too.
There's an analog solution too, your RPi or microcontroller can manage an array of variable gain amplifiers (using a slow / cheap multichannel DAC) or programmable gain amplifiers (directly with I2C or SPI) which form the inputs to a traditional summing mixer circuit. Then you don't need to worry about processing some dozens of megabits of audio data with low-ms of latency and just need to set appropriate gains, but the analog design is a bit more complicated. Still, this is IMO much easier than an ADC -> FPGA -> DAC pipeline.
Prototyping SMT parts you can either buy protoboards with the chip mounted and pins for use with a breadboard, SparkFun and AdaFruit make tons of modules like this, or try AliExpress, and you can find devboards for pretty much any microcontroller or FPGA too. If the chip you need to work with doesn't have such a board available, you can get generic breakout boards for most SMT packages and solder the chips on yourself. It's not that difficult, though it takes decent equipment and a bit of practice. Having custom PCBs made is also super cheap now, and that is how I would recommend approaching this, if you're willing to tackle the soldering challenge and don't' mind the somewhat long iteration cycle as you wait for boards to arrive from Asia (or don't mind paying for premium shipping or a more-local manufacturer).
> Full-pipeline latency could be problematic, especially if you need to stay in sync with the TV and whatnot […]
Since these multichannel audio interfaces are usually intended for real time music production or live stage setups, you should be able to get low two digit milliseconds of latency, at least if you do it on a PC. That should be good enough to keep everything in sync. No idea how much latency you would get on a Raspi though.
> There's an analog solution too […]
Yes, of course there is, but chances are this will be more expensive if you build it for that many channels and it almost certainly also needs more energy and PCB space. The biggest problem though: the original requirement sounded like every output needs its individual "submix", so the complexity would quickly explode. You also cannot easily add e.g. delay compensation or digital EQ / FIR filter for room compensation if you later figure out this would be useful. You don't have these problems in the digital domain.
> Then you don't need to worry about processing some dozens of megabits of audio data with low-ms of latency […]
To be fair, if you do this on an FPGA, even small <$10 ones will be fast enough to mix hundreds of channels with one sample latency or if you use different clocks for the ADCs and DACs even less than one sample latency. That's even significantly faster than any "professional audio interface" based solution.
> Still, this is IMO much easier than an ADC -> FPGA -> DAC pipeline.
I'm not so sure about that. With the purely analog solution, you have to deal with all the analog problems like potential need for calibration of amplifier gains and noise being introduced in every step as well as the layouting/routing/manufacturing/power consumption of the potentially big circuit. With the digital solution, you have to deal with ADCs/FPGA/DACs, which is essentially not much more than "copy the minimal FPGA schematic from some eval board and copy the ADC/DAC schematic from the respective datasheet". In the end it's just a different set of challenges, but I don't think the analog solution is significantly easier to build.
> Having custom PCBs made is also super cheap now, and that is how I would recommend approaching this, if you're willing to tackle the soldering challenge […]
Don't forget that machine assembly is also super cheap now at least if you order in Asia, which removes almost all of the "soldering challenge" since usually only a hand full of big THT components like connectors will remain for you to solder manually.
You are correct. I need submixes for each channel. And, I mis-counted my inputs, and will nix an output, but that still leaves me with a 16x16 mess.
I've spent the weekend looking into this. I would love to build my own, but I'm not sure where to start with the FPGAs. What FPGA would you suggest that I check out for this application? I don't mind buying stuff and experimenting, I just need to know which direction to explore!
Thanks for your comments!
If I can get this to work, I'll definitely open-source my results!
If you want to experiment with FPGA, the Lattice iCE40 series is a good starting point. It's not super capable (but will be more than enough for your project), but it was one of the first with a solid open source toolchain and has a strong open source / open hardware community as a result. It's also quite cheap.
> The biggest problem though: the original requirement sounded like every output needs its individual "submix", so the complexity would quickly explode. You also cannot easily add e.g. delay compensation or digital EQ / FIR filter for room compensation if you later figure out this would be useful. You don't have these problems in the digital domain.
I definitely missed this, that makes it totally untenable in analogue domain as anything other than a ridiculous art project or back when it was the only way to do it.
The digital solution is much more flexible and once you get the pipeline running and understand how it all works, much easier to modify. I mention the analogue option only to offer an alternative, possibly more intuitive / easier to get started and experiment with option. Even in the simple mixer case, it's still probably not a viable solution for a real product, the digital stuff is so cheap now.
> I don't think the analog solution is significantly easier to build.
It's not just building it, but the learning curve. OP seems to have no electronics or DSP knowledge at all. Maybe it's my own background clouding my evaluation here, but bootstrapping even a passthrough ADC -> DSP/FPGA -> DAC pipeline to the point where it works sounds like a near-herculean task for someone without experience of either domain. For practical purposes it more or less requires custom PCBs which is its own learning curve, and even a basic FPGA is going to have non-trivial power, layout, and bitstream storage requirements to get right, which requires reading layout / power / app notes & datasheets. Then you need to learn the vendor's tooling and how to set up PLLs and design a clock scheme for the system, learn an HDL - which tends to be very unintuitive for software folks, with a steep learning curve of its own. Finally, you can eventually get to fooling around with your basic noop pipeline, but that is a loooong way from the word go to thinking about the problem you came in with.
It won't be, relatively speaking, any good, but lashing up a simple additive mixer with a couple opamps on a breadboard will get you something to start iterating on. In the end it might not be any easier to get to a final solution, but personally at least I find this kind of iterative improvement much easier than brick wall after brick wall with little to show for it. Especially given they want an 8x8 matrix, frankly I think using existing OTS audio interfaces is the only practical solution unless OP is willing to dedicate a man-year of work to the project.
> Don't forget that machine assembly is also super cheap now at least if you order in Asia, which removes almost all of the "soldering challenge" since usually only a hand full of big THT components like connectors will remain for you to solder manually.
I almost mentioned this, and I've done it successfully a bunch of times, but it felt like a bit too much learning curve (lol compared to learning HDL).
> when I was looking at this ~6 months ago, it seemed that most of the options were surface mount
That's because most components today are only available as SMD. Once you play around with higher speed digital chips, breadboards are not really suitable anyway. But don't worry about SMD devices, there are manufacturers like e.g. JLCPCB which build the PCB and assemble it for you if you give them the manufacturing files. In that case you give them your Gerber + placement files and you get a board with all the SMD parts assembled already and you only have to solder e.g. connectors yourself. The board will be indistinguishable from something you'd buy in a commercial device. It's also cheap enough that it's totally fine to do this for prototypes, but it will usually take a while (think of 1-2 weeks) to get the board, so "prototyping" is a bit slow.
If you have no idea about this / never did this before, maybe start with a simple test board where you figure out how to use e.g. KiCAD to design a PCB and how to get it assembled? It's quite easy, but you should be familiar with the process before you attempt to build anything more complex, simply because everything you build costs money in the end and if it doesn't work, it's annoying.
> I didn't think about the RS232 for debugging, but that's a good idea.
In case you wonder why I said RS232, it's probably the simplest protocol (electrical and logical) you can use, which makes it really hard to mess it up. In most cases all you need is an RS232 transceiver chip like an SP3232E and a UART interface on your FPGA/MCU/...
> speakers are not powered
Means: you'll need some amplifiers too. You again have two options: get some cheap commercially available amplifiers and only think about the mixer or completely build it yourself. If you build it yourself, you could look at Class D amplifiers, there are chips which directly translate digital I2S or TDM signals to the PWM signals for the speakers.
> I have a PhD in CS, but I've never worked with FPGAs!
In that case it will be quite the learning curve, because with FPGAs you don't write "software", you essentially describe a digital chip instead. A good starting point would probably be to get one of the cheap FPGA evaluation boards, ideally with an FPGA similar to what you want to use in the end. Keep in mind that if you put an FPGA onto your own board, you'll need some way to program it, like e.g. a JTAG programmer. That's the same with microcontrollers too btw, except you might need an SWD programmer then if it's some Cortex-M MCU. And if you get the one supported by the chip manufacturer (or a cheap Chinese clone of that one), things usually get easier because then it's supported by the development environment of the manufacturer.
> I'll look into the MOTU devices... I had not heard of them before!
You probably didn't hear about that before because it's "pro" audio hardware and not something an average consumer would ever buy/use. In this case it's only line level, so you still need amplifiers for the speakers afterwards. Maybe you'll find something that's even better for your specific use case. For commercially available amplifiers, you could again look at "pro" hardware which usually comes in 19" rackmount cases and sometimes there are even other options for "fixed" installations. That being said, be careful to not get an amplifier which is way too "powerful" for your speakers and you can also waste a lot of money on fancy things you don't need.
I've ordered from JLBPCB before (designed an under-cabinet lighting system for my kitchen complete with PIR sensors and professional-looking installation... it was my first arduino project!) but I'm not too full of myself to admit that I know that it's going to be a learning experience with a few mess-ups along the way. I'm willing to pay for it, too, simply for the joy and enjoyment of learning and actually doing it!
Correct, I knew that I would need multiple amps, but I know that I could do that off-the-shelf as a first step, and perhaps build my own later (with better integration with my smart home).
If you want to build it yourself and if you want to keep it cheap and simple: integrating an ADC or DAC on a custom board isn't that hard, at least if you don't need "perfect" "audiophile" audio quality; usually the datasheets of the ADC / DAC chips already tell you exactly how you're supposed to use them + external components you need and so on. In your case, you'll probably want to use a cheap FPGA for mixing (think of Spartan-6 or newer), since that can easily handle dozens of channels, unlike cheap MCUs which usually don't support the number of channels you'd need. With MCUs the limit isn't necessarily how much you could mix in software, but how many ADC/DAC channels you can physically attach to the chip. For zigbee (or whatever network protocol you prefer) you can find dozens of small chips which can interact with that. Since it sounds like your system is wired anyway, you could also think about Ethernet for the network. When you start playing around with this, I'd recommend building a simple and minimal prototype first with e.g. a stereo in/out + network, to keep the manufacturing costs low in case you mess up the design, and once this works as intended, build the "full" 14x18ch module. Don't forget to add some simple debug port like e.g. RS232, it's cheap to add and it makes your life during development much easier.