How to generate 3D sound using only two channels (earphones) of a multi-channel system
Luis Goncalves <[email protected]> Tue, 26 Feb 2013 11:46:10 -0800
| Newsgroups | gmane.comp.lib.openal |
|---|---|
| Message-ID | <CAFR-ax7mPnHEJOW5gotmqoeCULccvFQQsP0RVMc1GHyAFK=OeA@mail.gmail.com> |
--===============1641572435== Content-Type: multipart/alternative; boundary=20cf307ca04cfea95904d6a5e9e6 --20cf307ca04cfea95904d6a5e9e6 Content-Type: text/plain; charset=ISO-8859-1 Hello! I'm creating an experiment for auditory psychophysics, and am trying to use OpenAL to generate virtual 3D sounds. The goals of the experiment are : 1. study the accuracy of localization of virtual sounds compared to real sounds 2. develop some sort of calibration (conformal map) function that can improve the correspondence of virtual sound locations to real sound locations. I have a SoundBlaster X-Fi Titanium card (on a Windows 7 machine), and have written programs to generate 3D sounds using the listener/source framework of OpenAL. Now I want to have a program that controls a 3D virtual sound with earphones/headphones, as well as a speaker placed at a desired location within the physical room (a "real" sound source). The experiment goes as follows: 1. place speaker at desired physical location in the room 2. have the user control the 3D position of the virtual sound source heard through earphones, so that it appears to be coming from the same location in the room as the speaker. (the user can toggle between listening to the virtual sound, and the "real" sound from the real speaker placed in the room) 3. This is done for several physical locations of the real speaker in the room, to generate a mapping of where virtual 3D sources have to be "placed" so as to sound like coming from the same spot where the real speaker is at. I only have one sound card, and have been trying to figure out how to control both a 3D virtual source listened to through earphones, and sound coming from a speaker placed somewhere in the room. I've gotten close : - the virtual sound source is a mono-channel (AL_FORMAT_MONO16) wav file, and I set up an OpenAL source with a 1/r^2 distance function. This gives me a controllable 3D virtual sound source. - the speaker is controlled by a 5.1-channel wav file (AL_FORMAT_51CHN16), where only the back left/right channels have a sound. - I put the sound card in 4/4.1 speaker configuration mode (otherwise, I can't hear the physical speaker sound). The problem with the above arrangement is that, with the sound card in 4.1 channel mode, the virtual sound source also produces sound in the speaker, not just the earphones. (If I make the virtual sound also be an AL_FORMAT_51CHN16 source, with waveforms only in the front left/right (earphone) channels, then the sound is no longer controllable in 3D - it just plays as it is in the buffer.) Question: Is there a way to: - have a 3D sound source produce sound* only in the earphones (front left/right channels)*, - and still be able to play a 4.1 channel wav file (that only has sound in the back front/left channels, so that that sound comes out only through the speaker, and not the earphones)? Thanks!!! Luis G. --20cf307ca04cfea95904d6a5e9e6 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div style=3D"color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13= px;background-color:rgb(255,255,255)">Hello!<br><br></div><div style=3D"col= or:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-col= or:rgb(255,255,255)"> I'm creating an experiment for auditory psychophysics, and am trying to= use OpenAL to generate virtual 3D sounds.</div><div style=3D"color:rgb(34,= 34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255= ,255,255)"> <br></div><div style=3D"color:rgb(34,34,34);font-family:arial,sans-serif;fo= nt-size:13px;background-color:rgb(255,255,255)">The goals of the experiment= are :</div><div style=3D"color:rgb(34,34,34);font-family:arial,sans-serif;= font-size:13px;background-color:rgb(255,255,255)"> <br></div><div style=3D"color:rgb(34,34,34);font-family:arial,sans-serif;fo= nt-size:13px;background-color:rgb(255,255,255)"><ol><li style=3D"margin-lef= t:15px">study the accuracy of localization of virtual sounds compared to re= al sounds<br> <br></li><li style=3D"margin-left:15px">develop some sort of calibration (c= onformal map) function that can improve the correspondence of virtual sound= locations to real sound locations.</li></ol><div><br></div><div>I have a S= oundBlaster X-Fi Titanium card (on a Windows 7 machine), =A0and have writte= n programs to generate 3D sounds using the listener/source framework of Ope= nAL.</div> </div><div style=3D"color:rgb(34,34,34);font-family:arial,sans-serif;font-s= ize:13px;background-color:rgb(255,255,255)"><br></div><div style=3D"color:r= gb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:r= gb(255,255,255)"> <br></div><div style=3D"color:rgb(34,34,34);font-family:arial,sans-serif;fo= nt-size:13px;background-color:rgb(255,255,255)">Now I want to have a progra= m that controls a 3D virtual sound with earphones/headphones, =A0as well as= a speaker placed at a desired location within the physical room (a "r= eal" sound source).</div> <div style=3D"color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13= px;background-color:rgb(255,255,255)"><br></div><div style=3D"color:rgb(34,= 34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255= ,255,255)"> The experiment goes as follows:</div><div style=3D"color:rgb(34,34,34);font= -family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">= <ol><li style=3D"margin-left:15px">place speaker at desired physical locati= on in the room<br> <br></li><li style=3D"margin-left:15px">have the user control the 3D positi= on of the virtual sound source heard through earphones, so that it appears = to be coming from the same location in the room as the speaker.<br>(the use= r can toggle between listening to the virtual sound, and the "real&quo= t; sound from the real speaker placed in the room)<br> <br></li><li style=3D"margin-left:15px">This is done for several physical l= ocations of the real speaker in the room, to generate a mapping of where vi= rtual 3D sources have to be "placed" so as to sound like coming f= rom the same spot where the real speaker is at.</li> </ol><div><br></div></div><div style=3D"color:rgb(34,34,34);font-family:ari= al,sans-serif;font-size:13px;background-color:rgb(255,255,255)">I only have= one sound card, =A0and have been trying to figure out how to control both = a 3D virtual source listened to through earphones, and sound coming =A0from= a speaker placed somewhere in the room.</div> <div style=3D"color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13= px;background-color:rgb(255,255,255)"><br></div><div style=3D"color:rgb(34,= 34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255= ,255,255)"> I've gotten close : =A0</div><div style=3D"color:rgb(34,34,34);font-fam= ily:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><ul>= <li style=3D"margin-left:15px">the virtual sound source is a mono-channel (= AL_FORMAT_MONO16) wav file, and I set up an OpenAL source with a 1/r^2 dist= ance function. =A0This gives me a controllable 3D virtual sound source.<br> <br></li><li style=3D"margin-left:15px">the speaker is controlled by a 5.1-= channel wav file (AL_FORMAT_51CHN16), where only the back left/right channe= ls have a sound.=A0<br><br></li><li style=3D"margin-left:15px">I put the so= und card in 4/4.1 speaker configuration mode (otherwise, I can't hear t= he physical speaker sound).</li> </ul><div>The problem with the above arrangement is that, with the sound ca= rd in 4.1 channel mode, =A0 the =A0virtual sound source also produces sound= in the speaker, not just the earphones.</div></div><div style=3D"color:rgb= (34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb= (255,255,255)"> (If I make the virtual sound also be an AL_FORMAT_51CHN16 source, with wave= forms only in the front left/right (earphone) channels, =A0then the sound i= s no longer controllable in 3D - it just plays as it is in the buffer.)</di= v> <div style=3D"color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13= px;background-color:rgb(255,255,255)"><br></div><div style=3D"color:rgb(34,= 34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255= ,255,255)"> <br></div><div style=3D"color:rgb(34,34,34);font-family:arial,sans-serif;fo= nt-size:13px;background-color:rgb(255,255,255)">Question: =A0Is there a way= to:</div><div style=3D"color:rgb(34,34,34);font-family:arial,sans-serif;fo= nt-size:13px;background-color:rgb(255,255,255)"> <ul><li style=3D"margin-left:15px">have a 3D sound source produce sound<i>= =A0only in the earphones (front left/right channels)</i>, =A0<br><br></li><= li style=3D"margin-left:15px">and still be able to play a 4.1 channel wav f= ile (that only has sound in the back front/left channels, so that that soun= d comes out only through the speaker, and not the earphones)?</li> </ul></div><div style=3D"color:rgb(34,34,34);font-family:arial,sans-serif;f= ont-size:13px;background-color:rgb(255,255,255)"><br></div><div style=3D"co= lor:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-co= lor:rgb(255,255,255)"> <br></div><div style=3D"color:rgb(34,34,34);font-family:arial,sans-serif;fo= nt-size:13px;background-color:rgb(255,255,255)">Thanks!!!</div><div style= =3D"color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;backgro= und-color:rgb(255,255,255)"> <br></div><div style=3D"color:rgb(34,34,34);font-family:arial,sans-serif;fo= nt-size:13px;background-color:rgb(255,255,255)">Luis G.</div> --20cf307ca04cfea95904d6a5e9e6-- --===============1641572435== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Openal mailing list [email protected] http://opensource.creative.com/mailman/listinfo/openal --===============1641572435==--