Author Topic: 3d Sound With Multiple Speakers  (Read 1111 times)

roimatola

  • Posts: 9
3d Sound With Multiple Speakers
« on: 17 Nov '10 - 16:42 »
Hi, i'm trying to achieve the effect in the picture.



The ideia is that the speakers have different volumes of the same stream according to some position. I was trying to use the 3D functionality with the bass mixer for managing the channel, but i canīt actually find a way to give the speakers position. Any clues how to achieve this effect?

roimatola

  • Posts: 9
Re: 3d Sound With Multiple Speakers
« Reply #1 on: 17 Nov '10 - 20:06 »
And just another question (donīt know if its better to create another topic, but since its on the same problem), can i use the Asio plugin and still have the 3D functionality?

Ian @ un4seen

  • Administrator
  • Posts: 20436
Re: 3d Sound With Multiple Speakers
« Reply #2 on: 18 Nov '10 - 12:52 »
The ideia is that the speakers have different volumes of the same stream according to some position. I was trying to use the 3D functionality with the bass mixer for managing the channel, but i canīt actually find a way to give the speakers position. Any clues how to achieve this effect?

It isn't possible to set the speaker positions, but you could use the BASSmix add-on and its matrix mixing feature to mimic that. For example, if there are 4 speakers, you could create a 4 channel mixer (BASS_Mixer_StreamCreate), plug in the source (BASS_Mixer_StreamAddChannel) with matrix mixing enabled (BASS_MIXER_MATRIX flag), and set the levels in the matrix (BASS_Mixer_ChannelSetMatrix) according to the speaker distance/direction.

And just another question (donīt know if its better to create another topic, but since its on the same problem), can i use the Asio plugin and still have the 3D functionality?

The BASS 3D functions can't be used with ASIO output, but the BASSmix add-on can, so you could still do the above.

roimatola

  • Posts: 9
Re: 3d Sound With Multiple Speakers
« Reply #3 on: 18 Nov '10 - 18:15 »
Cool, didnīt knew about this matrix functionality, and it pretty much seems to work for me.

However it seems that the relationship in the matrix values is not linear (that, or i am doing something terribly wrong).

I'm doing a small example with a timer, and trying a fade out, like this
Code: [Select]
            stream = Bass.BASS_StreamCreateFile(filename, 0, 0, BASSFlag.BASS_STREAM_DECODE);

            asioProc = new ASIOPROC(AsioCallback);
            mixer = BassMix.BASS_Mixer_StreamCreate(44100, 8, BASSFlag.BASS_STREAM_DECODE);

            BassMix.BASS_Mixer_StreamAddChannel(mixer, stream, BASSFlag.BASS_MIXER_MATRIX)

            BassAsio.BASS_ASIO_Stop();
            BassAsio.BASS_ASIO_ChannelEnable(false, 0, asioProc, new IntPtr(mixer))
           
            for (int i = 1; i < 4; i++)
                BassAsio.BASS_ASIO_ChannelJoin(false, i, 0)         

            float[,] matrix =
            {
                {0, 1},
                {0, 1},
                {0, 1},
                {0, 1}
            };

            BassMix.BASS_Mixer_ChannelSetMatrix(stream, matrix)
            BassAsio.BASS_ASIO_Start(0);

            someCounter = 1;

And then i add this function in a timer running every 50 milliseconds

Code: [Select]

            someCounter -= 0.001f
            float[,] matrix =
            {
                {0, someCounter},
                {0, someCounter},
                {0, someCounter},
                {0, someCounter}
            };

            BassMix.BASS_Mixer_ChannelSetMatrix(stream, matrix)


And i am having the fade out effect, however it seems to not be linear, it seems to give some jumps in the sound near the end, is this the expected behavior?

roimatola

  • Posts: 9
Re: 3d Sound With Multiple Speakers
« Reply #4 on: 18 Nov '10 - 18:31 »
Never mind, i'm stupid, the bug was somewhere else in my code. Thanks a lot for the help Ian.