Configuration Audio card via interface

DOY38

Well-known member
Hello,
I have a Teensy card 4.0 and a audio card REV.D and I would like to have this configuration
1725872647159.png


Is this configuration correct ? I work with a single mono input (either the left or the right)
1725873235589.png


Thank you for your helps

Regards
 
Last edited:
Hard to say without more detail of your intended application. It's correct for processing a mono signal, though you're not doing any processing apart from anything the SGTL5000 is doing internally, and outputting your mono signal on two outputs. Your top diagram is incomplete - what you've done is this:
forum-75810.png
 
Hard to say without more detail of your intended application. It's correct for processing a mono signal, though you're not doing any processing apart from anything the SGTL5000 is doing internally, and outputting your mono signal on two outputs. Your top diagram is incomplete - what you've done is this:
View attachment 35713
I'm just trying first to familiarize myself with the tool (Audio System Design Tool), with the LINE_IN, I can use a frequency generator and see in the I2S_DOUT.
After my understanding your green line leaves I2S_DIN -> LINEOUT, but I think I don't want to do this. So after this 'info' AudioOutputl2S2 is the LINEOUT, right ?
1725878491800.png

I need LINE_IN -> ADC -> Audio Switch -> I2S_DOUT. Thus where I can find the module corresponding to I2S_DOUT. After your previous picture the red line is : LINE_IN -> ADC -> Audio Switch -> I2S_DOUT. So In this case I'll have only this configuration :
1725879545850.png

It's a bit strange that there is no connection of the module i2s1 ?
 
Last edited:
Ah ... I missed that i2s2_2 is an AudioOutputI2S2 object ... it's all a bit confusing to start with :unsure:

The audio adaptor uses AudioInputI2S and AudioOutputI2S, not the I2S2 ones. If you start from a blank Design Tool and place one of each, they'll be named i2s1 and i2s2, which you might reasonably think means i2s2 is an AudioOutputI2S2 object, but if you select it and check the Info pane, you'll see the correct Type shown. My drawing of what I thought you'd done / intended corresponds to this:
1725880829305.png

This design:
1725880908672.png

does correspond to your original drawing with only the red line. As you say, the incoming signal goes nowhere, which is unlikely to be useful! Obviously you don't have to send input straight to Line Out, but it's probably a good start to check you can get an input through the system.

Note that the SGTL5000 I2S_DOUT goes to an AudioInputI2S object - it's out of the SGTL5000 and in to the Teensy audio system.

You can find a lot of information on the Teensy Audio Library page. If you have issues, please post a small sketch, using the </> button to put the code into "code tags" which ensures good formatting and no loss of information. Like this:
C++:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioInputI2S            i2s1;           //xy=388,50
AudioOutputI2S           i2s2;           //xy=571,49

AudioConnection          patchCord1(i2s1, 0, i2s2, 0);
AudioConnection          patchCord2(i2s1, 0, i2s2, 1);

AudioControlSGTL5000     sgtl5000_1;     //xy=570,107
// GUItool: end automatically generated code
 
Hi,
I don't need LINE_IN -> LINEOUT. I think this configuration is fit for my application. A little strange, with a blank Design I have i2s2_1 and it's not the same figure you showed me (you have i2s2).
1725882735301.png

How to delete all and have a new blank Design ? This configuration corresponds to : LINE_IN-> ADC -> AudioSwitch -> I2S_DOUT, right ? In your code, how to make sure the signal is configured like this : LINE_IN-> ADC -> AudioSwitch ? Probably I have to look at the SGTL5000_1 prototype. In the ADC you can have a gain and the signal LINE_IN can pass through the DAP and also you may also have an unwanted extra gain.
 
Last edited:
I'm just trying first to familiarize myself with the tool (Audio System Design Tool), with the LINE_IN, I can use a frequency generator and see in the I2S_DOUT.

This 31 page tutorial is the best way to come up to speed on the design tool and basics of the audio library.


