Getting Started with Audio DSP - Page 1
Forum section: electronics / general

author: AaronD
author_rank: Frequent Contributor
timestamp: November 30, 2021, 05:50:16 am
content: After two threads that seemedto stall out at the same point, I guess I need to get going.So, what's a good way for an 8-bit PIC/AVR guy to jump into audio DSP? Looking for:USB, at the very least to make a stereo sound card, plus control, which is probably HIDStereo line-level ins and outs (don't need mic)Ease of understanding, starting with practically exclusive experience in the 8-bit world, and making it do things in tight real-timeLow(ish?) cost of entryRoom to expand within the same ecosystemMy current waiting list of projects includes:Single-sideband frequency shifter, as an experiment to reduce acoustic feedback in a live PA. At least one analog line in and at least one analog line out, preferably 24-bit for both at 48kHz, plus a potentiometer to set the shift amount.Potentially non-trivial requirements are:1 ADC channel to read the potInternal quadrature oscillator with sub-10Hz frequency controlled by that potEnough allpass filters (or Hilbert transform?) to keep the entire audio band in quadratureStereo USB sound card with a signal path of: highpass -> gain -> dynamic-range limiter -> crossover -> individual gain -> corrective EQ -> anti-clipping limiters -> TDM -> class-D chip amps to a custom 2.1 set of speakers.Requires:Buttons, encoders, pots, and LED's for a user interface before the crossoverUSB control for the entire signal path, both graphically and from a Raspberry Pi shell script(*), and possible reprogramming as well, in addition to standards-compliant USB audio(*A custom Pi app is okay for this, and might be required anyway for a graphical UI. I've done that before and still have the code, to control an off-the-shelf digital sound board and some remote PTZ cameras in a live broadcast rig.)8-in/8-out USB sound card plus 6 analog channels each direction (3 stereo in, 3 stereo out), with mic and speaker correction, mixing, and hearing/clipping protection. This one is going to be especially interesting in that the mics and speakers are going to be physically close to each other with foam, resin, or some other kind of barrier in between, and their primary purpose is to fill in what the unavoidable acoustic lowpass cuts out. So there may or may not be some feedback prevention in there as well.Requires:Vanishingly low latency from ADC to DAC to avoid a comb filter, which might be the only excuse I can come up with to use a sample rate higher than 48kHz, and probably means that I need to write my own DSP code to process 1 sample at a time instead of using a 64-sample libraryMultichannel USB audio, with much looser time constraints just for monitoring and/or recording various points along the critical chainLike the stereo-to-2.1 sound card, the same USB is also used for control and possibly reprogrammingSome of those projects might be done in isolation with pre-fab libraries or perhaps even off-the-shelf products that already do that, but I really doubt thateverythingcan. So for the sake of learning this world and doing all of these projects at least somewhat consistently, I'd like to DIY all 3.So far, I've seen:Analog Devices' chips and IDE (SigmaDSP and SigmaStudio), which would be wonderful if it weren't for the normally-imperceptible latency (killer for #3) and the glaring lack of on-chip USB audio. (Just a "dumb conversion" between USB and TDM seems to take enough silicon that I might as well do the DSP in there too!)NXP's "Crossover MCU's", which are more general-purpose, not solely for audio DSP, but they easily have enough resources to do it: multichannel USB audio (in theory, haven't actually seen that yet), plus audio comms like I2S and TDM, and lots of GPIO on top of that.XMOS XU series, which is the "semi to move a feather" that I've seen just to add USB to a SigmaDSP chip. It has a weird architecture, which limits the examples of how to use it.I have not, however, seen a good dev board that has the kind of analog audio I/O that I'm looking for. I can roll my own PCB, and I'm pretty sure I will for project #3 at least, but it's probably a better idea to get started with something that hasn't missed a critical support piece out of ignorance!So, given the 8-bit world that I'm coming from, and where I'm trying to go, what would you recommend as a first DSP kit that can at least do project #1 all by itself? And possibly #2 as well, minus the amps. (not at the same time) At that point, I might be ready to put the same chip on a custom PCB to finish #2 and then look at #3.

author: rpiloverbd
author_rank: Regular Contributor
timestamp: December 14, 2021, 12:26:39 pm
content: Did you try the TSA1701 Audio DSP Board? You could also try TDA7294, an excellent power amplifier ... You can read its basics here:https://www.theengineeringprojects.com/2021/01/tda7294-power-amplifier-datasheet-pinout-features-applications.html

author: fourtytwo42
author_rank: Super Contributor
timestamp: December 14, 2021, 03:28:31 pm
content: You could try the ADAU1702 & friends, simple programming with SigmaStudio (free download) simple to use knit together blocks (no DSP coding knowledge required). I built a sub complete with LPF, equalisation & adaptive overload compression in a matter of weeks and have been very pleased with the results for all the years I have been using it. May not tick every box on your list but definitely worth a look IMOP.

author: AaronD
author_rank: Frequent Contributor
timestamp: December 14, 2021, 04:27:41 pm
content: Quote from: rpiloverbd on December 14, 2021, 12:26:39 pmThat's better than what I've seen so far. Looks like actual line level insandouts, and not insanely expensive! But no USB audio, just USB power. Yes, I could add a USB DAC to feed it, but that seems a bit Rube-Goldberg-y. (still not bad if it works though...)Quote from: fourtytwo42 on December 14, 2021, 03:28:31 pmUltimately, I want to be able to write my own DSP code on my own PCB. The first couple of projects could easily be done with an ADAU and SigmaStudio, but that doesn't get me anywhere towards the later one(s) that have some unique needs that are going to be difficult to find a library for. So while Icouldjust knock those "easy" ones out with an off-the-shelf solution, I want to use them instead to build up my skills to where Icanroll my own oddball.I'm a casual Front-of-House and Broadcast Engineer already, so I know what the common processing blocks do and how they sound. Don't need to learn that; just how to make them in software while satisfying my other requirements, and how to manage the chip that does it, in both PCB design and supervisory code.And I'll probably have some CPU time left over, so it's going to be awfully tempting to combine some other functions into that chip as well. Much easier to do that with a general-purpose chip that happens to have some DSP-friendly stuff in it (compared to the 8-bit world, at least), than with a purpose-designed DSP chip.Maybe I'm overthinking this. Doesevery32-bit MCU have what an 8-bit hobbyist might call "DSP functions" as part of the instruction set (more than just a hardware multiplier, which is already a luxury in the 8-bit world), and "audio friendly" peripherals? (specifically I2S and/or TDM) If so, then the question probably changes to, "What is the easiest 32-bit MCU for an 8-bit guy to pick up and run with, and then not be limited by its ecosystem?"That's more along the lines of what I was thinking as, "a good dev board that has the kind of analog audio I/O that I'm looking for." Something to learn a 32-bit MCU on, with USB and line-level audio I/O as the primary focus, then use the same chip in my own designs.

author: oPossum
author_rank: Super Contributor
timestamp: December 14, 2021, 07:14:55 pm
content: An easy to use platform for getting started with audio DSP...https://bela.io/abouthttps://www.youtube.com/c/BelaPlatform/videos

author: AaronD
author_rank: Frequent Contributor
timestamp: December 14, 2021, 08:53:24 pm
content: Quote from: oPossum on December 14, 2021, 07:14:55 pmLooks like it *might* be good for latency, and for arbitrary code, and both analog and digital GPIO's. So far, it's looking pretty good, but I'll have to test the latency to see if I really can get the near-instant response that it claims. (it might also be true that ANY set of converters and their transports inherently have the delay that is claimed for that system overall, meaning that nobody can do any better)I'm a little bit disappointed in having it fixed at 44.1kHz. I'd kinda like to run at 48k because that's what I'm used to with "pro audio" gear, or a multiple of it just to get the latency down that much more. (anything significantly over 40kHz doesn't sound any different, despite what an audiophool might claim, unless you're slowing it down to hear ultrasonics, which I'm not doing)What really makes me wonder though, is the lack of multichannel USB audio. Yes, I know it can't do anywhere near the instant response that is claimed for an analog-to-analog path through that system, just because of how USB itself works, but that shouldn't be a barrier to having it available. I'm sure a lot of people would want to make a "smart USB sound card" at minimum, and maybe send back what a bunch of intermediate stages are doing.If I don't insist on using the same tools for the first project that I'm going to use for the last one, then this would probably do pretty well for the SSB freq shifter, and for falling flat on my face a few times with raw DSP code before I get the nuances right. But without the USB audio, my list of projects would pretty much end with the first one.