Author |
Tracking / Tuning |
br>Alwaysnew |
br>I'm setting up a chord sequencer and I'm doing this thing:
int notes1[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
int tuning = 86;
noteThatGoesOut1 = (notes1[noteProgram][noteToPlay] + 2) * tuning;
outputs[0]->outputCV(noteThatGoesOut1);
It kind of works but there's always something slightly off with that tuning. The "86" is just a number I "trial and errored" up to make each note step sound accurate, but I'm not sure.
Would you do it this way or is there a sharper way of doing it? br> br> |
|
br>Alwaysnew |
br>...or is there an array of all the exact notes in X amount of octaves? The exact values for the notes? That would be nice, then I'd just reference that instead of writing the {1,2,3... array.
I guess that my solution above creates some bad tracking since it's not exact. br> br> |
|
br>scottwilson |
br>This is something that I refactored right before the 1.0 firmware release.
I came up with some values in excel... keep in mind that for my code, I generally use millivolts for CV and then convert to a 12-bit representation right before sending to the DAC.
This is a list of millivolts per semitone for a single octave. For any additional octave, add 1000, 2000, 3000, etc. and you'll get that semitone for that octave.
Code: |
static const int SEMITONE_MV[12] = {
0,
83,
167,
250,
333,
417,
500,
583,
667,
750,
833,
917
};
|
Then, to convert millivolts to a value from 0 to 4096, use this formula:
Code: |
/* Converts to either -10/+10 or -5/+5 depending on which model you have */
int dacval = 4095 - (((cv + (b::cvGainMode ? 10000 : 5000)) * 4000UL) / 10000);
/* Make sure the values are in a 12bit unsigned range */
dacval = (dacval < 0) ? 0 : (dacval > 4095) ? 4095 : dacval;
| br> br> |
|
br>Alwaysnew |
br>EDIT: My mistake! By just using that list I managed to get the right notes I think!
Old post
//////////////////////////////////////////////////////////////////////
Thanks, it works but it still sounds wrong. I can play the notes in that array but the distance between each note is much smaller then a semitone.
Do I need to tweak this section in any way?
/* Converts to either -10/+10 or -5/+5 depending on which model you have */
int dacval = 4095 - (((cv + (b::cvGainMode ? 10000 : 5000)) * 4000UL) / 10000);
/* Make sure the values are in a 12bit unsigned range */
dacval = (dacval < 0) ? 0 : (dacval > 4095) ? 4095 : dacval; br> br> |
|
Powered by phpBB © phpBB Group
|