GhostofJohnToad
New member
I am messing with some of the sound stuff from Mozzi http://sensorium.github.io/Mozzi/. I am really new to programming so I am just trying to dig in and mess with some examples. So for instance the example code below for a sine wave routes the output signal to A14/DAC. I can get this to work as it is. What I am trying to accomplish is to somehow route this signal from A14 to the headphones on the audio shield. How do I do this?
Code:
/* Example playing a sinewave at a set frequency,
using Mozzi sonification library.
Demonstrates the use of Oscil to play a wavetable.
Circuit: Audio output on digital pin 9 on a Uno or similar, or
DAC/A14 on Teensy 3.0/3.1, or
check the README or http://sensorium.github.com/Mozzi/
Mozzi help/discussion/announcements:
https://groups.google.com/forum/#!forum/mozzi-users
Tim Barrass 2012, CC by-nc-sa.
*/
#include <ADC.h> // Teensy 3.0/3.1 uncomment this line and install http://github.com/pedvide/ADC
#include <MozziGuts.h>
#include <Oscil.h> // oscillator template
#include <tables/sin2048_int8.h> // sine table for oscillator
// use: Oscil <table_size, update_rate> oscilName (wavetable), look in .h file of table #included above
Oscil <SIN2048_NUM_CELLS, AUDIO_RATE> aSin(SIN2048_DATA);
// use #define for CONTROL_RATE, not a constant
#define CONTROL_RATE 64 // powers of 2 please
void setup(){
startMozzi(CONTROL_RATE); // set a control rate of 64 (powers of 2 please)
aSin.setFreq(440); // set the frequency
}
void updateControl(){
// put changing controls in here
}
int updateAudio(){
return aSin.next(); // return an int signal centred around 0
}
void loop(){
audioHook(); // required here
}