|
|
|
@ -7,12 +7,13 @@ |
|
|
|
|
|
|
|
|
|
Uses Teensy Audio Adapter. |
|
|
|
|
Assumes microphones (or whatever) are attached to the LINE IN (stereo) |
|
|
|
|
Use potentiometer mounted to Audio Board to control the amount of gain. |
|
|
|
|
|
|
|
|
|
MIT License. use at your own risk. |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
//These are the includes from the Teensy Audio Library
|
|
|
|
|
#include <Audio.h> //Teensy Audio Librarya |
|
|
|
|
#include <Audio.h> //Teensy Audio Library |
|
|
|
|
#include <Wire.h> |
|
|
|
|
#include <SPI.h> |
|
|
|
|
#include <SD.h> |
|
|
|
@ -25,8 +26,8 @@ AudioControlSGTL5000 sgtl5000_1; //controller for the Teensy Audio Board |
|
|
|
|
AudioInputI2S i2s_in; //Digital audio *from* the Teensy Audio Board ADC. Sends Int16. Stereo.
|
|
|
|
|
AudioOutputI2S i2s_out; //Digital audio *to* the Teensy Audio Board DAC. Expects Int16. Stereo
|
|
|
|
|
AudioConvert_I16toF32 int2Float1, int2Float2; //Converts Int16 to Float. See class in AudioStream_F32.h
|
|
|
|
|
AudioConvert_F32toI16 float2Int1, float2Int2; //Converts Float to Int16. See class in AudioStream_F32.h
|
|
|
|
|
AudioEffectGain_F32 gain1, gain2; //Applies digital gain to audio data. Expected Float data.
|
|
|
|
|
AudioConvert_F32toI16 float2Int1, float2Int2; //Converts Float to Int16. See class in AudioStream_F32.h
|
|
|
|
|
|
|
|
|
|
//Make all of the audio connections
|
|
|
|
|
AudioConnection patchCord1(i2s_in, 0, int2Float1, 0); //connect the Left input to the Left Int->Float converter
|
|
|
|
@ -49,10 +50,9 @@ const int myInput = AUDIO_INPUT_LINEIN; |
|
|
|
|
void setup() { |
|
|
|
|
Serial.begin(115200); //open the USB serial link to enable debugging messages
|
|
|
|
|
delay(500); //give the computer's USB serial system a moment to catch up.
|
|
|
|
|
Serial.println("Teensy Hearing Aid: BasicGain_Float..."); //identify myself over the USB serial
|
|
|
|
|
Serial.println("OpenAudio_ArduinoLibrary BasicGain_Float...");
|
|
|
|
|
|
|
|
|
|
// Audio connections require memory, and the record queue
|
|
|
|
|
// uses this memory to buffer incoming audio.
|
|
|
|
|
// Audio connections require memory
|
|
|
|
|
AudioMemory(10); //allocate Int16 audio data blocks
|
|
|
|
|
AudioMemory_F32(10); //allocate Float32 audio data blocks
|
|
|
|
|
|
|
|
|
|