Author |
Message |
Mickeyluv
Joined: Jan 18, 2022 Posts: 8 Location: UK
|
Posted: Thu Jan 20, 2022 1:08 am Post subject:
|
 |
|
Thanks for the reply - It looks to be exactly what I need. I've got my guitar controller breadboarded and working, but the CV output isn't accurate enough with the circuit I'm using for the MIDI to CV (PIC with 8-bit DAC) and this looks ideal.
EDIT: I've just replaced the original MIDI to CV converter with the Arduino setup. It's perfect for guitar. The next stage is to build up a permanent module for my synth. Thanks for the effort that went into developing this - much appreciated. |
|
Back to top
|
|
 |
Mickeyluv
Joined: Jan 18, 2022 Posts: 8 Location: UK
|
Posted: Thu Aug 10, 2023 8:14 am Post subject:
|
 |
|
I hope it's OK to post again here after such a long time, but I have a question about how the DAC values are calculated and I want to understand this more thoroughly for another idea I'm working on. I've shown the first octave of the DAC table here from the .ino for clarification. As an example, the DAC output for 0.0833 volts is given as 62. My thinking is the output would be 62/4096*5=0.076V and so on for all DAC values given. In practice the output sounds in-tune, so my reasoning must be flawed, as the closest value to 0.833V would be DAC68 at 0.830V with my calculation.
What am I missing?
DAC note CV
-----------------------
0, // 0 0,0000 V
62, // 1 0,0833 V
140, // 2 0,1667 V
202, // 3 0,2500 V
276, // 4 0,3333 V
340, // 5 0,4167 V
411, // 6 0,5000 V
478, // 7 0,5833 V
546, // 8 0,6667 V
616, // 9 0,7500 V
682, // 10 0,8333 V
754, // 11 0,9167 V |
|
Back to top
|
|
 |
kkissinger
Stream Operator

Joined: Mar 28, 2006 Posts: 1425 Location: Kansas City, Mo USA
Audio files: 45
|
Posted: Fri Aug 11, 2023 6:59 am Post subject:
|
 |
|
Mickeyluv wrote: | I hope it's OK to post again here after such a long time, but I have a question about how the DAC values are calculated and I want to understand this more thoroughly for another idea I'm working on. I've shown the first octave of the DAC table here from the .ino for clarification. As an example, the DAC output for 0.0833 volts is given as 62. My thinking is the output would be 62/4096*5=0.076V and so on for all DAC values given. In practice the output sounds in-tune, so my reasoning must be flawed, as the closest value to 0.833V would be DAC68 at 0.830V with my calculation.
What am I missing?
|
You are dividing your keyboard (5 octaves = 1200 cents) by 4096 (the resolution of your DAC) which gives you a resolution of 3.4 cents. This would enable you to tune each note within 1.7 cents of the target value. Most people won't notice an offset of 1.7 cents and the linear to expo converters in the VCOs may have little inaccuracies, too. I'd say to go ahead and run with your idea. As far as your code, a table of values may be quicker than calculations (though you could populate your table with calculated values in your initialization step). With a hard-coded table you could simply map each MIDI note number to an explicit input number for your DAC.
All the best! _________________ -- Kevin
http://kevinkissinger.com |
|
Back to top
|
|
 |
PHOBoS

Joined: Jan 14, 2010 Posts: 5784 Location: Moon Base
Audio files: 708
|
Posted: Fri Aug 11, 2023 10:44 am Post subject:
|
 |
|
Mickeyluv wrote: | I hope it's OK to post again here after such a long time, but I have a question about how the DAC values are calculated and I want to understand this more thoroughly for another idea I'm working on. |
It's no problem posting after a while and always preferred to making a new thread IMO.
I think your reasoning is correct and it simply has to do with inaccuracies of the DAC. If you look at the difference between
the DAC values for each consecutive note, which should correspond with a voltage change of 0.0833V, you can see that they
also vary quite a bit. (62,78,62,74,64,71,67,68,70,66,72,..)
The voltages on the right are what it should produce in an ideal situation and I created that initial table by manual tuning until
I got a voltage that was as close to what it should be. After that it was a matter of rebooting the Arduino and copying the values
that it prints on startup back into the code. This should get it somewhat in the ballpark but depending on several factors it will
probably need some adjustments to get it fully in tune.
kkissinger wrote: | As far as your code, a table of values may be quicker than calculations (though you could populate your table with calculated values in your initialization step). With a hard-coded table you could simply map each MIDI note number to an explicit input number for your DAC. |
Calculating values is what it does when using the quick calibration method on startup which overrides the initial table.
This table is also stored in EEPROM and updated if any changes are made to it. On startup it is read from EEPROM
and copied to RAM for fast access. _________________ "My perf, it's full of holes!"
http://phobos.000space.com/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube |
|
Back to top
|
|
 |
Mickeyluv
Joined: Jan 18, 2022 Posts: 8 Location: UK
|
Posted: Sat Aug 12, 2023 8:05 am Post subject:
|
 |
|
Thanks for the replies. I'm working on a project to convert an audio square wave to 1V/Oct. The DAC value will be calculated from the instantaneous frequency and be continuously variable rather than quantized. Maybe this will be too slow in practice - I don't know yet.
Understanding how the DAC values were arrived at in the Midi to CV convertor is a great help. |
|
Back to top
|
|
 |
|