here ya go. Library to large to attach (Mozzi). So in double checking myself I loaded the most recent library instead of the ones I preciously saved...
And it finished!!!
THANKS ALL
(note to self: doubt past versions of your junk) I tested the wrong file
code below:
/* Example sliding between frequencies,
using Mozzi sonification library.
Demonstrates using Smooth to filter a control signal.
Circuit: Audio output on digital pin 9 on a Uno or similar, or
DAC/A14 on Teensy 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.1 uncomment this line and install GitHub - pedvide/ADC: Teensy 4/3.x/LC ADC implementation
#include <MozziGuts.h>
#include <Oscil.h> // oscillator template
#include <tables/sin2048_int8.h> // sine table for oscillator
#include <EventDelay.h>
#include <Smooth.h>
#include <mozzi_midi.h>
// this is a high value to avoid zipper noise
#define CONTROL_RATE 1024
// 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);
// for scheduling freq changes
EventDelay kFreqChangeDelay;
Smooth kSmoothFreq(0.85f);
int target_freq, target_freq1, target_freq2;
int pitches[] = {0,0,32,34,36,38,41,43,46,48,51,55,58,61,
65,69,73,77,82,87,92,97,103,110,116,123,
130,138,146,155,164,174,184,195,207,220,233,246,
261,277,293,311,329,349,369,391,415,440,466,493,
523,554,587,622,659,698,739,783,830,880,932,987,
1046,1108,1174,1244,1318,1396,1479,1567,1661,1760,1864,1975,
2093,2217,2349,2489,2637,2793,2959,3135,3322,3520,3729,3951,
4186,4434,4698,4978,5274,5587,5919,6271,6644,7040,7458,7902};
const char pitch_in = 0;
const char volume_in = 1;
byte volume;
int pitch_old, pitch_new;
int pitch;
void setup(){
startMozzi(CONTROL_RATE);
}
void updateControl(){
int pitchin = map(mozziAnalogRead(pitch_in),0,1023,0,25);
int pitch = pitches[pitchin];
int volin = mozziAnalogRead(volume_in);
volume = volin >> 2;
kFreqChangeDelay.set(300); // countdown, within resolution of CONTROL_RATE
// target_freq1 = 0;
target_freq1 = pitch;
target_freq2 = 0;
if(kFreqChangeDelay.ready()){
if (target_freq == target_freq1) {
target_freq = target_freq2;
}
else{
target_freq = target_freq1;
}
kFreqChangeDelay.start();
}
int smoothed_freq = kSmoothFreq.next(target_freq);
aSin.setFreq(smoothed_freq);
}
int updateAudio(){
return (aSin.next() * volume)>>6;
}
void loop(){
audioHook();
}