Chromatic A/D conversions for 16bit systems
Moderators: Joe., lisa, luketeaford, Kent

 Common Wiggler
 Posts: 67
 Joined: Tue Oct 09, 2018 10:31 am
 Location: West Chicago
Chromatic A/D conversions for 16bit systems
Hallo,
I'm just doing some simple maths about converting the 1V/octave standard to digital values and just want to shoot this past y'all just to make sure that I am not fundamentally off base.
a 16bit diginal register would be the 0 to 10V equivalent of 0 to 32,767 bits
1V/octave would scale down to .083 volts per half step on a western chromatic scale. IS this correct?
So the maths would be that rounding to the nearest whole number (because it is digital) that every chromatic half step would be the digital equivalent of an integer 273 ?
Thanks all.
I'm just doing some simple maths about converting the 1V/octave standard to digital values and just want to shoot this past y'all just to make sure that I am not fundamentally off base.
a 16bit diginal register would be the 0 to 10V equivalent of 0 to 32,767 bits
1V/octave would scale down to .083 volts per half step on a western chromatic scale. IS this correct?
So the maths would be that rounding to the nearest whole number (because it is digital) that every chromatic half step would be the digital equivalent of an integer 273 ?
Thanks all.
Re: Chromatic A/D conversions for 16bit systems
16b is either 32k or 64k, depending upon signed or unsigned integers. typically unsigned is used with DACs, so the 64k value is the better one here (the actual number of steps in the DAC). if you want 12 notes/octave times 10 octaves, thats 120 notes into your 64k, or 546bits/note. so the 273 is correct for 32k (which is fine to use if you dont have a 16b DAC).
openmusiclabs.com

 Common Wiggler
 Posts: 67
 Joined: Tue Oct 09, 2018 10:31 am
 Location: West Chicago
Re: Chromatic A/D conversions for 16bit systems
yup, the DAC specs of the module i have is 10/10V = 32,768/32,768
thanks for the peer review!
thanks for the peer review!
Re: Chromatic A/D conversions for 16bit systems
ok, so you can use either value. i would reccomend using the 546 value, and then adding a DC offset to make up for the negative values on the DAC. or, what might give you a bit more accuracy, is to only use the middle 80%90% of the range, and change your analog scaling factor. most DACs have a bit of error at the top and bottom, in particular audio DACs. this is why THD is often spec'd for a smaller portion of the range. if you used 512 it would make the math pretty easy!
openmusiclabs.com
 EATyourGUITAR
 has no life
 Posts: 4062
 Joined: Tue Aug 31, 2010 12:24 am
 Location: Providence, RI, USA
Re: Chromatic A/D conversions for 16bit systems
32,767 bits is 4KB, you can write a book with that. you can store any number between 0 and (2^32,767)1. 16 bits is how many bits? 16 bits. if you want to know what 2^16 is in base 10 you can use a calculator for that. also, the voltage does not affect the number of bits you have in 16bit, only the size of the steps measured in volts. (2^n)/(v2v1) = step size in volts. as v gets bigger, step size increases, therefor precision decreases.johnstilton wrote: ↑Fri Mar 20, 2020 8:36 ama 16bit diginal register would be the 0 to 10V equivalent of 0 to 32,767 bits
WWW.EATYOURGUITAR.COM < MY DIY STUFF

 Common Wiggler
 Posts: 67
 Joined: Tue Oct 09, 2018 10:31 am
 Location: West Chicago
Re: Chromatic A/D conversions for 16bit systems
So for the three people here who would be curious and know RSLogix I devised some code that quantizes an integer to the chronatic scale:
I'm Dividing an integer (N7:0) by 273 moving the quotient in S:14 into N7:3 and the remainderin S:13 into N7:2. The quotient in N7:3 I then multiply it by 273 again and put the result in N7:4. The remainder in N7:2 I compare against 137 uning the GRT and if true I ADD 273 to N7:7:4
BST DIV N7:0 273 N7:1 NXB MOV S:13 N7:2 NXB MOV S:14 N7:3 NXB MUL N7:3 273 N7:4 NXB GRT N7:2 137 ADD 273 N7:4 BND
And then I shared this in an Allen Bradley Forum and a much smarter user offered to use the compute command and use the truncate command as part of the expression:
CPT Output "TRN ((Input / 273.0) +0.5) * 273"
U nfortunately Truncate is not available in 500 , only in ControlLogix
They also pointed out that in Excel the equivalent expression would be ROUND(Input / 273, 0) * 273
I love forums.
I'm Dividing an integer (N7:0) by 273 moving the quotient in S:14 into N7:3 and the remainderin S:13 into N7:2. The quotient in N7:3 I then multiply it by 273 again and put the result in N7:4. The remainder in N7:2 I compare against 137 uning the GRT and if true I ADD 273 to N7:7:4
BST DIV N7:0 273 N7:1 NXB MOV S:13 N7:2 NXB MOV S:14 N7:3 NXB MUL N7:3 273 N7:4 NXB GRT N7:2 137 ADD 273 N7:4 BND
And then I shared this in an Allen Bradley Forum and a much smarter user offered to use the compute command and use the truncate command as part of the expression:
CPT Output "TRN ((Input / 273.0) +0.5) * 273"
U nfortunately Truncate is not available in 500 , only in ControlLogix
They also pointed out that in Excel the equivalent expression would be ROUND(Input / 273, 0) * 273
I love forums.

 Common Wiggler
 Posts: 60
 Joined: Fri Feb 15, 2019 10:50 am
 Location: Sacramento
Re: Chromatic A/D conversions for 16bit systems
If you are suggesting that a book could be stored in 4KB, I would agree  but only if the book is very, very short.
Re: Chromatic A/D conversions for 16bit systems
Only if you use the output of the D/A directly. If you're going to add some analog adjustment (or maybe if you need to, depending on the specs of the device), then you can scale the voltage up a little and use a 256 count per semitone, for example.johnstilton wrote: ↑Fri Mar 20, 2020 8:36 ama 16bit diginal register would be the 0 to 10V equivalent of 0 to 32,767 bits
1V/octave would scale down to .083 volts per half step on a western chromatic scale. IS this correct?
So the maths would be that rounding to the nearest whole number (because it is digital) that every chromatic half step would be the digital equivalent of an integer 273 ?