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

Thread: I2S on Teensy4.1

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

    I2S on Teensy4.1

    Hello Community,
    this is my first post and i read a lot of Threads before.
    Thanks Paul a lot for the grat work on the audio library.
    I did a few different Arduino Hardware Projekts and also Feather impressions at the past.
    Now i want to do a Audio project and in this case a startet fith Teensy

    My Environment:

    - Teensy 4.1
    - Adafruit SPH 0645 I2S Mic.
    - Arduino IDE 1.8.12
    - Audacity 2.3.3
    - Windows 10 Pro 1909

    My Wiring:

    SPH0645 <> Teensy4.1
    LRCL <> 20
    DOUT <> 8
    BCLK <> 21
    GND <> GND
    3V <> 3V
    SLC N.C.


    My Program:
    I got the program from online Audio System Designer:



    Code:
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    
    // GUItool: begin automatically generated code
    AudioInputI2S            i2s1;           //xy=146,135
    AudioAnalyzeRMS          rms1;           //xy=350.00000381469727,291.00000381469727
    AudioAnalyzeFFT1024      fft1024_1;      //xy=357,358.0000057220459
    AudioAnalyzeNoteFrequency notefreq1;      //xy=358.00000381469727,417.0000057220459
    AudioAmplifier           amp1;           //xy=379.00000381469727,109.00000190734863
    AudioAmplifier           amp2;           //xy=379.00000381469727,173.00000286102295
    AudioOutputUSB           usb1;           //xy=628.0000076293945,160.00000190734863
    AudioConnection          patchCord1(i2s1, 0, amp1, 0);
    AudioConnection          patchCord6(amp1, 0, usb1, 0);
    //AudioConnection          patchCord2(i2s1, 0, rms1, 0);
    //AudioConnection          patchCord3(i2s1, 0, fft1024_1, 0);
    //AudioConnection          patchCord4(i2s1, 0, notefreq1, 0);
    
    
    //AudioConnection          patchCord5(i2s1, 1, amp2, 0);
    //AudioConnection          patchCord7(amp2, 0, usb1, 1);
    // GUItool: end automatically generated code
    
    
    
    
    
    void setup() {
      // put your setup code here, to run once:
      AudioMemory(50);
      amp1.gain(1.0);
      amp2.gain(1.0);
      //Serial.begin(115200);
      //Serial.println("started");
    
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
     
       //Serial.print( rms1.read());
       //Serial.println(" rms_1");
    
    }

    My problem / unanderstaning:

    The Teensy appers as digital audio interface in Windows.
    Tried to test it in Audacity and want to record some tracks.

    In silence, the signal shows a relatively high level (see bar at screenshot)
    als the signal in the track shows outliers at regular intervals.

    Click image for larger version. 

Name:	2021-04-05 16_09_06-Audacity.png 
Views:	10 
Size:	38.6 KB 
ID:	24317

    Does anyone have any guess how I could fix this?

  2. #2
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    533
    Maybe this post helps?

    Paul

  3. #3
    Junior Member
    Join Date
    Apr 2021
    Posts
    4
    Quote Originally Posted by PaulS View Post
    Maybe this post helps?

    Paul
    Thank you Paul,
    the example works very nice and it solved my issues.

    The primarly thing in the example ist the:

    Code:
    filter1.frequency(30); // filter out DC & extremely low frequencies
    just for my understanding,
    was my behavior really just "DC & extremely low frequencies" ?

  4. #4
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    533
    Quote Originally Posted by Max1990 View Post
    was my behavior really just "DC & extremely low frequencies" ?
    Most probably yes. But you can easily verify that by commenting out the line filter1.frequency(30); // filter out DC & extremely low frequencies and check again with Audacity.

    Paul

Posting Permissions

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