Yahoo Groups archive

SynthModules

Index last updated: 2026-04-28 23:14 UTC

Message

Re: semi-tone math

2004-05-18 by djbrow54

It wasn't so much that I wanted to quantize the keyboard but rather
sample it and play it back later. If I run my keyboard to a VCO, and
also to the PSIM for some processing and to a second VCO, they do not
track at all.

I was multiplying the sampled input by 4 to convert convert it for
output.  However, the scale factor is different.  The output is
10.666 volts so there is a multiplier of 1.0666.  Think of it as a
gain difference between the input and output of 4.266.  If you
sampled an input at 10 volts you would get a value of 1023.  Multiply
it by 4 and get 4092.  This will yield an output of 10.656, not 10. 
So, we need to multiply by 4/1.066 to have unity gain.  Thus the
multiplier from input to output is 3.75, not 4.  Since I can only do
integer math, I could multiply by 15 and divide by 4.

I started down this path thinking about quantizing. To quantize the
input, I can divide by 8.5 to round to the nearest semitone.  Again,
since I can only do integer math I can multiply by 2 and divide by
17.  This gives me the appropriate semitone.  Then, to convert this
for output, I need to multiply by 32.  64/17 is 3.76 which basically
gives me the same scale factor.  I think the difference is really
just roundoff.

I think 3.75 is the appropriate factor as it is the ratios of the two
voltage references and the number of bits.  All of the programs that
multiply by 4 include this additional error gain factor.

Dave

--- In SynthModules@yahoogroups.com, "grantrichter2001"
<grichter@a...> wrote:
> I am missing something here, a keyboard is already quantized, 
> why would you want to quantize it again?
> 
> A quantizer expects an unquantized input to work properly, if you 
> feed it an already quantized voltage, strange things will happen.
> 
> Think of it as a classifier. The software "classifies" the input
into 
> one discrete output step. The classifier rules are adjustable. 
> That is you can program the 0 to 10 volt input to generate as 
> many or few outputs steps as you want, by changing the 
> classifier rules.
> 
> So it is not going to match the output steps of a keyboard, unless 
> precisely calibrated to do so and with specific software. Also the 
> absolute input precision on the PSIM is about 5%. (because the 
> ADC reference is the untrimmed 5 volt supply) 
> 
> Quite good for most things, but to track another quantized source 
> (like the Roland OP-8m tries to do) trim pots would be need on 
> the inputs for both scale and offset for each input channel. And 
> the 5 volt supply will need to be precisely trimmed.
> 
> --- In SynthModules@yahoogroups.com, "djbrow54" 
> <davebr@e...> wrote:
> > As I use my PSIM for CV functions, the output never seems to 
> be 'in
> > tune' with what I expect.  If I use the basicqu2.bas program as 
> an
> > example to sample and quantize my keyboard CV, there is a
> > significant difference between the output and the keyboard CV.
> > 
> > I thought I would try and do the calculations in semitones.  The
> > input is 1023 steps over 10 volts.  Every 8.5 steps is a 
> semitone (83
> > mV).  If I could divide the input by 8.5 then I would have the
> > semitone value. Since I can't divide by 8.5, I can multiply by 2 
> and
> > divide by 17.
> > 
> > Since the output is 4095 steps over 10.666 volts, every 32 
> steps is a
> > semitone. To convert the input from a semitone to the correct 
> output
> > voltage, I would multiply by 32.  Thus if I take the input,
multiply
> > by 64 and divide by 17 I convert it to the correct output and
> > quantize to the semitone.
> > 
> > In basicqu2, replacing the RAWDAC1=((ADC1V/16)*32)+49152 
> calculation
> > with RAWDAC1=((ADC1V*64)/17)+49152 yields an output that 
> tracks the
> > keyboard CV quite well.
> > 
> > Does this math make sense?  I haven't seen any code use 
> anything
> > similar to this.  I've been having issues with a program I'm 
> writing
> > that samples and delays my keyboard output and this seems 
> to correct
> > the issue.
> > 
> > Dave

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.