DevMaster.net Forums
[[ Home | Forums | 3D Engines Database | Wiki | Articles/Tutorials | Game Dev Jobs | IRC Chat Network | Contact Us ]]

Go Back   DevMaster.net Forums > Programming & Development > Sound and Music Programming
User Name
Password
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
Old 06-28-2006, 05:56 AM   #1
WatsonLadd
New Member
 
Join Date: Jun 2006
Location: New Jersey
Posts: 4
Question Convoluting sounds with memory restrictions

I have a sound that I want to convolute with the transfer function of the area without having to put the whole sound in memory. Is there a way to do this, or will I just have to make a Fourier Transform of the sound, and the room, multiply, and compute an inverse fourier transform, then play the sound?
WatsonLadd is offline   Reply With Quote
Old 06-28-2006, 07:33 AM   #2
monjardin
Senior Member
 
Join Date: Oct 2005
Location: Pensacola, FL
Posts: 1,028
Default Re: Convoluting sounds with memory restrictions

I like the term convolve much better. To convolute implies obfuscation. Now on to your question!
Here is the convolution integral:

However, you are working a discrete environment, so you get this:

So, for each n step you calculate for y, you need to sum the right term over the range of your whole signal. With that said, you could read each mth value from the transform and signal functions one at a time without placing the whole signal in memory, but you will need to do this for all of n.
Code:
float readX(int sample); float readH(int sample); void writeY(int sample, float value); void convolveSignals() { for (int n = 0; n < NUM_SAMPLES; ++n) { float y = 0; for (int m = 0; m < NUM_SAMPLES; ++n) y += readX(m) * readH(n - m); writeY(n, y); } }
Needless to say, you could get much better performance with the whole thing in memory.

Of course, I haven't done this before and I could be way off!
___________________________________________
monjardin's JwN Meter (1,2,3,4,5,6):
|----|----|----|----|----|----|----|----|----|----|
*
monjardin is offline   Reply With Quote
Old 06-28-2006, 08:20 AM   #3
donBerto
Senior Member
 
donBerto's Avatar
 
Join Date: Jan 2003
Location: East Coast, USA
Posts: 370
Default Re: Convoluting sounds with memory restrictions

having the entire sound data in memory gives you absolute fidelity. alternatively, let's say you have n sound data for every second. you could skip every m sound data such that now you're only loading (n-m) sound data per second. that leaves your entire sound data smaller. optionally, you could then interpolate the "points" between the smaller data set to "regain" the sacrificed data.

all of this, of course, would cost you processing time. pick your trade-off.

just my 2cents.

:regards:
___________________________________________
Imagine.
donBerto is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Forum Jump


All times are GMT -7. The time now is 01:10 AM.


Powered by vBulletin
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.