Tracking / Tuning

Discussion, support, and resources for our noise making modules and kits.

Moderators: Kent, scottwilson

Post Reply
User avatar
Alwaysnew
Wiggling with Experience
Posts: 361
Joined: Thu Feb 23, 2012 8:55 am
Location: Stockholm

Tracking / Tuning

Post by Alwaysnew » Sun Sep 21, 2014 5:02 pm

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?

User avatar
Alwaysnew
Wiggling with Experience
Posts: 361
Joined: Thu Feb 23, 2012 8:55 am
Location: Stockholm

Post by Alwaysnew » Sun Sep 21, 2014 5:12 pm

...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.

User avatar
scottwilson
Wiggling with Experience
Posts: 435
Joined: Mon Sep 16, 2013 12:54 pm

Post by scottwilson » Sun Sep 21, 2014 5:34 pm

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: Select all


	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: Select all


	/* 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 = &#40;dacval < 0&#41; ? 0 &#58; &#40;dacval > 4095&#41; ? 4095 &#58; dacval;


User avatar
Alwaysnew
Wiggling with Experience
Posts: 361
Joined: Thu Feb 23, 2012 8:55 am
Location: Stockholm

Post by Alwaysnew » Mon Sep 22, 2014 11:23 am

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;

Post Reply

Return to “nw2s”