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

Thread: Audio Shield Capabilities

  1. #1
    Junior Member
    Join Date
    Mar 2021
    Posts
    4

    Audio Shield Capabilities

    Hello all,

    I am planning on doing a music reactive lighting project using the Teensy 4.0 and audio shield. However, I am having trouble figuring out what exactly the audio shield is capable of, as the SGTL5000 datasheet does not provide any information regarding FFT. I would like to send the incoming audio signals to the audio shield via the line in terminals, then use a low pass filter to cut off any frequencies above 22.5kHz. After the signal is filtered, I would like to sample it (ADC) at a rate of 44.1kHz and then perform an FFT function to group the incoming frequencies into various bands that I can then use to generate lighting control signals. Anyways, my question is regarding the audio shield. Is the audio shield capable of performing the filtering, ADC, and FFT? And if so where can I find additional information about this? As I stated earlier, I have already looked through the SGTL5000 datasheet and was not able to find what I was looking for.

    Thank you!

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,283
    That has nothing to do with the audio shield In fact, you can use almost any I2S audio device.
    The Audio shield just has some advantages like an equalizer in hardware - and its quite good.

    FFT,filtering etc can be done with the audio library. https://www.pjrc.com/teensy/td_libs_Audio.html
    I'd watch the video.
    When you start the audio gui, you'll see some helpful documentation on the right panel.
    Then, it's a good idea to take a look at the examples.
    Last edited by Frank B; 03-09-2021 at 09:11 PM.

  3. #3
    Senior Member
    Join Date
    Jul 2020
    Posts
    980
    The default setting for the Audio library is to sample at 44.1kHz, and internal filters in the ADC in the SGTL5000
    already do anti-aliasing for you - this is standard with any sigma-delta audio ADC in fact.

    You'd just use the I2S input audio object and pipe it to one of the FFT objects - checkout the audio lib tool:
    https://www.pjrc.com/teensy/gui/index.html,
    you'd need at a minimum the i2s input object, sgtl5000 control object and, say, the fft1024 analyze object.

    You then write code to query the fft1024 object for the frequency bins...

  4. #4
    ... and internal filters in the ADC in the SGTL5000 already do anti-aliasing for you - this is standard with any sigma-delta audio ADC in fact.
    I don't see any information re: the sgtl5000 having antialiasing filters on the ADC inputs. I may be missing something???

    Thanks

  5. #5
    Member
    Join Date
    Feb 2020
    Location
    Dublin, Ireland
    Posts
    55

  6. #6
    Senior Member
    Join Date
    Jul 2020
    Posts
    980
    Quote Originally Posted by Neal View Post
    I don't see any information re: the sgtl5000 having antialiasing filters on the ADC inputs. I may be missing something???

    Thanks
    As I said its standard on audio sigma-delta ADCs - its part of the decimation process - otherwise these ADCs would
    be hopeless performers due to the massive amount of quantization noise that's been carefully noise-shaped out of
    the audio band would be folded back in to the audio band again. Internally they are sampling at MHz rates and decimating,
    so it only takes a small on-chip capacitor to anti-alias the raw input at the initial Nyquist rate - the rest is noise-
    shaping and decimation magic!

    Sigma-delta technology is one of those technologies indistinquishable from magic to the outsider!

  7. #7
    Junior Member
    Join Date
    Mar 2021
    Posts
    4
    Mark, thank you for the help. So you're saying that the SGTL5000 already handles anti aliasing on its own when using the ADC? There is nothing that I need to define in my code to make this happen? Unfortunately for this project I am not allowed to use the Audio system design tool as it is for a college project and my professor said that it would be "too easy" to use this tool. So my group and I have to figure out every stage of the process on our own, however, we are allowed to use certain libraries in our code.

  8. #8
    Senior Member
    Join Date
    Jul 2020
    Posts
    980
    All audio sigma-delta ADCs are like this, because they are sigma-delta. Only frequencies up in the MHz region can alias down to baseband,
    so you just need the standard RF filtering of a few 100pF to ground on the inputs really...

  9. #9
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,104
    With every academic project, you need to design your project not only around the stated requirements, but also around the expectations & bias of whomever will be reviewing & grading your work.

    Indeed the inner workings of the SGTL5000 chip are a proprietary secret known only to certain people at NXP (or whatever company Freescale purchased, before NXP acquired Freescale). We're certain it's based on sigma-delta modulation and a digital low pass decimation filter because all modern audio ADCs use that technology, and also because multiple times people have carefully measured its signal delay which is a tell-tale sign of the digital filter.

    Since sigma-delta ADCs have been in widespread use in consumer electronics for about 30 years, and even longer in high-end professional audio, you'd imagine everyone in academia would at least know of sigma-delta. But that may not be a good assumption. There is a lot of not-so-great curriculum about Nyquist sampling which has implicit assumptions rolled in about the way all ADCs were designed long ago, before sigma-delta was feasible.

    Just to be clear, Nyquist sampling absolutely applies to sigma-delta, as it does to all conversion of continuous time signals to discrete time samples. But the implicit assumption that the ADC is necessarily sampling the analog signal at the same rate you get the digital output data is definitely wrong. Anyone who speaks about ADCs as if that is always true has a few decades of electronics practice to catch up. Sigma-delta is complicated, but the basic idea is the ADC oversamples the analog signal at a very high speed. Some chips tell you that detail, but with SGTL5000 we just don't know. With many other chips, oversampling ratios of 64 or 128 are very common, so it's pretty likely the analog acquisition rate where Nyquist sampling theory matters is either 2.8 MHz or 5.6 MHz. The sigma-delta modulator uses an analog integrator in a feedback loop, which allows it to sample with very low resolution but high speed and "noise shape" the low-res errors up into high frequencies. Internally it has a digital low-pass filter which simultaneously discards everything above about 21 kHz and reduces the data rate to what you see at the output. Obviously the chip gives output at 44.1 kHz, but internally the analog sampling where Nyquist theory matters happens at vastly higher rate.

    None of this is written in the SGTL5000 datasheet. It's all based on educated guesswork. For all we know, NXP might be bottling up a magic fairy inside every chip. But odds are pretty strong it internally works the same way as all other modern audio ADCs.

    So I'd recommend talking with your professor as soon as possible to confirm they're ok with your use of a chip lacking clear documentation on how it works internally (which is sadly the norm with so many parts) and to make sure they are at least aware of sigma-delta and analog input oversampling.

Posting Permissions

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