| #ifndef Audio_h_ | #ifndef Audio_h_ | ||||
| #define Audio_h_ | #define Audio_h_ | ||||
| #if TEENSYDUINO < 120 | |||||
| #error "Teensyduino version 1.20 or later is required to compile the Audio library" | |||||
| #endif | |||||
| // When changing multiple audio object settings that must update at | // When changing multiple audio object settings that must update at | ||||
| // the same time, these functions allow the audio library interrupt | // the same time, these functions allow the audio library interrupt | ||||
| // to be disabled. For example, you may wish to begin playing a note | // to be disabled. For example, you may wish to begin playing a note |
| #include <Audio.h> | #include <Audio.h> | ||||
| #include <Wire.h> | #include <Wire.h> | ||||
| #include <SPI.h> | |||||
| #include <SD.h> | #include <SD.h> | ||||
| // Create the Audio components. These should be created in the | // Create the Audio components. These should be created in the |
| #include <Audio.h> | #include <Audio.h> | ||||
| #include <Wire.h> | #include <Wire.h> | ||||
| #include <SPI.h> | |||||
| #include <SD.h> | #include <SD.h> | ||||
| // Create the Audio components. These should be created in the | // Create the Audio components. These should be created in the | ||||
| // Enable the audio shield and set the output volume. | // Enable the audio shield and set the output volume. | ||||
| audioShield.enable(); | audioShield.enable(); | ||||
| audioShield.volume(0.82); | |||||
| audioShield.volume(0.75); | |||||
| while (!Serial) ; | while (!Serial) ; | ||||
| delay(100); | delay(100); |
| #include <Audio.h> | #include <Audio.h> | ||||
| #include <Wire.h> | #include <Wire.h> | ||||
| #include <SPI.h> | |||||
| #include <SD.h> | #include <SD.h> | ||||
| const int myInput = AUDIO_INPUT_LINEIN; | const int myInput = AUDIO_INPUT_LINEIN; |
| #include <Audio.h> | #include <Audio.h> | ||||
| #include <Wire.h> | #include <Wire.h> | ||||
| #include <SPI.h> | |||||
| #include <SD.h> | #include <SD.h> | ||||
| const int myInput = AUDIO_INPUT_LINEIN; | const int myInput = AUDIO_INPUT_LINEIN; |
| #include <Audio.h> | #include <Audio.h> | ||||
| #include <Wire.h> | #include <Wire.h> | ||||
| #include <SPI.h> | |||||
| #include <SD.h> | #include <SD.h> | ||||
| #include <LiquidCrystal.h> | #include <LiquidCrystal.h> | ||||
| #include <Audio.h> | #include <Audio.h> | ||||
| #include <Wire.h> | #include <Wire.h> | ||||
| #include <SPI.h> | |||||
| #include <SD.h> | #include <SD.h> | ||||
| const int myInput = AUDIO_INPUT_LINEIN; | const int myInput = AUDIO_INPUT_LINEIN; |
| #include <Audio.h> | #include <Audio.h> | ||||
| #include <Wire.h> | #include <Wire.h> | ||||
| #include <SPI.h> | |||||
| #include <SD.h> | #include <SD.h> | ||||
| const int myInput = AUDIO_INPUT_LINEIN; | const int myInput = AUDIO_INPUT_LINEIN; |
| */ | */ | ||||
| #include <arm_math.h> | |||||
| #include <Audio.h> | #include <Audio.h> | ||||
| #include <Wire.h> | #include <Wire.h> | ||||
| //#include <WM8731.h> | |||||
| #include <SD.h> | #include <SD.h> | ||||
| #include <SPI.h> | #include <SPI.h> | ||||
| #include <Bounce.h> | #include <Bounce.h> | ||||
| audioShield.enable(); | audioShield.enable(); | ||||
| audioShield.inputSelect(myInput); | audioShield.inputSelect(myInput); | ||||
| audioShield.volume(0.5); | |||||
| audioShield.volume(0.65); | |||||
| // Warn that the passthru pin is grounded | // Warn that the passthru pin is grounded | ||||
| if(!digitalRead(PASSTHRU_PIN)) { | if(!digitalRead(PASSTHRU_PIN)) { |
| #include <Audio.h> | #include <Audio.h> | ||||
| #include <Wire.h> | #include <Wire.h> | ||||
| #include <SPI.h> | |||||
| #include <SD.h> | #include <SD.h> | ||||
| const int myInput = AUDIO_INPUT_LINEIN; | const int myInput = AUDIO_INPUT_LINEIN; |
| */ | */ | ||||
| #include <arm_math.h> | |||||
| #include <Audio.h> | #include <Audio.h> | ||||
| #include <Wire.h> | #include <Wire.h> | ||||
| //#include <WM8731.h> | |||||
| #include <SD.h> | #include <SD.h> | ||||
| #include <SPI.h> | #include <SPI.h> | ||||
| #include <Bounce.h> | #include <Bounce.h> | ||||
| audioShield.enable(); | audioShield.enable(); | ||||
| audioShield.inputSelect(myInput); | audioShield.inputSelect(myInput); | ||||
| audioShield.volume(0.5); | |||||
| audioShield.volume(0.65); | |||||
| // Warn that the passthru pin is grounded | // Warn that the passthru pin is grounded | ||||
| if(!digitalRead(PASSTHRU_PIN)) { | if(!digitalRead(PASSTHRU_PIN)) { |
| #include <Audio.h> | #include <Audio.h> | ||||
| #include <Wire.h> | #include <Wire.h> | ||||
| #include <SPI.h> | |||||
| #include <SD.h> | #include <SD.h> | ||||
| const int myInput = AUDIO_INPUT_LINEIN; | const int myInput = AUDIO_INPUT_LINEIN; |
| #include <Audio.h> | #include <Audio.h> | ||||
| #include <Wire.h> | #include <Wire.h> | ||||
| #include <SPI.h> | |||||
| #include <SD.h> | #include <SD.h> | ||||
| #include <Audio.h> | #include <Audio.h> | ||||
| #include <Bounce.h> | #include <Bounce.h> | ||||
| #include <Wire.h> | #include <Wire.h> | ||||
| #include <SPI.h> | |||||
| #include <SD.h> | #include <SD.h> | ||||
| const int myInput = AUDIO_INPUT_LINEIN; | const int myInput = AUDIO_INPUT_LINEIN; |
| #include <Audio.h> | #include <Audio.h> | ||||
| #include <Wire.h> | #include <Wire.h> | ||||
| #include <SPI.h> | |||||
| #include <SD.h> | #include <SD.h> | ||||
| AudioSynthWaveform mysine(AudioWaveformSine); | AudioSynthWaveform mysine(AudioWaveformSine); | ||||
| mysine.frequency(440); | mysine.frequency(440); | ||||
| mysine.amplitude(0.9); | mysine.amplitude(0.9); | ||||
| codec.volume(70); | |||||
| codec.volume(0.70); | |||||
| Serial.println("setup done"); | Serial.println("setup done"); | ||||
| } | } |
| */ | */ | ||||
| #include <arm_math.h> | |||||
| #include <Audio.h> | #include <Audio.h> | ||||
| #include <Wire.h> | #include <Wire.h> | ||||
| //#include <WM8731.h> | |||||
| #include <SD.h> | |||||
| #include <SPI.h> | #include <SPI.h> | ||||
| #include <SD.h> | |||||
| #include <Bounce.h> | #include <Bounce.h> | ||||
| AudioSynthToneSweep myEffect; | AudioSynthToneSweep myEffect; |
| #include <Audio.h> | |||||
| #include <Wire.h> | |||||
| #include <SD.h> | |||||
| #include <SPI.h> | |||||
| // Create the Audio components. These should be created in the | |||||
| // order data flows, inputs/sources -> processing -> outputs | |||||
| // | |||||
| AudioPlaySdWav wav; | |||||
| AudioOutputI2S dac; | |||||
| // Create Audio connections between the components | |||||
| // | |||||
| AudioConnection c1(wav, 0, dac, 0); | |||||
| AudioConnection c2(wav, 1, dac, 1); | |||||
| // Create an object to control the audio shield. | |||||
| // | |||||
| AudioControlSGTL5000 audioShield; | |||||
| void setup() { | |||||
| // Audio connections require memory to work. For more | |||||
| // detailed information, see the MemoryAndCpuUsage example | |||||
| AudioMemory(5); | |||||
| audioShield.enable(); | |||||
| audioShield.volume(0.5); | |||||
| SPI.setMOSI(7); | |||||
| SPI.setSCK(14); | |||||
| if (SD.begin(10)) { | |||||
| wav.play("01_16M.WAV"); | |||||
| } | |||||
| } | |||||
| void loop() { | |||||
| float vol = analogRead(15); | |||||
| vol = vol / 1024; | |||||
| audioShield.volume(vol); | |||||
| delay(20); | |||||
| } | |||||
| #include <Audio.h> | #include <Audio.h> | ||||
| #include <Wire.h> | #include <Wire.h> | ||||
| #include <SPI.h> | |||||
| #include <SD.h> | #include <SD.h> | ||||
| #include <Bounce.h> | #include <Bounce.h> | ||||