Hey all,
I wanted to share this project with you and ask for advice as well.
First of all, feel free to ask questions or use any resources here presented as you wish, as well as suggesting improvements.
I'm a bit of an audio buff. Not the "virgins in the moonlight" and "golden Ethernet cables" guy, more of a "I want it to measure and sound good" sort of person. I had a chance to work eons ago with an Audio Precision unit at Uni, and it was such a pleasure. However, I didn't like:
- The price
- The fact that it's only windows
- Some proprietary PC - unit interface
I used it mainly to see frequency response on DSP's transfer functions and just fun really.
Years later I bought the QA200 (I guess that was the name), it was a cheap chinese Audio Analyser which worked Ok but it required some .NET BS framework installs, the USB port protocol was proprietary and I could not get it to run on Linux either. By the way, I'm not against Windows, happy to use it at work, but my choice is Linux at home just because after 10+ years I got very used to it. I sold that unit a year or so later after I measured what I wanted to measure (I think it was the output of a Headphone amp and some OpAmp things).
For the last 3 or so years (I move slow) I've been working on an Audio Analyser myself. Requirements:
- STM32 based
- Linux and Windows compatible
- Ethernet IF to the PC (open and easy)
- Have a simple UI that I can expand
The motivation for the above was also that Ethernet is electrically decoupled from the PC (unlike USB). And I get around with LWIP. Plus it's fast. And no drivers required.
I purchased an STM32H7 board (400MHz!) when they first came out 2017 or so with the idea of using it (still am), not knowing it was going to be a PAIN to set up compared to the F7 or F4. But I managed. I had some PCM1793 (DAC) and PCM1802 (ADC) chips at hand (still have) on boards, and I managed to wire all together. Surprisingly enough, after a lot of swearing and sweating, it all worked! I was getting audio data on my PC.
Later I decided to "update" everything to an OS, using FreeRTOS. Also very frustrating experience, especially since STM32 decided to update their libraries and neglected to mention some direction bit that had to be set on the I2S transfer, let alone the bloody MPU issues. But.... I managed yet again!
In the meantime a PCB to be mounted on the STM32H7 Nucleo board was on the way, I purchased all components for 2, built only one, and came across a few hardware bugs that I fixed by removing components and re-wiring OpAmps (the rookie mistake, swapped + and -). But I got it to work!
So there's the hardware mounted on the Nucleo H7, all powered by an 10V AC wall wart (all the power is converted on the board) and connected to my desktop switch.
This is an updated schematic (differs from the actual board, some power supplies have been removed, +/- have been corrected on the OpAmp).
Arduino_codec.pdf (127.13 kB - downloaded 109 times.)
Basic theory of operation so far is:
- Receive a TCP request from the client (he who wants data)
- Generate a pulsed sine signal of a certain frequency and amplitude and send it out on the DAC
- Start grabbing audio on the ADC. Both actions are timed to be able to sync the data
- Start sending the audio input over the TCP stream
- Stop the connection when the requested data amount has been sent
- [Wait for another request/li]
The client is written in Python using PyQt and the plots are using pyqtgraph. This combination seems to be very fast and good for plotting. All FFTs and calcs are done using the python script.
Here's a screenshot of a single synced stereo channel (You can't see the left channel on the bottom graph because it's behind the red, but you can see the tiny differences on the frequency spectrum)
Unfortunately most of the options don't yet work, I'm still working on this. Good news though, I managed to receive and calculate 32K FFT's at 96KHz. It takes a while, but the level of detail is great. Ah, and yes, I still need to add the FFT length options .
I'm working now on the rev. B of the PCB, but I'm a bit unsure how to split the power rails. I need +/-12V for the output signal, so that's a must. Do I just remove those tiny components and build a separate +/-12V power supply? My tendency is to go with the latter. The ADC/DAC 5V supply needs to be derived from the +12V with a linear converter, don't want any switching noise in there...
Do I power the 3V3 and 5VD from the bottom board, needing then an additional 5V supply for the uC? Or do I derive all from the +12V rail?
Not sure how to proceed, your opinions are welcome.
Ok, gotta go prepare dinner, but I'm happy to answer more questions.
Cheers,
Alberto