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

Thread: Teensy 3.5 stereo input not giving any output when it feels like

  1. #1

    Teensy 3.5 stereo input not giving any output when it feels like

    Code:
     
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    
    
    // GUItool: begin automatically generated code
    AudioInputAnalogStereo   adcs1;          //xy=895.7777913411458,3966.2223307291665
    AudioFilterBiquad        biquad1R;       //xy=1164.3334197998047,4005.111227989197
    AudioFilterBiquad        biquad1L;       //xy=1171.6666259765625,3892.888671875
    AudioAmplifier           amp1L;          //xy=1333.6666259765625,3874.888671875
    AudioAmplifier           amp1R;          //xy=1343.4443893432617,3994.555395126343
    AudioAnalyzePeak         peakR;          //xy=1425.6666259765625,4262.888671875
    AudioOutputUSB           usb2;           //xy=1579.6666259765625,3957.888671875
    AudioAnalyzePeak         peakL;          //xy=1583.6666259765625,3722.888671875
    AudioConnection          patchCord1(adcs1, 0, biquad1L, 0);
    AudioConnection          patchCord2(adcs1, 1, biquad1R, 0);
    AudioConnection          patchCord3(biquad1R, amp1R);
    AudioConnection          patchCord4(biquad1L, amp1L);
    AudioConnection          patchCord5(amp1L, peakL);
    AudioConnection          patchCord7(amp1R, peakR);
    AudioConnection          patchCord6(amp1L, 0, usb2, 0);
    AudioConnection          patchCord8(amp1R, 0, usb2, 1);
    // GUItool: end automatically generated code
     
    
    void setup()
    {
    AudioMemory(12); //added after initial post, tested and same issue	
    return;
    	 
    }
     
     
    elapsedMillis fps;
    elapsedMillis timerZxx;
    int settingCheckCounter = 0;
    long counterPersecond = 0;
    void loop()
    {
    
    
    }
    For the life of me I'm not sure why this code doesn't work. IF i change it to mono it works but does not in stereo input. Any ideas?
    It's the basic audio tool code, nothing else included.
    Last edited by donperryjm; 09-24-2021 at 07:11 PM.

  2. #2
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    651
    You should at least give it some AudioMemory to work with, like:
    Code:
    void setup() {
      AudioMemory(12);
    }
    See also the example at File > Examples > Audio > Effects > Filter

    Paul

  3. #3
    Thank you paul. While trimming the code I mistakenly removed that.
    I'm going to edit original post to include the audio memory if tested and still not working.

  4. #4
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    651
    I think you also need to set some parameters for the biquad filters and the amps. See the "Filter" example I mentioned above.

    Paul

  5. #5
    OK. I had those in as well, will put them back.

    Don't think those preventing it from working though, just tested on another PC and the audio is coming through.
    It works ok on another PC, but this is not the first time I'm seeing this on this other PC. I wonder if it has to do with USB bus speed or something like that?

  6. #6
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,235
    Quote Originally Posted by donperryjm View Post

    For the life of me I'm not sure why this code doesn't work. IF i change it to mono it works but does not in stereo input. Any ideas?
    It's the basic audio tool code, nothing else included.
    You need at least one class that generates regular interrupts to fire up the whole audio library - try adding one of
    the I2S classes. I suspect the mono and stereo analog inputs differ in this.

  7. #7
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    651
    Hi Mark,

    Just curious: doesn't the AudioOutputUSB class generate interrupts to fire up the audio library?

    Thanks,
    Paul

  8. #8
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,235
    Pretty sure it doesn't from what I've seen here (not played with it myself)
    USB doesn't run on a 44.1kHz clock, so I presume it can't do the timing for the library like the I2S hardware.

    If you start with one of the audio examples from those provided with Teensyduino you'll have a good starting place.

  9. #9
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    651
    Thanks. I looked before at the example at File > Examples > Audio > HardwareTesting > WavFilePlayerUSB since it uses the AudioOutputUSB class.
    I guess the AudioPlaySdWav class generates the required interrupts?

    Paul

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    25,060
    Quote Originally Posted by donperryjm View Post
    OK. I had those in as well, will put them back.
    Could you post the complete program with all the missing filter initialization?

    The forum allows only 2 hours to edit an old message, so you'll need to just reply with the code again.

    Please, before you post again, open a new blank Arduino window and copy the exact code from your post... as any of us will do when trying to help you. I know it's tempting to skip this seemingly unnecessary step, but as you can already see posting an untested trimmed program causes all of us to waste time and hinders any investigation of what is really going wrong.

    On your next reply, please go to the effort to actually verify the code in your message really does reproduce the problem.



    Don't think those preventing it from working though, just tested on another PC and the audio is coming through.
    Are these PCs running Linux or Windows? Which version? What software are you using on the PC to listen to the incoming USB audio? These details may or may not matter. But again, when you post another message, please try to think in terms of allowing me or anyone else reading to exactly reproduce the same error.



    Quote Originally Posted by PaulS View Post
    Just curious: doesn't the AudioOutputUSB class generate interrupts to fire up the audio library?
    .....
    I guess the AudioPlaySdWav class generates the required interrupts?
    Nope, neither AudioOutputUSB nor AudioPlaySdWav generates interrupts for "update responsibility" in the audio library. But AudioInputAnalogStereo does, so I'm pretty sure that's not the issue.

    You are correct about the missing filter config. An unconfigured biquad filter defaults to all zeros for its coefficients, so the code in msg #1 will not pass any of the input audio. This is why it's so important to actually run the trimmed program before posting!

  11. #11
    Are these PCs running Linux or Windows? Which version? What software are you using on the PC to listen to the incoming USB audio? These details may or may not matter. But again, when you post another message, please try to think in terms of allowing me or anyone else reading to exactly reproduce the same error.
    All are running the same windows 10 OS, all used to run the same sketch and have no issue.
    I suspect this issue is some deep rooted USB audio issue, something to do not just with teensy but more so with windows.
    I've tested more than 500 T3.5 on this system.
    If I load the simple sample audio sketch the problem still exists.

    edit: tested it now and it's working fine again

    @Paul, if the problem persists I'm willing to let you remote into my machine and look around.
    Last edited by donperryjm; 09-29-2021 at 05:23 PM.

Posting Permissions

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