Quantizing pots

Software questions and issues with the FV-1

Moderator: frank

Post Reply
Aaron
Posts: 54
Joined: Wed Mar 04, 2015 8:10 pm
Location: Oklahoma

Quantizing pots

Post by Aaron »

I was wondering if there is a way to quantize pots to exact intervals, say 30 or 90 possibilities. I see in the knowledge base that masking a pot to 5bits will give you 32 steps but can this be tailored even more?
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

Simple way is to just use what ever bit mask you need for the number of states but it will always be a power of 2 then (16, 32, 64, etc.)

To do an arbitrary number of states means doing skips and value comparisons which will use a lot more instructions.
Frank Thomson
Experimental Noize
tjm215
Posts: 18
Joined: Sun Dec 22, 2013 8:07 am

Post by tjm215 »

to do an arbitrary number could you not do a mask then scale and offset it to your needs?
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

Problem is you kind of lose the advantage of masking, assume you want 10 states so you start with 16 (can't use less than 10) so you read a pot, mask off the top 4 bits and the range is 0 to 15. Multiply by 5/8 to map the 16 states to 10 and you end up with 10 states with the following mapping:
State Value
0 0
1 0.625
2 1.25
3 1.875
4 2.5
5 3.125
.
.
14 8.75
15 9.375

You have mapped to 10 states, 0 - 9, but they are not evenly spaced. As a user turns the dial they will notice it and it will feel wrong to them.
Frank Thomson
Experimental Noize
slacker
Posts: 116
Joined: Tue Feb 01, 2011 1:13 pm

Post by slacker »

I think to get even spacing you can scale the pot by the number of steps you want divided by the number of steps in the next higher power of 2 and then do the AND.
For example for 10 steps multiply the pot by 10/16 (0.625) and then AND the top 4 bits.

That gives steps of

0.5625
0.5
0.4375
0.375
0.3125
0.25
0.1875
0.125
0.0625
0.0

Each step is 1/10th of the pots rotation 51 of 512 starting values.
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

While you have increased the resolution and the steps are closer in size they are still slightly different, below what the user will notice but still there. However if you are going to do the multiply and mask why not just subtract 1/10 of the pot value (51/512), check if < 0 and jump accordingly. The only point of masking was to break the pot into a range that is a power of 2 and results in 0 after the sof, if it is not a power of 2 you might as well just do something like:

rdax pot0,1
sof 1, -0.09961
skp neg, label1
sof 1, -0.09961
skp neg, label2
.
.
.

remember you do not need the last sof/skp pair because if it wasn't one of the proceeding 9 states it must be state 10 so no need to check for it.
Frank Thomson
Experimental Noize
Post Reply