Trying to make really long exponential decay
Posted: Sat Jun 18, 2016 5:12 pm
Here's what I've tried:
(detect trigger and initialize pulse level to -1.0)
sof 0, -1.0
wrax pulse, 0
(decay)
rdax pulse, 0.9999
wrax pulse, 0
This is a vast over simplification but I hope you get what I am describing. The issue that I am having is that I'd like a decay to last a few seconds. The resolution of the multiplier used in an rdax, an S1.14 format number, is 2^(-14) or 0.0000610352-something.
So the largest number less than 1.0 would be 1.0 - 0.0000610352, or 0.999938965.
If I use that value, then after 0.1 second, or 3277 samples, the pulse will have decayed to (about) 0.999938965^3277 or 0.8187.
This would seem to be OK, however in practice I don't seem to be able to get a decay that is much longer than 150 msec. I can make the rdax statement:
rdax pulse, 0.9999999
but it doesn't make any difference after a certain point so I seem to be hitting the maximum value that is less than 1.0 and it doesn't seem as large as I thought it was going to be. Any idea where I am going wrong?
Follow up:
I'm guessing (haven't tried it yet) that I can use a register initialized with a 24-bit value and then mulx this with the current value of the pulse after an rdax pulse, 1.0. That way I can get as much resolution as is possible with the FV-1.
I have seen a few examples among all the FV-1 code where there appeared to be some precision-extending approach used to get around various coefficient quantization limits of different instructions. It would be nice to get these strategies gathered together and more fully explained.
(detect trigger and initialize pulse level to -1.0)
sof 0, -1.0
wrax pulse, 0
(decay)
rdax pulse, 0.9999
wrax pulse, 0
This is a vast over simplification but I hope you get what I am describing. The issue that I am having is that I'd like a decay to last a few seconds. The resolution of the multiplier used in an rdax, an S1.14 format number, is 2^(-14) or 0.0000610352-something.
So the largest number less than 1.0 would be 1.0 - 0.0000610352, or 0.999938965.
If I use that value, then after 0.1 second, or 3277 samples, the pulse will have decayed to (about) 0.999938965^3277 or 0.8187.
This would seem to be OK, however in practice I don't seem to be able to get a decay that is much longer than 150 msec. I can make the rdax statement:
rdax pulse, 0.9999999
but it doesn't make any difference after a certain point so I seem to be hitting the maximum value that is less than 1.0 and it doesn't seem as large as I thought it was going to be. Any idea where I am going wrong?
Follow up:
I'm guessing (haven't tried it yet) that I can use a register initialized with a 24-bit value and then mulx this with the current value of the pulse after an rdax pulse, 1.0. That way I can get as much resolution as is possible with the FV-1.
I have seen a few examples among all the FV-1 code where there appeared to be some precision-extending approach used to get around various coefficient quantization limits of different instructions. It would be nice to get these strategies gathered together and more fully explained.