Thanks to DCIEM and CRC, I have received permission to release the package under the GNU General Public Licence.
- soundscapeUpdate(), which specifies the coordinates of the sound source and listener and the positions of the walls of the room which they occupy, and
- spatialize(), which given a vector of monaural speech samples produces a vector of binaural spatialized speech samples based on the previously supplied coordinates.
The window which opens when you launch sound2d.exe is a plan view of a room. Click the left mouse button to move the position of the sound source. Click the right mouse button to move the position of the listener. Drag the window to change the size and shape of the room.
The file menu allows the user to open and play a sound file. The sound file must be monaural, 16 bit samples, and recorded at 11025 samples/second. The sound card must be able to support stereo output at this sampling rate.
A text space at the bottom gives the azimuth and range of the sound source relative to the listener, as well as the number of taps and last tap position for the right and left ear filters.
Five sound rays are shown. The blue ray is the direct ray from sound source to listener. The four green rays are first order reflections of the sound off the walls of the room.
The program reads in a stereo hrtf file recorded in (left/right) sample formats as 16 bit ints. It calculates an inverse filter based on the right channel hrtf, then applies the inverse filter to the left channel. The sampling rate is reduced from the original 44100 Hz to 11025 Hz by decimation after low pass filtering in the frequency domain.
This function is based on a paper entitled "A New Principle for Fast Fourier Transformation", Charles M. Rader and N.M. Brenner, I.E.E.E. Transactions on Acoustics, Speech and Signal Processing, June 1976, pp 264-266. It is loosely based on a translation of a FORTRAN subroutine "FOUREA", which appeared in the book "Programs for Digital Signal Processing", published by I.E.E.E. Press, chapter 1, section 1.1, 1979.
Also included is a small test application that can be
used to compare the result of this FFT with four1.c from
Numerical Recipes in C. Note that the Licence of
that book does not allow redistibution of the four1.c code. This
test application can guide you in converting other programs to
use the open source FFT.
The latency associated with the operating system limits the rate of
motion which can be imparted to the sound. As a result, we have
considered running the 2D sound engine on a DSP coprocessor rather than
within the Windows environment, and have developed a low-level API for
the TMS320-C3X DSP for use in this and other projects.
The low-level API is similar in functionality to the low-level sound API
for Windows, and allows the developer to program at a higher level of
abstraction, not having to deal with hardware interrupts. It contains
drivers for the Crystal CS4231A audio codec and implements audio buffers
as linked lists. When actions on a given buffer
are complete, a user-specified callback
function is called to process the buffer. The last thing the function
must do is add the buffer back to the end of the linked list.
An example of the use of the API is contained in System35.c. The
example refers to functions of a vocoder which are not within the scope
of the GNU General Public Licence. The developer can substitute her own
functions for the ones shown.
TMS320C3x code
Obtaining the package
The source code of Version 0.1.5 of the software is distributed in a ZIP
file here. I have also provided a ZIP file
of the Windows executable. It is recomended
that you look at the README file which is also
included in the source package.
The dHRTF calculation utility and the C_FFT package are both in the 2dHRTF.zip package.
you may also obtain just the C_FFT function Here
The TMS320 Code is Here
Please send me any comments and suggestions at karen@cyberus.ca
Please read the
FAQ
Web Page designed by Charles MacDonald