Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
robstave committed May 2, 2019
1 parent bbeefbd commit 289816f
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions M0_Simple_Synth_05/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,37 @@ 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)

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.
If you divide that counter amount by 2 again, you get another octave. Works great, but notice the resolution gets worse too. With each octave, you have less values that you can use to make a note with

- 100 to 50: 50 values that you can choose from in that octave
- 50 to 25: has 25
- 25 to 12.5: has 12 (rounded)

With Midi, you only really get 128 values to send. So we want to make all the values count.

In addition, if you are using the [Arduino mapping function](https://www.arduino.cc/reference/en/language/functions/math/map/), then you are spending way too much of your resolution on the lower frequencies.

50% of your values take up the first octave.

This can be fixed a little by personalizing the Mapping function. We can fake out an audio taper.
In this code, we set a point somewhere in the first octave and break it into two mapping functions.
The effect is that you get an audio style mapping versus linear.

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

See ![Here](http://www.resistorguide.com/potentiometer-taper/) for an explaination of the taper.


Of course, there are a gazillion ways to do this. Probably the best way is to calculate the taper on initialization and store that off in a map. But this works in a pinch.

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)

0 comments on commit 289816f

Please sign in to comment.