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

Thread: Teensyduino: Missing Audio.h

  1. #1
    Junior Member
    Join Date
    Dec 2018
    Posts
    18

    Teensyduino: Missing Audio.h

    Hello,

    I am running Arduino 1.8.7 with teensyduino 1.5.0, however I do not seem to have the Audio examples, or the ability to include the Audio.h file in my sketches ("Audio.h: No such file or directory").

    I read here https://www.pjrc.com/teensy/td_libs_Audio.html that Audio is included in the installer. I tried installing the Catalina standalone version of teensyduino/arduino (I'm running OS 10.13.6) and had the same issue.

    Am I missing something basic?

    Thank you!

  2. #2
    Junior Member
    Join Date
    Dec 2018
    Posts
    18
    I've since upgraded to Arduino 1.8.13 and Teensyduino 1.53 to make sure that my versions are compatible. I was still not able to locate the Audio library. I have since tried installing the library manually from github by loading the zip file into the arduino IDE.

    The examples show up now, however when trying to include the Audio.h file, I receive this error:

    Code:
    In file included from /Users/jj2/Documents/Arduino/2020_8_9_PJRCFeatherTest/2020_8_9_PJRCFeatherTest.ino:9:0:
    /Users/jj2/Documents/Arduino/libraries/Audio-master/Audio.h:31:2: error: #error "Teensyduino version 1.20 or later is required to compile the Audio library."
     #error "Teensyduino version 1.20 or later is required to compile the Audio library."
      ^~~~~
    /Users/jj2/Documents/Arduino/libraries/Audio-master/Audio.h:37:10: fatal error: DMAChannel.h: No such file or directory
     #include "DMAChannel.h"
              ^~~~~~~~~~~~~~
    compilation terminated.
    Using library Audio-master at version 1.3 in folder: /Users/jj2/Documents/Arduino/libraries/Audio-master 
    exit status 1
    Error compiling for board Adafruit Feather M4 Express (SAMD51).
    The code I'm running is example code for getting started on an Adafruit Feather M4 using the tonesweep object connected to a DACs object.

    Code:
    /*
      Audio Library on Trellis M4
      Demo of the audio sweep function.
      The user specifies the amplitude,
      start and end frequencies (which can sweep up or down)
      and the length of time of the sweep.
       */
     
    #include <Audio.h>
    // Paste your Audio System Design Tool code below this line:
    // GUItool: begin automatically generated code
    AudioSynthToneSweep      tonesweep1;     //xy=204,158
    AudioOutputAnalogStereo  Audio_Output;          //xy=390,148
    AudioConnection          patchCord1(tonesweep1, 0, Audio_Output, 0);
    AudioConnection          patchCord2(tonesweep1, 0, Audio_Output, 1);
    // GUItool: end automatically generated code
    //
     GUItool: end automatically generated code
     
    float t_ampx = 0.05;  // Amplitude
    int t_lox = 10;  // Low frequency
    int t_hix = 22000;  // High frequency
    float t_timex = 10; // Length of time of the sweep in seconds
     
     
    void setup(void)
    {
     
      Serial.begin(9600);
      //while (!Serial) ;
      delay(3000);
     
      AudioMemory(6);
     
      Serial.println("setup done");
     
      if(!tonesweep1.play(t_ampx,t_lox,t_hix,t_timex)) {
        Serial.println("AudioSynthToneSweep - begin failed");
        while(1);
      }
      // wait for the sweep to end
      while(tonesweep1.isPlaying());
     
      // and now reverse the sweep
      if(!tonesweep1.play(t_ampx,t_hix,t_lox,t_timex)) {
        Serial.println("AudioSynthToneSweep - begin failed");
        while(1);
      }
      // wait for the sweep to end
      while(tonesweep1.isPlaying());
      Serial.println("Done");
    }
     
    void loop(void)
    {
    }

  3. #3
    Member
    Join Date
    Aug 2018
    Location
    Brisbane, Australia
    Posts
    24
    On my machine with the same versions as you, it is installed here

    /usr/share/arduino/hardware/teensy/avr/libraries/Audio/Audio.h

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    12,190
    On Windows unzip install I find it here for same versions: "T:\arduino-1.8.13\hardware\teensy\avr\libraries\Audio\Audio.h "

    But error is not missing that file - but finding it and saying this file included there is missing ::
    Code:
    /Users/jj2/Documents/Arduino/libraries/Audio-master/Audio.h:37:10: fatal error: DMAChannel.h: No such file or directory
     #include "DMAChannel.h"
              ^~~~~~~~~~~~~~
    But first - if TeensyDuino is 1.53 - this error should not be showing?
    Code:
    /Users/jj2/Documents/Arduino/libraries/Audio-master/Audio.h:31:2: error: #error "Teensyduino version 1.20 or later is required to compile the Audio library."
     #error "Teensyduino version 1.20 or later is required to compile the Audio library."
    And :: libraries/Audio-master
    shows this is a private local copy of the Audio library from github - not the TeensyDuino installed version?

    That should not be needed with a valid and complete TeensyDuino install.

  5. #5
    Junior Member
    Join Date
    Dec 2018
    Posts
    18
    Quote Originally Posted by defragster View Post
    On Windows unzip install I find it here for same versions: "T:\arduino-1.8.13\hardware\teensy\avr\libraries\Audio\Audio.h "

    But error is not missing that file - but finding it and saying this file included there is missing ::
    Code:
    /Users/jj2/Documents/Arduino/libraries/Audio-master/Audio.h:37:10: fatal error: DMAChannel.h: No such file or directory
     #include "DMAChannel.h"
              ^~~~~~~~~~~~~~
    But first - if TeensyDuino is 1.53 - this error should not be showing?
    Code:
    /Users/jj2/Documents/Arduino/libraries/Audio-master/Audio.h:31:2: error: #error "Teensyduino version 1.20 or later is required to compile the Audio library."
     #error "Teensyduino version 1.20 or later is required to compile the Audio library."
    And :: libraries/Audio-master
    shows this is a private local copy of the Audio library from github - not the TeensyDuino installed version?

    That should not be needed with a valid and complete TeensyDuino install.
    Thanks for your replies. I am also confused as to why I am seeing the error about TeensyDuino version 1.2. When I go to Arduino >> About I am able to see that the correct version (1.53) is being referenced:

    Click image for larger version. 

