721
edits
No edit summary |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
#*# from "output" add "i2s" | #*# from "output" add "i2s" | ||
#*# from "control" add "sgtl5000" [[File:teensy_webinterface.png|thumb|690px|Audio System Design Tool "Audio through patch"]] | #*# from "control" add "sgtl5000" [[File:teensy_webinterface.png|thumb|690px|Audio System Design Tool "Audio through patch"]] | ||
# Click the export button to generate the setup code for your teensy and paste it in your Arduino IDE patch, just before the setup routine! | # Click the export button to generate the setup code for your teensy and paste it in your Arduino IDE patch, just before the setup routine! You should get output similar to the following block, paste it at the beginning of your patch.<syntaxhighlight lang="c++"> | ||
#include <Audio.h> | |||
#include <Wire.h> | |||
#include <SPI.h> | |||
#include <SD.h> | |||
#include <SerialFlash.h> | |||
// GUItool: begin automatically generated code | |||
AudioInputI2S i2s1; //xy=200,69 | |||
AudioOutputI2S i2s2; //xy=365,94 | |||
AudioConnection patchCord1(i2s1, 0, i2s2, 0); | |||
AudioConnection patchCord2(i2s1, 1, i2s2, 1); | |||
AudioControlSGTL5000 sgtl5000_1; //xy=302,184 | |||
// GUItool: end automatically generated code | |||
</syntaxhighlight> | |||
# In the setup routine of the arduino IDE you need code to choose the microphone port and audio levels. It should look more or less like this:<syntaxhighlight lang="c++"> | # In the setup routine of the arduino IDE you need code to choose the microphone port and audio levels. It should look more or less like this:<syntaxhighlight lang="c++"> | ||
void setup() { | void setup() { | ||
Line 17: | Line 31: | ||
AudioMemory(8); | AudioMemory(8); | ||
// Enable the audio shield and set the output volume. | // Enable the audio shield and set the output volume. | ||
sgtl5000_1.enable(); | sgtl5000_1.enable(); | ||
sgtl5000_1.inputSelect(AUDIO_INPUT_MIC); | sgtl5000_1.inputSelect(AUDIO_INPUT_MIC); | ||
Line 23: | Line 37: | ||
sgtl5000_1.volume(0.8); // from 0.0 to 1.0 // 0.8 standard | sgtl5000_1.volume(0.8); // from 0.0 to 1.0 // 0.8 standard | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight>Note that you really need to declare the loop() function, otherwise your code doesn't compile!<syntaxhighlight lang="c++"> | ||
Note that you really need to declare the loop() function, otherwise your code doesn't compile! | |||
<syntaxhighlight lang="c++"> | |||
void loop(){ | void loop(){ | ||
// nothing to be done here | // nothing to be done here |