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

Thread: Tone library, the Audio library and DAC/A14

  1. #1
    Senior Member pictographer's Avatar
    Join Date
    May 2013
    Location
    San Jose, CA
    Posts
    671

    Tone library, the Audio library and DAC/A14

    What is the expected behavior for using the tone() function with the DAC/A14 pin on a Teensy 3.1 and Teensyduino 1.20-rc5? Silence is the behavior I'm getting. There are no pin restrictions in the documentation.

    Code:
    void setup() {
      pinMode(13, OUTPUT);
      // Note: still doesn't work with pinMode(A14, OUTPUT);
    }
    
    
    void loop() {
      static int i = 0;
      tone(A14, 440 * i);
      delay(1500);
      ++i;
      if (i > 3) i = 0;
      noTone(A14);
      digitalWriteFast(13, i & 1);
    }
    I've verified that my hardware setup can produce audio using analogWrite() with delays. This generates moderately clean tones and allows software volume control. There are occasional quiet clicks which I assume are noise from whatever other switching is going on either over the USB power or in the Teensy itself.

    The Audio library PlaySynthMusic example sort of works with AudioOutputAnalog, but the sound is garbled with static like poor radio reception. My hardware setup is a straight connection from A14 to the inputs of a pair of earbuds and the other connection to ground with no external filtering. Next version of the hardware will have at least a resistor and capacitor.

    Is the Audio library output to A14 poor due to the lack of hardware filtering, an inherent limitation of the DAC or ...?

    By the way, the Audio category is listed twice in the examples under File > Examples.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,467
    tone() only works on digital pins.

  3. #3
    Senior Member
    Join Date
    Nov 2012
    Location
    Boston, MA, USA
    Posts
    1,112
    and headphones only work with a headphone amplifier

Posting Permissions

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