How to convert numpy arrays into Const() lookup tables #1053
Unanswered
jrmoserbaltimore
asked this question in
Q&A
Replies: 1 comment
-
I would say this is the best way, yeah |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What's the best way to convert a Numpy array into Const() lookup table?
Let's say you want to generate 8 mipmapped 24-bit integer band-limited sawtooth wave tables on power of 2 base frequencies from 16Hz to 2048Hz. Because these only contain odd-order harmonics, you only need to generate half the waveform (you need to roll around and invert direction to use it, i.e. 0, 1, 2, 3, 0, -1, -2, -3... and multiply the values at negative indexes by -1).
Doing this with Numpy using an 8x1024 array and converting the
float64
touint32
(each half is entirely positive or negative) containing values scaled to 24-bit integer representation is doable pretty simply:The question is how to convert to a table for Amaranth? The best I can come up with is the below change:
Is this the best way? Is there a better way?
Beta Was this translation helpful? Give feedback.
All reactions