Hello, im new here, but not new to arduino etc. thanks for the fantastic teensy3, it is just what i have been looking for! its amazing how much i can do in a really short ISR
This is a voltage controlled oscillator i am making for modular synthesizers. it has 8 simultaneous oscillators for phase effects. and the wavetable can be mixed between any 2 of the (8 so far)
I am using 8 of the analog inputs for potentiometers, and 2 for analog voltage controls.
I am currently using the PWM out on a teensy 3.0, but i have ordered some teensy 3.1s to use the DAC output.
I am loading some wavetables in flash like this
then i am using a "pointer table" to select which table is read in the output ISR
then using analog potentiometers to select which wavetables to use. heres part of the input update code.
Here is the output ISR, which works at 100khz.
all i have to do is change the name of "triTable" everywhere it is used and declared to anything else and it will still compile properly, but only partly work. (plays a sine wave at the correct frequencies, but no controls work)
previously something similar happened when i had called one of the pointer tables "waveTableLink2" i changed it to "waveTable2Link" and it worked.
also i tried changing the name of another of the "well established" tables and there was not a problem.
i have a feeling it might be something to do with flash memory and the compiler thinking i did not change anything?
here's the code in a (early) working condition.
https://dl.dropboxusercontent.com/u/3248170/orgone_accumulator_VCDO.zip
best regards
N
This is a voltage controlled oscillator i am making for modular synthesizers. it has 8 simultaneous oscillators for phase effects. and the wavetable can be mixed between any 2 of the (8 so far)
I am using 8 of the analog inputs for potentiometers, and 2 for analog voltage controls.
I am currently using the PWM out on a teensy 3.0, but i have ordered some teensy 3.1s to use the DAC output.
I am loading some wavetables in flash like this
Code:
--snip--
uint8_t noiseTable[255]; //generated in setup, uses SRAM
uint8_t triTable[] PROGMEM={ //not a triangle
182, 206, 222, 231, 232, 228, 221, 214,
209, 208, 211, 216, 221, 224, 225, 222, 217, 211, 206, 203, 201, 202, 204, 206,
207, 206, 202, 198, 193, 189, 186, 185, 186, 188, 191, 194, 197, 200, 202, 203,
204, 204, 203, 201, 198, 193, 188, 183, 178, 176, 175, 177, 181, 186, 193, 198,
203, 207, 209, 208, 206, 202, 197, 191, 185, 181, 178, 176, 177, 179, 183, 188,
192, 196, 200, 203, 207, 210, 215, 221, 228, 234, 240, 244, 246, 246, 245, 242,
240, 240, 241, 243, 247, 250, 252, 252, 248, 242, 232, 222, 211, 200, 192, 186,
182, 182, 183, 187, 191, 195, 198, 200, 199, 195, 190, 183, 175, 167, 161, 155,
151, 148, 145, 141, 136, 129, 120, 111, 102, 94, 89, 86, 86, 87, 88, 89,
88, 86, 82, 78, 74, 70, 68, 68, 70, 72, 74, 76, 77, 76, 72, 66,
58, 49, 38, 27, 17, 9, 3, 1,2, 6, 12, 19, 26, 31, 35, 37,
38, 38, 40, 42, 47, 53, 59, 66, 72, 77, 80, 82, 83, 84, 86, 88,
90, 92, 94, 94, 92, 89, 85, 79, 73, 67, 62, 59, 57, 56, 57, 59,
60, 62, 62, 61, 58, 52, 45, 37, 28, 20, 13, 8, 6, 6, 7, 11,
15, 20, 26, 31, 37, 42, 47, 50, 51, 51, 48, 45, 42, 39, 38, 39,
41, 43, 44, 44, 41, 37, 32, 28, 27, 29, 34, 42, 52, 60, 66, 68,
68, 67, 68, 73, 85, 103, 128, 155
};
uint8_t scarabTable1[] PROGMEM = {
129, 132, 135, 138, 141, 143, 146, 150, 154, 159, 163, 166, 168, 170, 172, 175,
179, 183, 187, 190, 192, 193, 194, 196, 200, 203, 207, 210, 211, 210, 208, 206,
207, 211, 216, 221, 223, 222, 218, 213, 210, 209, 211, 215, 217, 219, 218, 216,
214, 212, 210,
-snip--
then i am using a "pointer table" to select which table is read in the output ISR
Code:
--snip--
uint8_t *waveTableLink;
uint8_t *waveTable2Link;
--snip--
then using analog potentiometers to select which wavetables to use. heres part of the input update code.
Code:
--snip--
case 5:
//select wave
switch (analogControls[5]>>13){
case 0: waveTable2Link = sinTable; break;
case 1: waveTable2Link = sawTable; break;
case 2: waveTable2Link = triTable; break;
case 3: waveTable2Link = scarabTable1; break;
case 4: waveTable2Link = scarabTable2; break;
case 5: waveTable2Link = pulseTable; break;
case 6: waveTable2Link = phoTable; break;
case 7: waveTable2Link = noiseTable; break;
default: waveTable2Link = sinTable;
}
break;
case 6:
switch (analogControls[6]>>13){
case 0: waveTableLink = sinTable; break;
case 1: waveTableLink = sawTable; break;
case 2: waveTableLink = triTable; break;
case 3: waveTableLink = scarabTable1; break;
case 4: waveTableLink = scarabTable2; break;
case 5: waveTableLink = pulseTable; break;
case 6: waveTableLink = phoTable; break;
case 7: waveTableLink = noiseTable; break;
default: waveTableLink = sinTable;
}
break;
--snip--
Here is the output ISR, which works at 100khz.
Code:
void outUpdateISR(void){
//digitalWrite(4,1);
o1.phase = o1.phase + (uint32_t)o1.phase_increment;
o1.reduced = o1.phase>>16;
o1.wave = ((waveTableLink[o1.phase>>24])*mix)+((waveTable2Link[o1.phase>>24])*unmix);
o2.phase = o2.phase + (uint32_t)o2.phase_increment;
o2.reduced = o2.phase>>16;
o2.wave = ((waveTableLink[o2.phase>>24])*mix)+((waveTable2Link[o2.phase>>24])*unmix);
o3.phase = o3.phase + (uint32_t)o3.phase_increment;
o3.reduced = o3.phase>>16;
o3.wave = ((waveTableLink[o3.phase>>24])*mix)+((waveTable2Link[o3.phase>>24])*unmix);
o4.phase = o4.phase + (uint32_t)o4.phase_increment;
o4.reduced = o4.phase>>16;
o4.wave = ((waveTableLink[o4.phase>>24])*mix)+((waveTable2Link[o4.phase>>24])*unmix);
o5.phase = o5.phase + (uint32_t)o5.phase_increment;
o5.reduced = o5.phase>>16;
o5.wave = ((waveTableLink[o5.phase>>24])*mix)+((waveTable2Link[o5.phase>>24])*unmix);
o6.phase = o6.phase + (uint32_t)o6.phase_increment;
o6.reduced = o6.phase>>16;
o6.wave = ((waveTableLink[o6.phase>>24])*mix)+((waveTable2Link[o6.phase>>24])*unmix);
o7.phase = o7.phase + (uint32_t)o7.phase_increment;
o7.reduced = o7.phase>>16;
o7.wave = ((waveTableLink[o7.phase>>24])*mix)+((waveTable2Link[o7.phase>>24])*unmix) ;
o8.phase = o8.phase + (uint32_t)o8.phase_increment;
o8.reduced = o8.phase>>16;
o8.wave = ((waveTableLink[o8.phase>>24])*mix)+((waveTable2Link[o8.phase>>24])*unmix) ;
digitalWriteFast (5,(o1.reduced>>15)); //sync/square out
//analogWrite(aout,(((o1.reduced+o2.reduced+o3.reduced+o4.
//reduced+o5.reduced+o6.reduced+o7.reduced+o8.reduced)>>3)));
analogWrite(aout2,(((o1.wave+o2.wave+o3.wave+o4.
wave+o5.wave+o6.wave+o7.wave+o8.wave)>>3)));
}
all i have to do is change the name of "triTable" everywhere it is used and declared to anything else and it will still compile properly, but only partly work. (plays a sine wave at the correct frequencies, but no controls work)
previously something similar happened when i had called one of the pointer tables "waveTableLink2" i changed it to "waveTable2Link" and it worked.
also i tried changing the name of another of the "well established" tables and there was not a problem.
i have a feeling it might be something to do with flash memory and the compiler thinking i did not change anything?
here's the code in a (early) working condition.
https://dl.dropboxusercontent.com/u/3248170/orgone_accumulator_VCDO.zip
best regards
N