Sound Problems

Blitz3D Forums/Blitz3D Programming/Sound Problems

Fintan(Posted 2010) [#1]
I'm currently having a problem where I'm trying to have an ambient wind sound and a sound from the sea by the side. I want to make it where if the player moves away from the sea, the sound gets quieter and quits, using 3d sound. I want the wind to play as a normal 2d sound. The problem is that when I do this, I get no sound at all. I know it's probably a stupid mistake that I made and I can't seem to find, so any help would be appreciated.

Here's my code:




Rroff(Posted 2010) [#2]
does it play sound at all for either if you try one at a time? seem to remember something about spaces in filenames could cause problems with sounds but I could be getting it mixed up with something else.


Fintan(Posted 2010) [#3]
I tried them one at a time, like you said. Neither sound played, so I removed the spaces from my filenames. Still no sound. The strange thing is, they both work when I make them each 2D sounds and remove the "CreateListener" command line. If I leave that line in and make them both 2D sounds, then the only sound that plays is the sea.


xtremegamr(Posted 2010) [#4]
I see two possible solutions:

1) According to this thread, the sound you're trying to emit has to be a mono sound, or EmitSound won't work.

2) Here's a useful quote from that thread:
My second thought, if you're sure the listener is parented to your camera, is that the sound source is actually too far away to sound correct. If I remember right, in other programs you were moving things like 3 blitz units per game loop. If your game world is scaled large, something that does not look that far away could actually be like 500 units away, making the sound originate ~500 meters away.


CreateListener ( parent[,rolloff_factor#][,doppler_scale#][,distance_scale#] )

If I remember correctly, Blitz uses the scale 1 unit = 1 meter internally. If your world is scaled larger than this, try messing with the rolloff_factor and distance_scale parameters when you create your listener.


Fintan(Posted 2010) [#5]
Thankyou so much, xtremegamr. Apparently my world was scaled a lot bigger than I had realised. I played around with those parameters and it worked fine. My first sound still wouldn't work with "Playsound" but for some strange reason it works if I use "Emitsound" and emit it from the camera even though it isn't a true 3D sound. In any case, problem solved.

Thanks again.


xtremegamr(Posted 2010) [#6]
Glad to help. :)