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

Thread: USB violin (sound over USB without external ADC)

  1. #1
    Junior Member
    Join Date
    Mar 2014
    Posts
    18

    USB violin (sound over USB without external ADC)

    Hi all,

    I'm trying to use the Teensy as a sound card without any physical sound device.
    I read the note that you need to use one non-USB input, but I'm not sure what that means, and I can't get it to work.
    In fact, I can't get any of the examples to work, because they all rely on an external sound board.

    In the end I will be connecting potentiometers to the ADC pins to control the pitch and volume of various notes.
    I may be able to use an ADC input to modulate some synth, but it seems hardcoded to use A2, so that's useless when I need more than one.
    But even if I add an ADC input, I basically get nothing.

    What I want is to be able to just have an USB output and a bunch of synths that I control myself.
    Is that at all possible?

    Code:
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    
    // GUItool: begin automatically generated code
    AudioSynthWaveformSine   sine1;          //xy=680,309
    AudioInputAnalog         adc1;           //xy=708,243
    AudioOutputUSB           usb1;           //xy=968,283
    AudioConnection          patchCord1(sine1, 0, usb1, 1);
    AudioConnection          patchCord2(adc1, 0, usb1, 0);
    // GUItool: end automatically generated code
    
    
    
    void setup() {
      sine1.amplitude(1);
      sine1.frequency(600);
    }
    
    void loop() {
    }

  2. #2
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,188
    First,
    you need to allocate some audio buffers (in setup)

    eg
    Code:
      AudioMemory(8);
    the number you put here depends on the complexity of your code

  3. #3
    Member
    Join Date
    Mar 2019
    Location
    Bordeaux / France
    Posts
    68
    In my case it's about having at least one non usb OUTPUT, and it works fine

    Add
    Code:
    AudioOutputAnalog dac1;
    to your code
    that should enable USB audio out to live its live...

  4. #4
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,188
    Quote Originally Posted by Tactif CIE View Post
    In my case it's about having at least one non usb OUTPUT, and it works fine

    Add
    Code:
    AudioOutputAnalog dac1;
    to your code
    that should enable USB audio out to live its live...
    Can also be an INPUT as in OP

Posting Permissions

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