Author Topic: 3d audio  (Read 3012 times)

Offline djtoon

  • Dr. Type
  • ****
  • Posts: 290
    • View Profile
3d audio
« on: 2011-Nov-14 »
hi im trying to make a 3d audio game where the player needs to hear a direction of a sound
it seems to pan and volume arent that specific any one have ideas?

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3366
  • Integrated Brain
    • View Profile
Re: 3d audio
« Reply #1 on: 2011-Nov-14 »
HI Djtoon, what you want to do it´s something like this

http://www.youtube.com/watch?v=IUDTlvagjJA

I think in the description, explains or links to some web on tell how do it, I rebember it´s make something like play the same sound trhu the 2 ears but whit different phases (previous retouch in every sound).

Close your eyes, and listen the audio, it´s absolutelly brutal, very impressive!!!.


Offline Zapp

  • Mc. Print
  • *
  • Posts: 37
  • Indie Developer - Final Boss Games
    • View Profile
Re: 3d audio
« Reply #2 on: 2011-Nov-17 »
I have a similar question, was wondering if it is possible to speed up the currently playing music? Think of Streetfighter when you are low on health the music slightly increases in tempo the closer one player is to being knocked out.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10714
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: 3d audio
« Reply #3 on: 2011-Nov-17 »
load another music file.

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4218
    • View Profile
    • Portfolio
Re: 3d audio
« Reply #4 on: 2011-Nov-17 »
You guys remember chaos engine on the amiga?

So, Master Joseph would have some 2 or 3 music loops per stage.
Music would shift to another loop depending on the part of the stage. Shadow of the beat 3 did similar thing.

I 'would like' to do the same. But I would need to start the new loop perfectly at the end of the last loop, is this possible?

I understand in streetfighter, the second music loop just gets over the first, no matter when, so it must be easier this way.
Any extra thoughts?

Offline Slydog

  • Prof. Inline
  • *****
  • Posts: 930
  • KodeSource
    • View Profile
    • KodeSource
Re: 3d audio
« Reply #5 on: 2011-Nov-17 »
We can't have two music sources playing at once, correct? (via 'PLAYMUSIC')
The following may work if you played your music using regular sound effects. (via 'PLAYSOUND')

You could start both music / sound loops at the same time.
The one you want heard currently, set the volume to full, the other to mute.
When you want the music loop to switch (ie: time running out), over say 1/4 of a second, fade the playing song to mute while ramping of the muted song.

Seems like a waste of resources though!

[Edit] Never mind, you can't change the volume of a currently playing sound effect, only the current music via the MUSICVOLUME() command.  So you would either need the ability to play two music loops at once (and be able to dynamically change each volume independently), or change the volume of a sound effect dynamically.
« Last Edit: 2011-Nov-17 by Slydog »
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Offline Zapp

  • Mc. Print
  • *
  • Posts: 37
  • Indie Developer - Final Boss Games
    • View Profile
Re: 3d audio
« Reply #6 on: 2011-Nov-17 »
Yeah, I just want the ability to be able increase the speed at which the current track is played once the timer runs out, I could just have a musical track that speeds up slowly pre-recorded, but what I want is for the player to be able to do particular actions to increase their time limit, so the time of the level is dynamic.

Doesn't seem to be a current way to do this in GLB though, so i might scrap that idea until more sound support is added.

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4218
    • View Profile
    • Portfolio
Re: 3d audio
« Reply #7 on: 2011-Nov-17 »
There is always a way to do something, not that I know about what you need enough to recommend something... ;)

On some other thread, a friend was adding support to a music/sound lib or something like that.
If your case target is not mobiles, you can check that.

I guess, but am not sure, I could start a new music loop just at the end of last loop, knowing their durations and so on.
Another thing, if this dosen´t work, is to insert a drums roll between one music and another, or something like that, to mix them up.

I´m still a couple weeks to start music part on my game, I will be able to help more when that time comes. :good:

MrTAToad

  • Guest
Re: 3d audio
« Reply #8 on: 2011-Nov-18 »
If the program is just for Windows, then you could always use BASS/FMOD...

Offline fuzzy70

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 828
  • Look left, Look right, LOOK OUT!!
    • View Profile
