electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » Arduino
mini MIDI to CV converter with Gate and Trigger outputs
Post new topic   Reply to topic
Page 3 of 3 [55 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Goto page: Previous 1, 2, 3
Author Message
Mickeyluv



Joined: Jan 18, 2022
Posts: 6
Location: UK

PostPosted: Thu Jan 20, 2022 1:08 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
Mickeyluv



Joined: Jan 18, 2022
Posts: 6
Location: UK

PostPosted: Thu Aug 10, 2023 8:14 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
kkissinger



Joined: Mar 28, 2006
Posts: 1354
Location: Kansas City, Mo USA
Audio files: 42

PostPosted: Fri Aug 11, 2023 6:59 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
PHOBoS



Joined: Jan 14, 2010
Posts: 5591
Location: Moon Base
Audio files: 705

PostPosted: Fri Aug 11, 2023 10:44 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Mickeyluv



Joined: Jan 18, 2022
Posts: 6
Location: UK

PostPosted: Sat Aug 12, 2023 8:05 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic
Page 3 of 3 [55 Posts]
View unread posts
View new posts in the last week
Goto page: Previous 1, 2, 3
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Arduino
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use