[SOLVED] Lua computation time question
Posted: Sun Jul 08, 2012 4:55 pm
Hello! My name is Aaron V. and I'm hoping to work on a procedural audio project.
If it turns out well, I'd like to make an audio based game or something fun like that with Love.
Otherwise, I'll probably just make a different game lol.
I'm using ProteaAudio - it's pretty great.
And it's going well, too.
But sound needs a ton of Sine waves - the more the better.
I'm worried because of calculation time.
I can make a table that would store enough sine results to make a clunky approximation of Sine.
For example 1000 data points is said to give perfect audio for up to 500 Hz - not sure if they're counting the fact that you can use the first half for the second half...
Human ear goes up to 40000 Hz of course, requiring at least 40000 data points for perfect audio.
The cool part is that I'm not worried about perfectly recreating a sine wave.
So I'd only need like 1600 data points - 1600 numbers in RAM - 6400 bits I'm guessing.
Not sure if that's a lot but I have 4 gb of RAM so I'm not worried about it lol.
Blah blah blah
MY QUESTION IS would it not be faster to call up data from a table than to calculate sine?
How many times more efficient do you suppose one is over the other?
I only need an educated guess, I'd rather not mess around with benchmarking lol.
I'm still pretty slow at programming so that's no trivial task for me.
If it turns out well, I'd like to make an audio based game or something fun like that with Love.
Otherwise, I'll probably just make a different game lol.
I'm using ProteaAudio - it's pretty great.
And it's going well, too.
But sound needs a ton of Sine waves - the more the better.
I'm worried because of calculation time.
I can make a table that would store enough sine results to make a clunky approximation of Sine.
For example 1000 data points is said to give perfect audio for up to 500 Hz - not sure if they're counting the fact that you can use the first half for the second half...
Human ear goes up to 40000 Hz of course, requiring at least 40000 data points for perfect audio.
The cool part is that I'm not worried about perfectly recreating a sine wave.
So I'd only need like 1600 data points - 1600 numbers in RAM - 6400 bits I'm guessing.
Not sure if that's a lot but I have 4 gb of RAM so I'm not worried about it lol.
Blah blah blah
MY QUESTION IS would it not be faster to call up data from a table than to calculate sine?
How many times more efficient do you suppose one is over the other?
I only need an educated guess, I'd rather not mess around with benchmarking lol.
I'm still pretty slow at programming so that's no trivial task for me.