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.
[SOLVED] Lua computation time question
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
[SOLVED] Lua computation time question
Last edited by AaronV on Tue Jul 24, 2012 9:33 pm, edited 1 time in total.
What have I gotten myself into?
Re: Lua computation time question
the table will likely be faster, since function calls are fairly expensive. in a simple benchmark i did they were around 4x faster.AaronV wrote: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.
well no, that's just a thing you have to do when sampling audio; you need to sample at least twice your target frequency in order to get a good approximation of the sound. the human ear actually only goes up to around 20khzFor 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.
Re: Lua computation time question
Oh, right. Hence the 40000 number - double 20000. My bad.
Well thank you, I'll be using a table then.
It's gonna sample at waaaay the wrong rate and be exceptionally fast.
Well thank you, I'll be using a table then.
It's gonna sample at waaaay the wrong rate and be exceptionally fast.
What have I gotten myself into?
-
- Prole
- Posts: 1
- Joined: Mon Sep 10, 2012 2:42 pm
- Contact:
Re: [SOLVED] Lua computation time question
thanks a lot.... thanks for your information... very much useful for me.... keep on posting...:-)
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 5 guests