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

Thread: Unable to compile Mozzi example for Teensy 3.2

  1. #1
    Junior Member
    Join Date
    Feb 2020

    Unable to compile Mozzi example for Teensy 3.2

    I'm trying to get started with Mozzi on a Teensy 3.2, but I'm getting some errors right off the bat trying to compile the example code. The issue seems to be related the ADC library. I got the library with the latest install of Teensyduino (1.51) yesterday, and I'm trying to compile within the Arduino 1.8.12 editor. I'm also on the latest build of Mozzi, from 22 July 2019. Here's the code:

    #include <ADC.h>
    /*  Example playing a sinewave at a set frequency,
        using Mozzi sonification library.
        Demonstrates the use of Oscil to play a wavetable.
        Circuit: Audio output on digital pin 9 on a Uno or similar, or
        DAC/A14 on Teensy 3.1, or
        check the README or
        Mozzi documentation/API
    		Mozzi help/discussion/announcements:!forum/mozzi-users
        Tim Barrass 2012, CC by-nc-sa.
    #include <MozziGuts.h>
    #include <Oscil.h> // oscillator template
    #include <tables/sin2048_int8.h> // sine table for oscillator
    // use: Oscil <table_size, update_rate> oscilName (wavetable), look in .h file of table #included above
    Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> aSin(SIN2048_DATA);
    // use #define for CONTROL_RATE, not a constant
    #define CONTROL_RATE 64 // Hz, powers of 2 are most reliable
    void setup(){
      startMozzi(CONTROL_RATE); // :)
      aSin.setFreq(440); // set the frequency
    void updateControl(){
      // put changing controls in here
    int updateAudio(){
      return; // return an int signal centred around 0
    void loop(){
      audioHook(); // required here
    This should be identical to the sinewave example provided with Mozzi, with the addition of the ADC include up top. I did try compiling without it and got the same results. Here's my error output:

    Arduino: 1.8.12 (Windows 10), TD: 1.51, Board: "Teensy 3.2 / 3.1, Serial, 48 MHz, Fast, US English"
    C:\Program Files (x86)\Arduino\libraries\Mozzi-master\MozziGuts.cpp: In function 'void startAudioStandard()':
    C:\Program Files (x86)\Arduino\libraries\Mozzi-master\MozziGuts.cpp:503:8: error: 'class ADC' has no member named 'setAveraging'
    C:\Program Files (x86)\Arduino\libraries\Mozzi-master\MozziGuts.cpp:504:8: error: 'class ADC' has no member named 'setConversionSpeed'
    C:\Program Files (x86)\Arduino\libraries\Mozzi-master\mozzi_analog.cpp: In function 'void setupMozziADC(int8_t)':
    C:\Program Files (x86)\Arduino\libraries\Mozzi-master\mozzi_analog.cpp:74:7: error: 'class ADC' has no member named 'enableInterrupts'
    C:\Program Files (x86)\Arduino\libraries\Mozzi-master\mozzi_analog.cpp: At global scope:
    C:\Program Files (x86)\Arduino\libraries\Mozzi-master\mozzi_analog.cpp:140:13: warning: 'void adcSetChannel(uint8_t)' defined but not used [-Wunused-function]
     static void adcSetChannel(uint8_t channel) {
    Error compiling for board Teensy 3.2 / 3.1.
    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.
    If it helps, verbose output here for the sake of brevity. Seems like it gets caught up compiling Mozzi itself because some things are missing from ADC, but this is the latest that came from the Teensyduino install and trying to manually download it and rip the Teensyduino version out didn't help. I've scoured the forums here and elsewhere looking for an answer and the only other person I saw who had issues compiling for a 3.2 just downloaded the latest Mozzi and it worked no problem. Maybe I'm just using the wrong search terms but that's all I found. I'm at a complete loss on how to move forward, any guidance? Is this sufficient info? Figured wire diagrams et cetera wouldn't have much bearing on this but I can write all that up if it helps. Thanks!
    Last edited by SadSteve; 02-26-2020 at 01:35 AM. Reason: Link to the library i'm trying to use on Teensy, should have included that originally

  2. #2
    Junior Member
    Join Date
    Mar 2020
    seems like someone had a similar problem here:

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Yep the owner of the library changed the top level interface and removed most if not all of the methods that have a parameter of which ADC to update.

    So lines like:
    should now be:

Posting Permissions

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