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

Thread: Audio USB Out "hello world" program

  1. #1

    Audio USB Out "hello world" program

    I'm trying to use the audio features of my Teensy 3.6 and to begin, I am trying to make the most basic program to output sound using the computer's speakers, because I haven't bought the teensy sound card.
    I used the design tool to connect one sine wave generator to both inputs of the USB output and pasted the code into Arduino editor. I have added some lines to make the onboard led blink and the code is here:

    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    // GUItool: begin automatically generated code
    AudioSynthWaveformSine   sine1;          //xy=350.1999969482422,248.1999969482422
    AudioOutputUSB           usb1;           //xy=541.2000122070312,254.20001220703125
    AudioConnection          patchCord1(sine1, 0, usb1, 0);
    AudioConnection          patchCord2(sine1, 0, usb1, 1);
    // GUItool: end automatically generated code
    //used to blink the led to show that something is happening
    int led=13;
    void setup() {
      // put your setup code here, to run once:
      pinMode(led, OUTPUT);     
    void loop() {
      // put your main code here, to run repeatedly:
      digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
       digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
    And the led blinks, but no sound is output. What am I doing wrong?
    Before you ask I'm running windows 10, I have just updated my arduino program (1.8.5) and my Teenyduino (1.42). I have selected "Teensy 3.6", "Audio", "180MHz", "US english","Faster" in the Tools menu.
    Attached Files Attached Files

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Colmar, France
    What about declaring some AudioMemory() ?

    "Without eating hay, the best horse can't fart" (Albanian proverb)

  3. #3
    Ok, I added

    to the setup(), but still no sound!

  4. #4
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Also before setup(), add AudioOutputI2S out1; // need one non-USB out or in to run


Posting Permissions

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