Hi:
I am interested in developing some algorithms for the FV-1 (small scale sales - ranging from personal use to boutique level stompboxes), and will have a series of questions as I contemplate algorithms that would work on the architecture.
First question: How would you generate random numbers on the FV-1? The simplest technique I know of wouldn't work, as the FV-1 has saturation arithmetic. Are there any other cheap tricks that would work well for this chip? It does not have to be high quality noise, as it would be at a much slower rate than audio (sample/hold, "randi").
Thanks,
Sean Costello
How do you generate random numbers on the FV-1?
Moderator: frank
-
seancostello
- Posts: 74
- Joined: Mon Sep 11, 2006 10:04 pm
Interesting question, I suppose you could look at the the LSBs of the ADC input or use them to seed an LFSR as saturation limiting is not applied to logical operations in the chip.
Frank Thomson
Experimental Noize
Experimental Noize
-
seancostello
- Posts: 74
- Joined: Mon Sep 11, 2006 10:04 pm
Could you do something along the lines of
y[n] = (a*y[n-1] + c) modulo m
and implement a linear congruential generator? If so, how do you enter the values of a and c? Is there a way for the compiler to deal with 16 bit ints, or do you have to convert these to the floating point number that corresponds to the 2.14 representation of these numbers?
Also, do the registers saturate automatically, or will they wrap around? If they saturate, is it possible to implement the modulo in another method?
I know that the above noise generator will repeat fairly quickly, but I am using it for a few random values a second, so that is OK.
Thanks,
Sean
y[n] = (a*y[n-1] + c) modulo m
and implement a linear congruential generator? If so, how do you enter the values of a and c? Is there a way for the compiler to deal with 16 bit ints, or do you have to convert these to the floating point number that corresponds to the 2.14 representation of these numbers?
Also, do the registers saturate automatically, or will they wrap around? If they saturate, is it possible to implement the modulo in another method?
I know that the above noise generator will repeat fairly quickly, but I am using it for a few random values a second, so that is OK.
Thanks,
Sean
Hmmmm, not in the office so I can't test these ideas...
If you enter the values as hex rather than floating-point you should be able to treat the values as integer for the purpose here.
Saturation happens in the accumulator. But to do modulo, you could try an AND to mask off the upper bits.
If you enter the values as hex rather than floating-point you should be able to treat the values as integer for the purpose here.
Saturation happens in the accumulator. But to do modulo, you could try an AND to mask off the upper bits.
Frank Thomson
Experimental Noize
Experimental Noize