Real-Time Sound Convolver for Windows
Welcome to the RTSC project. This project aims at providing real-time convolution of all sound streams in Windows using a user-created convolution kernel. Currently, only a non-real-time prototype has been made, on other words, the DSP part. It can be downloaded as a C99 source with the files it depends on and as a compiled binary as well here. The device driver part still has to be done, and unfortunately since I have no experience of that type of programming, I can't complete it myself. Intended result The intended result of this project would be a device driver for Windows that would "intercept" (I mean buffer) all the sound streams normally going to the output of the sound card, process them and forward the resulting buffers to the audio output. The basic idea holds in these few words. If you have trouble understanding the idea, drop me a note and tell me about what you don't understand or wish to know. Presentation of the work done So far, I have made a convolution function, in other words the CPU hungry function that performs the processing of the sound, and implemented it as a non-real-time program written in C99 and using FFTW 3.1.1 for Windows. I have tried anything I can to make it as fast as I could, I use floats not doubles, use FFT convolution with overlap-add and I took much care of never reallocating/freeing in order to make it be able to run fine and indefinitely with a low memory consumption (always under 2 MB when using reasonable settings), however, I wouldn't spit on a review of my code, so feel free to comment on it and ask questions. I've had a though time measuring how efficient my code was, however I can tell that in real-time the convolution function alone should use as low as 4% of a 2.0 GHz Athlon Sempron CPU and even maybe less, using a decent buffer size, 1024 samples or more, using a kernel of a decent size (at least 2049 samples), the input and output sounds having a sample rate of 44,100 Hz and in stereo. Keep in mind that the CPU time the program takes doesn't necessarily mean a lot, since the buffer input and output functions can take up to two thirds of the total CPU time (I guess this is due to fwrite()/fread()), and that those two hungry functions will not be needed in the final program. You can help this project Now that the core of the project is made, what is needed is a device driver that can "intercept" all of the sounds that normally go to the audio output (in case it's not clear I mean every sound from the music of the CD you play to sound from video games), make buffers of it of a certain size (at least 1024 I presume, buffer size and kernel size are the two interdependent critical settings in order to obtain the best performance) available to my convolution function as a two-dimensional array of floats (the first dimension being for the channels, even if the sound is in mono) of values ranging from 32767.0 to -32768.0 (actually any range will give just the same result, but that one might require the less computations) and send the same array to the sound device. Basically, all I need you to do is make some device driver that makes all the sound go through itself and at some point have that format, then I'll do the rest. E-mail : michelrouzic at users.sourceforge.net or michel0528 at yahoo dot fr |