SetChannelPan

Monkey Forums/Monkey Programming/SetChannelPan

cgrossi(Posted 2015) [#1]
Hello!

Does the command SetChannelPan work? I've downloaded the 83a version and I can't make it pan right or left, like BlitzMax. Does anyone know why?


MikeHart(Posted 2015) [#2]
Which target platform? Which value do you use for left and right?


cgrossi(Posted 2015) [#3]
So far for Desktop, the values are -1 and 1, acording to the documentation...


MikeHart(Posted 2015) [#4]
On GLFW and HTML it works here like I would expect it. Running OSX 10.8.5.


cgrossi(Posted 2015) [#5]
ok, I'm not using OSX. instead, I'm using Windows 7. on blitzmax it works fine....


MikeHart(Posted 2015) [#6]
Are you sure you are setting the channels correctly?


MikeHart(Posted 2015) [#7]
Tested on Win7 too, it works.


cgrossi(Posted 2015) [#8]
I think so... Here is it, it's just a test code, to learn the language.




cgrossi(Posted 2015) [#9]
That's strange... How is your code?


MikeHart(Posted 2015) [#10]
I just placed this in the autotest example after the SetUpdateRate(15) command:

		SetChannelPan(0,-1)
		SetChannelPan(1,0)
		SetChannelPan(2,1)


And then I press 2 all the time so you hear the effect,


dawlane(Posted 2015) [#11]
Is the file you are playing stereo? Stereo files should play equally out of the left and right speakers no matter what you set the panning to. Only mono files would play correctly.

If I remember OpenAL does not support the pan left/right as it is a 3D Sound API. As in real life a sound close to you on the left will be louder on the left than the right. You would still hear the sound through the right. If the sound was far away, then you would hear the sound equally through the left and right.

Google Panning in OpenAL you will see there have been a number of questions asked.

Use the code below and one of the compatible target shoot audio file formats from the examples. And then try your own audio file.



cgrossi(Posted 2015) [#12]
Hello.
I turn my audio into mono and it works perfectly. Thank you, dawlane.

Thanks a lot, guys!!

Best regards.


dawlane(Posted 2015) [#13]
Tips for audio:
Music should be stereo for best results. If there is no difference between left and right channels, then consider using mono to save a bit of memory and disk space. Sound effects should be mono.

Audio format support for web browsers depends on the browser, so expect to have to use the Dom module to try and work out which browser is being used so you can load the correct supported audio file. Also limit the number of sound channels being use to avoid sound issues. Search the forum in the HTML5 targets and in the BUGS section for more.

The MP3 format is not seamless. I don't think looping audio was thought about when that format was drafted, so looping creates a gap. There are tools to remove or limit this gap in play back, but your mileage will vary.

Not all audio formats are supported by the desktop targets. So don't expect to play an wma format on a Linux distribution.

Two tools to check out if you are short on cash.
LMMS is a free cross platform music creation application that is similar to FL Studio.
Audacity is a free audio editing suite like SoundWave, etc. To export audio as MP3 you have to have LAME installed.


cgrossi(Posted 2015) [#14]
Thanks, dawlane, for the tips.

Regards