There is also a 45 minute full walk through video, so if you get stuck on any part or just prefer to watch rather than read and actually do the tutorial, you have that option. Of course doing it actually hands-on usually is the best learning experience.


It's a bit strange that there is no connection of the module i2s1 ?

Yes, indeed that is a bit strange. But it's what your red arrow in msg #1 shows. The audio comes into the Line IN pin and gets turned into digital data, which flows to I2S_DOUT (but the red arrow doesn't point to anything, just goes off the left edge of the image). That "i2s1" node on the design tool is the digital data flowing into Teensy. But like that red arrow, the digital audio data doesn't actually go anywhere or do anything. Normally you would connect it to something useful, like FFT analysis or perhaps to filters and effects which modify the sound, and then send it somewhere you can hear the result.

Again, I would highly recommend doing (or just reading / watching) parts the tutorial. For example, parts 2-6 on page 18 shows using the I2S input with a mixer and delay to create an echo effect. Or parts 2-7 shows using it with filters. Or in part 3 the tutorial shows how to analyze the audio data and get the results in your program.

So far you've only asked about converting the analog signal to digital data, which of course is important and that's what the audio shield hardware does and the I2S input feature of the audio library receives... but just getting the digital data into Teensy without actually using it in some way is pretty much pointless. Please do yourself a huge favor and at least skim through the tutorial so you can get a better idea of how to actually use the audio library in useful ways.
 
Last edited:
I'm just trying first to familiarize myself with the tool (Audio System Design Tool),
What Paul said ... trying to jump straight in with "your application" is a poor way of familiarising yourself with the Teensy audio system. The Design Tool is just one part of that.
I don't need LINE_IN -> LINEOUT. I think this configuration is fit for my application.
As you don't say what your application is, I can't express an opinion.
I can modify this

But the ID is always the same (i2s2_1)
The ID is entirely irrelevant (it's just the Design Tool's way of tracking the objects you've placed). All you are doing is change the name by which the object will be known when you export it to a sketch. The Design Tool provides no way to change a placed object's Type, so you have to delete it and replace it with the Type you want, and the re-wire all the connections.
 
But like that red arrow, the digital audio data doesn't actually go anywhere or do anything.
Of course you're right but I forgot to specify that I wired the pins : SDA, SCL, MCLK, SCLK, LRCLK, +3V, GND, DIN/TX, DOUT/RX between the Audio card and the TEENSY 4.0 card. In this case the digital data will be recovered by the TEENSY card. Of course, I watched the video and read the documentation but there is information that I do not use in my application (probably I have to watch it again).
 
Last edited:
In this case the digital data will be recovered by the TEENSY card.

Yes, and that exactly what happens by placing the I2S node on the design tool, which ultimately causes this line in your program:

Code:
AudioInputI2S            i2s1;           //xy=388,50

This line causes an instance of the AudioInputI2S class to be created. When your program runs, it transmits the clock signals (MCLK, BCLK, LRCLK) and receives whatever data the audio shield transmits.

But that by itself is not so useful. You just get the data delivered to data buffers inside Teensy, which aren't actually used for anything. Those buffers inside AudioInputI2S just keep getting overwritten as more audio samples arrive. To actually use the digital data, you need to then connect the I2S node in the design tool to other audio processing nodes which actually do something, to actually make use of those audio samples which AudioInputI2S receives. Several of the tutorial parts demonstrate this, so yes, best to review the tutorial again.

You could also do much better here on this forum by providing some context about what you're actually trying to accomplish. We're real humans here (not dumb AI chat bots), and some of us like @h4yn0nnym0u5e have vast practical experience. But that experience does little to help if we can't understand what you're really trying to do. When you ask only narrowly focused tech questions, unless we manage to guess what you're up to, the best case scenario is correct answers which are limited to that narrow focus. Especially if you're not yet familiar with how the software works, it's hard to know exactly what narrowly focused questions to ask. You'd do much better by giving us some context. We're much better at truly helping when we can understand what you really need.
 
Back
Top