Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: Audio Library - Output audio through SPI DAC chip.

  1. #1

    Audio Library - Output audio through SPI DAC chip.

    Short version :
    Will there ever be a support for outputting audio to DAC chips via SPI?
    How would I write a driver/module that I can use as a module that does such thing?


    Slightly longer version:
    By design choices, I choose not to use any SMD ICs on my board.
    I have my teensy 4.0s that do not have dacs, but I really want/need them to output audio without having to use the audio shield. I have myself a couple of MCP4822s (SPI DAC) that I am trying to stream audio to, but I having hard time even imagining where to start. I did read through output_dac.cpp source file too, but I'm not sure if my coding skills are THAT high to understand whats going on . (but I will)


    I can probably find resources to learn how to make my DACs make sounds via SPI, but the problem is how I can use Audio Library at the same time. I.e. write a new module that acts as if its one of the patchable module from the library.

    Im trying not to blindly ask for how to do everything, and trying to at least attempt it first. So I'll ask a few questions instead.

    1. Why isn't it supported / ideal to output audio by SPI to DAC? efficiency? quality? noone requested?
    2. What makes it *difficult* to stream audio through SPI DAC?
    3. I'm seeing if I can modify output_dac.cpp so I can make it output audio to external DAC chip instead of onboard DAC. I haven't understood a lot of it but I'll try. Could I get any guidance or tips on where I should start looking?

    Thank you guys,
    You are all stars.

    Jin








    P.S. I do not mind having to sacrifice sample rate - I can pretend I intended lo-fi sound lol. Probably would want it more if it was.

  2. #2
    Senior Member
    Join Date
    Feb 2017
    Posts
    418
    How do you propose to synchronize the sample rate transfer over SPI to the Audio Library's sampling rate (even if you use a lower rate)?

  3. #3
    Senior Member
    Join Date
    Jun 2018
    Posts
    127
    By design choices, I choose not to use any SMD ICs on my board.
    So you need to hand solder? Sure, you don't want SMD but that doesn't explain why SPI... Why not use I2S, the standard for digital audio?

  4. #4
    Quote Originally Posted by gfvalvo View Post
    How do you propose to synchronize the sample rate transfer over SPI to the Audio Library's sampling rate (even if you use a lower rate)?
    Recklessness aside, I do not know.. I was kind of hoping I someone would give me an idea.
    Do you reckon this would be efficiently possible if I didn't use the audio library?

    Quote Originally Posted by JayShoe View Post
    So you need to hand solder? Sure, you don't want SMD but that doesn't explain why SPI... Why not use I2S, the standard for digital audio?
    Sorry for the late reply -
    because there literally wasn't any audio DAC ICs, that is also DIP. At least I couldn't find one that I can realistically get my hands on. Am I missing something??

  5. #5
    Senior Member
    Join Date
    Feb 2017
    Posts
    418
    Quote Originally Posted by jidagraphy View Post
    Do you reckon this would be efficiently possible if I didn't use the audio library?
    Given the lack of requirements, specifications, and other details, it's impossible to say.

  6. #6
    Member
    Join Date
    Sep 2020
    Location
    Massachusetts
    Posts
    50

    SPI-controlled DAC

    I have a Digilent PMOD DA4 (SPI pmod). It took me a long time to learn how to use it reliably, but now I can make it do whatever I want with a Teensy 4. I wanted 8 channels of DAC (at a medium-low resolution). (I don't bother using Digilent's development platform. ) These little boards like 3.3v.

    If anyone would like to see the code I got working, it's a combination of several examples for the Arduino platform.

    I'm pretty sure I could use other Digilent PMOD cards much the same way. (They have a variety of AD DAC boards.)

    But yes, I suppose keeping SPI running fast while doing other audio things is just another ball to keep in the air.
    Last edited by blakeAlbion; 09-07-2020 at 01:12 PM. Reason: addendum

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •