Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
robstave committed May 2, 2019
1 parent 2e77e8e commit bbeefbd
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 15 deletions.
Binary file added .vscode/ipch/2e3e3b3b9c6760e8/mmap_address.bin
Binary file not shown.
4 changes: 2 additions & 2 deletions M0_Simple_Synth_05/M0_Simple_Synth_05.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
// The code is just doing the squarewaves at the moment with very simple counters.
// In the interrupt, we just count the number of ticks here until flipping the bit.

// LFO Counters. minLFO is actually a high number because its a larger tick to
// LFO Counter Bounds. The higher the number, the longer it takes to count to it, so
// a high frequency is really indicated with a smaller number.
# define maxLFO 40
# define minLFO 500

Expand All @@ -43,7 +44,6 @@ Adafruit_DotStar strip = Adafruit_DotStar(
uint8_t CC1 = 7;
uint8_t CC2 = 114;


volatile uint16_t counter = 0;
volatile uint8_t state = 0; // LFO Bit On/Off
volatile uint16_t counterCompare = 100;
Expand Down
21 changes: 20 additions & 1 deletion M0_Simple_Synth_05/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,23 @@ So this is an approximation of the following circuit
![Capture1](https://github.com/robstave/trinketM0Synth/blob/master/M0_Simple_Synth_05/images/circuit.PNG)


![Capture1](https://github.com/robstave/trinketM0Synth/blob/master/M0_Simple_Synth_05/images/oneMinusLogPNG.PNG)
![Capture1](https://github.com/robstave/trinketM0Synth/blob/master/M0_Simple_Synth_05/images/oneMinusLogPNG.PNG)

The code is really not as complicated as it seems. We are just really manipulating two counters and applying boolean logic to the results of the timers. The result is sent to a pin to make sound.

This approach has the flaws that were mentioned earlier that the resolution is not inear as we go up the scale.

For example:
If a particular note is generated by a counter counting up to 100, then when we reduce the counter to 50, we actually get a note that is an octave higher.

If you divide that counter amount by 2 again, you get another octave. Works great, but notice the resolution gets worse too.

100 to 50 have 50 values
50 to 25 has 25
25 to 12.5 has 12 (rounded)

Also, with Midi, you only really get 128 values to send. Technically, this is kinda a problem in the analog version too in that you often see a "corse" and "fine" knob.

Still, its a fun start and very 8-bity.

![YouTube Example](https://www.youtube.com/watch?v=3eiYu0klEis)
25 changes: 16 additions & 9 deletions M0_Simple_Synth_08/M0_Simple_Synth_08.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,24 @@
M0 Trinket Synth - Exercise 08
Previously:
make a squarewave sound (2 Cores) with 3 CCs each
Two Squarewave oscillator(2 Cores) with 3 CCs each
HfCC - CC to control pitch
LfoCC - CC to control LFO Frequency
Added:
LfoOnCC - CC to turn core on/off/LFO so its always on, always off or squarewave LFO
Also another CC for the mixer
Toggle Mixer to be sum/nand/xor
Also another CC for the mixer - Toggle Mixer to be sum/nand/xor
So we are up to 7 knobs.
At this point, all the values were getting unmanagable, so lets
make a struct per core.
Added, rebase
Also, did map the LFO control a bit to have an off/lfo/on mode
Technically, nothing new here. Just a rebase.
*/


Expand All @@ -27,7 +34,7 @@
// The code is just doing the squarewaves at the moment with very simple counters.
// In the interrupt, we just count the number of ticks here until flipping the bit.

// LFO Counters. minLFO is actually a high number because its a larger tick to
// LFO Counter bounds. A small number means it will take less time to reset the timer (and flip the bit)
# define maxLFO 40
# define minLFO 500

Expand Down Expand Up @@ -71,11 +78,11 @@ CoreState coreArray[] = {


{
// HF CC = 10;
// LFO CC = 10;
// initialize at 90
10, 0, 90, 0, 91,

// LFO CC = 74;
// HF CC = 74;
74, 0, 90, 0, 91,

// LFO ON CC = 71;
Expand Down
12 changes: 9 additions & 3 deletions M0_Simple_Synth_09/M0_Simple_Synth_09.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@
M0 Trinket Synth - Exercise 09
Previously:
make a squarewave sound (2 Cores) with 3 CCs each
Two Squarewave oscillator(2 Cores) with 3 CCs each
HfCC - CC to control pitch
LfoCC - CC to control LFO Frequency
LfoOnCC - CC to turn core on/off/LFO so its always on, always off or squarewave LFO
Also another CC for the mixer - Toggle Mixer to be sum/nand/xor
Also another CC for the mixer
Toggle Mixer to be sum/nand/xor
So we are up to 7 knobs.
At this point, all the values were getting unmanagable, so lets
make a struct per core.
Added:
a Vibrato effect
Expand Down Expand Up @@ -157,6 +162,7 @@ void TC4_Handler() // Interrupt Service
coreArray[CORE1].lfoState++;
if (coreArray[CORE1].lfoState % 2 == 0) {
coreArray[CORE1].color = 0x00;
// coreArray[CORE1].hfTrill = 0; // sync trill
} else {
coreArray[CORE1].color = 0xFF;
}
Expand Down

0 comments on commit bbeefbd

Please sign in to comment.