Name:	Screen Shot 2020-08-10 at 11.25.44 AM.png 
Views:	2 
Size:	72.0 KB 
ID:	21337

    I also looked in the Audio.h file that I am referencing, and see that on line 7 it calls to include the DMAChannel.h file. Where should this be located?

    I am attempting to follow this guide: https://learn.adafruit.com/synthesiz...s?embeds=allow

    Thanks in advance for any further help.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,467
    Check the Tools > Boards menu. Any chance you have a non-Teensy board selected?

    Arduino changes where it looks for files depending on what platform/board you choose in that menu.

  7. #7
    Junior Member
    Join Date
    Dec 2018
    Posts
    18
    Quote Originally Posted by PaulStoffregen View Post
    Check the Tools > Boards menu. Any chance you have a non-Teensy board selected?

    Arduino changes where it looks for files depending on what platform/board you choose in that menu.
    Yes, I am using an adafruit Feather M4 express, and following this guide: https://learn.adafruit.com/synthesiz...s?embeds=allow

    The above guide is for the Neotrellis button pad, however I was told that it should work with the Feather M4 as well. If I should be asking for help over at Adafruit instead of here, please let me know.

    Thanks again.

  8. #8
    Junior Member
    Join Date
    Dec 2018
    Posts
    18
    I see now that there is a page prior to where I linked, that requires installation of a forked version of the library. Sorry for the confusion, and thanks for your replies.

  9. #9
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    12,190
    Yes, that would be an AdaForum quesion for :: 2020_8_9_PJRCFeatherTest/2020_8_9_PJRCFeatherTest.ino

    They make a feather shield for Teensy - should have asked about that rather than let it slide. The M4 isn't related to PJRC.

    Go into the Library Manager and check for Library updates. I let a board sit 1 month after updates and there were 14 pulled in libraries it updated the other day when checked. It also brings in related needed libraries.

    Be aware of local sketchbook\libraries - they can get in the way. Careful reading of the 'verbose' console output has lots of detail.

  10. #10
    Junior Member
    Join Date
    Dec 2018
    Posts
    18
    thank you for the suggestions. I think my confusion stemmed from not knowing that the Arduino Examples menu is populated based on the board that's selected.

Posting Permissions

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