Re: 3d audio
« Reply #9 on: 2011-Nov-18 »
While tempo shifting is possible with samples it's not very efficient if more than one are playing, as in a song. The best & most common way is using either midi or mods as they can speed up or slow down when ever you want them to.

While mods where the main source back in the Amiga days they do exist on the pc & like MrTAToad said BASS/FMOD can play them back & thats what I used in Blitz. Midi is limited to the playback of sounds thats on the device unless you find a player that supports soundfonts so you can change the sounds to your own, I think BASS/FMOD does but not 100% sure on that.

How you interface them with GLB & what devices are supported sadly I have no idea as not got into sound/music yet in GLB.

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4218
    • View Profile
    • Portfolio
Re: 3d audio
« Reply #10 on: 2011-Nov-18 »
hey mentalthink! the barbershop kicks!
I have it here as a wav full quality, did not see your recommended video up there.

It really rocks on headphone, some people can´t stand it hehe, wonderful to see people reaction on that...

Offline Zapp

  • Mc. Print
  • *
  • Posts: 37
  • Indie Developer - Final Boss Games
    • View Profile
Re: 3d audio
« Reply #11 on: 2011-Nov-18 »
Well I'm building for Iphone, so perhaps that limits what i can do with the tempo changing music for the time being. I'm not experienced enough to delve into anything outside of GLB yet.

Offline fuzzy70

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 828
  • Look left, Look right, LOOK OUT!!
    • View Profile
Re: 3d audio
« Reply #12 on: 2011-Nov-18 »
Sadly sound is one of those things that seems to get little attention in programming languages, they seem to think that just playing a wave file or midi file is good enough, hence why things like FMOD etc exist.

I think GLB's problem is mainly down to the fact it supports so many different platforms that sound is a lot more complex to integrate & work on all of them compared to the graphics side of things. Only thing that springs to mind is OPENAL, but again I have no idea what platforms that targets & if it covers the range GLB does.

Macs use AIFF & pc's WAV etc etc, basically audio is a pain in the arse  :O

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

Offline Hatonastick

  • Dr. Type
  • ****
  • Posts: 474
  • Amstrad CPC 6128
    • View Profile
Re: 3d audio
« Reply #13 on: 2011-Nov-18 »
http://connect.creativelabs.com/openal/OpenAL%20Wiki/Platforms.aspx

Nowhere near enough unfortunately.  I love GLB, but its sound system could do with a few more options.  Problem is it's limited to whatever the SDL sound libraries (is SDL_MIXER being used?) do.  At least I think that is what Kitty is using.
« Last Edit: 2011-Nov-18 by Hatonastick »
Mat. 5: 14 - 16

Android: Toshiba Thrive Tablet (3.2), Samsung Galaxy Tab 2 (4.1.2).
Netbook: Samsung N150+ Netbook (Win 7 32-bit + Ubuntu 11.10).
Desktop: Intel i5 Desktop with NVIDIA GeForce GTX 460 (Win 8.1 64-bit).

Offline fuzzy70

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 828
  • Look left, Look right, LOOK OUT!!
    • View Profile
Re: 3d audio
« Reply #14 on: 2011-Nov-18 »
Well if SDL_MIXER is being used then panning, distance etc is in SDL

http://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer_frame.html

Quote
4.6 Effects

 These functions are for special effects processing. Not all effects are all that special. All effects are post processing routines that are either built-in to SDL_mixer or created by you. Effects can be applied to individual channels, or to the final mixed stream which contains all the channels including music.

Registration 4.6.1 Mix_RegisterEffect        Hook a processor to a channel
4.6.2 Mix_UnregisterEffect        Unhook a processor from a channel
4.6.3 Mix_UnregisterAllEffects        Unhook all processors from a channel
4.6.4 Mix_SetPostMix        Hook in a postmix processor

Built-in Processors 4.6.5 Mix_SetPanning        Stereo panning
4.6.6 Mix_SetDistance        Distance attenuation (volume)
4.6.7 Mix_SetPosition        Panning(angular) and distance
4.6.8 Mix_SetReverseStereo        Swap stereo left and right


 The built-in processors: Mix_SetPanning, Mix_SetPosition, Mix_SetDistance, and
 Mix_SetReverseStereo, all look for an environment variable, MIX_EFFECTSMAXSPEED to be defined. If the environment variable is defined these processors may use more memory or reduce the quality of the effects, all for better speed.
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)