The STM32 Makes For A Cheap DIY USB Soundcard

Soundcards used to be giant long 8-bit ISA things that would take up a huge amount of real estate inside a desktop computer. These days, for most of us, they’re baked into the motherboard and we barely give them a second thought. [Samsonov Dima] decided to whip up a cheap little sound card of their own, however, built around the STM32.

The soundcard is based specifically on the STM32F401. readily available on the “Green Pill” devboards. A digital-to-analog converter is implemented on the board based on two PWM timers providing high-quality output. There’s also a simulated software sigma delta ADC implemented between the audio streaming in via USB and the actual PWM output, with some fancy tricks used to improve the sound output. [Samsonov] even found time to add a display with twin VU meters that shows the audio pumping through the left and right channels.

Without test gear on hand, we can’t readily quantify the performance of the sound card. However, as per the Youtube videos posted, it appears more than capable of recreating music with good fidelity and plenty of fine detail.

If you need a cheap, simple USB sound card that you can hack away on, this might be the one for you. If you need something more suitable for a vintage PC, however, consider this instead. Video after the break.

 

14 thoughts on “The STM32 Makes For A Cheap DIY USB Soundcard

    1. That PIC project doesn’t include a DAC. You will need an external one to get sound out of it. What’s remarkable about the first one shown here is that it requires no extra hardware; everything is done by the STM32. The second one incorporates an external DAC (fed by I2S from the STM32 board) and presumably sounds better.

      1. //and presumably sounds better
        It makes better according specs, but because low cost capacitors on i2s board and lack of output power amplifier stm32 itself makes slightly better sound in low frequencies and mostly same in others.

    2. Who in their right mind would use Microchip anymore? They have crushed so many companies with their poor ability to provide parts. They are out of stock on nearly all their parts. So many companies are scrambling to convert designs using MC parts to other brands. I seriously doubt most people will return back to MC.

      1. STMicro isn’t doing any better. Just look at the lead times for STM32 parts. Fortunately there do still seem to be some of the STM32F401 boards out there, though there is the question of whether they contain actual STM32 chips, or have counterfeit chips or substitute parts from other companies.

    1. “Soundcards used to be giant long 8-bit ISA things that would take up a huge amount of real estate inside a desktop computer. ”

      *Sigh* Kids these days. 🙄

      Firstly, “8-Bit ISA” is a questionable term. Like DB9 (vs DE-9).
      ISA was standardized as part of EISA. It’s the 8-Bit portion of ISA that’s meant here. It originated from the IBM PC Model 5150. Before 1987 or so that simply was the PC Bus or PC/XT Bus.
      https://en.wikipedia.org/wiki/Extended_Industry_Standard_Architecture

      Secondly, please define “long”. The 1987 AdLib was short, the Creative Music System (aka Game Blaster), too. Merely as long as the slot itself. Clones of AdLib, like the Rainbow Sound, were small, too.

      The original Sound Blaster wasn’t a full-size cardb, either. It didn’t reach the holding tabs at the front of the chassis.
      If you’re curious, the Hercules Monochrome Graphics Card was full-size (“long”, about 30 cm).
      https://en.wikipedia.org/wiki/Hercules_Graphics_Card

      The Sound Blaster 2.0 was short, too. As was the Sound Blaster Pro.
      The MediaVision Thunderboard, an SB 1.5 compatible, was short, too. Less than half-size, I think.
      https://en.wikipedia.org/wiki/Sound_Blaster
      http://www.amoretro.de/2014/09/media-vision-thunderboard.html

      Even the Sound Blaster 16 from 1992/1993 wasn’t long. Neither was the Pro AudioSpectrum 16.
      The red Gravis Ultrasound from the mid-90s was full-size, as was the Creative Phone Blaster and versions of the SB32/AWE32.
      But they’re not 8-Bit cards anymore, but regular ISA cards with 16-Bit DAC/ADC and Stereo sound.

      Sorry, thise thus don’t fell into the “old stuff” someone can made fun off (“look how far we have come”, that same old tune) .
      In fact, these cards/components had features and sound fidelity that’s not matched by these modern homebrew projects.
      The EMU8000, the SB16 ASP, the GF1.. They’re quite complex.

      *sigh* Never mind. I guess I’m just sick of all that self-congratulation of these days. All that “look we have come so far” mentality. Just because some microcontrollers and some smartphones.

      While in truth, people don’t understand a thing about basics. They don’t read books usually or learn about history. Instead, they watch a tutorial, build something and think they can do anything.

      That alone wouldn’t be bad, but they miss out on the basics. Learn to create something with their bare hands, sit down a moment, do some cognitive self-reflection. It’s easy to look back and judge about old things being “primitive”. People even do that when it comes to people. It’s an attitude that’s not healthy, I think.

      People from 2000 years ago could indeed understand our world and technology, if they’re educated properly, I believe. They’re no cave men whatsoever. But who I’m talking to. No one cares. *sigh*😔

      1. “Far out in the uncharted backwaters of the unfashionable end of the western spiral arm of the Galaxy lies a small unregarded yellow sun. Orbiting this at a distance of roughly ninety-two million miles is an utterly insignificant little blue green planet whose ape-descended life forms are so amazingly primitive that they still think digital watches are a pretty neat idea.”

        ― Douglas Adams, The Hitchhiker’s Guide to the Galaxy

      2. Actual long sound cards did exist. I had a Turtle Beach Multisound Pinnacle back in the day. That card did go all the way to the holding clips in the front of the case. Partly it had to be big to make room for SIMM sockets; it had on-board sample memory so you could load additional MIDI sample sets, including ones that you created yourself.

        I don’t find the term “8-bit ISA” questionable. It’s a useful differentiation from 16-bit ISA cards, which also existed starting with the launch of the PC AT. EISA was another matter; that was a standard for 32-bit cards that used a weird connector with two levels of fingers, allowing an EISA socket to also accept 8 or 16-bit ISA cards.

  1. @Lewin Day said: “The soundcard is based specifically on the STM32F401. readily available on the “Green Pill” devboards.”

    If my whiskey-soaked memory serves, the original “Green Pill” was a “Blue Pill” clone that had a genuine STM32F103 processor on it (not STM32F401) instead of a Chinese fake STM32F103 and a correct 1.5k (not 4.7k) R10 value for the USB D+ line pull-up.[1][2][3] That isn’t to say there aren’t STM32F401 “Pill” form-factor boards using common green PCBs that may even be called “Green Pills” out there. But the original “Green Pill” boards were different.

    No worries though, the “Pill” boards of different colors get mixed up all the time. For example I have a black board bought on Amazon that was advertised as a “Black Pill” but actually had a Chinese fake STM32F103 processor on it instead of a real STM32F401 or STM32F411.[4][5]

    However, I do see one mention of a STM32F401 based “green pill” board on the STM32Duino forum with a schematic.[6] A search on AliExpress did turn up one single “Pill”-like board with a green PCB and a STM32F401CCU6 or STM32F411CEU6 on it, but it was not advertised as a “Green Pill”.[7] That board looks just like the one [Samsonov Dima] used for the USB Soundcard project. Which is fortunate because the hackaday.io BOM for the USB Soundcard project is lacking in detail.

    * References:

    1. Green Pill

    https://stm32world.com/wiki/Green_Pill

    2. Blue Pill

    https://stm32world.com/wiki/Blue_Pill

    3. Blue Pill Pinout & Schematic

    https://uglyduck.vajn.icu/ep/archive/2020/11/STM32__Pill__boards.html#Blue103

    4. Black Pill

    https://stm32world.com/wiki/Black_Pill

    5. Black Pill Pinout & Schematic

    https://uglyduck.vajn.icu/ep/archive/2020/11/STM32__Pill__boards.html#Blk103

    6. STM32F401 “green pill” mention on STM32Duino Forum

    https://www.stm32duino.com/viewtopic.php?f=12&t=1571&p=9972&hilit=green+pill#p9972

    7. STM32F401 Development Board STM32F401CCU6 ($2.65) STM32F411CEU6 ($5.63)

    https://www.aliexpress.com/item/3256801453398060.html

  2. Thank you for the great firmware.
    I built this soundcard as an AM modulator for an old nostalgia tube radio. The only mod in the fw is making the RF carrier freq with a free timer. The analog part is rather simple, a third order lowpass on the delta-sigma output, then a transistor switches the audio signak with the RF carrier. Better the 90% modulation with low distortion. The big ring is a coil, contactless inductive link to the radio.
    Pictures: https://drive.google.com/file/d/1-_0TRkC_M_7A4odZnLwIDqj9MWl5W2NM/view?usp=sharing
    https://drive.google.com/file/d/1Ccrp-eIYUH0ljExsZ83shFhLr6PZWb8r/view?usp=sharing
    https://drive.google.com/file/d/1H0uoHfZpaaHa7bcgUS57mkKUu9mgaprG/view?usp=sharing

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.