"layered" music

Game Editor comments and discussion.

"layered" music

Postby Toasterman » Sun Jan 30, 2011 5:27 pm

In some games I've noticed a cool effect with their music that I wondered if you could do in GE
Sometimes there will be one music track playing, and another one with the same tune, maybe with some drums etc, will overlay onto it

Like in Super Mario World on the super nes, the main tune will be playing, but when you get on Yoshi, the same tune will play but with drums
However, the track doesn't start again or anything, it just adds to what is already there based on some context in the game
Could an effect like this work in GE (I suspect they have special programs to do stuff like this)

I don't know any way to change music without restarting the track.
You can only have one music play at a time, but is there a way to have more and just change the volume on one to off and on at certain points?

I can explain better if this is unclear
"If there are no stupid questions, what kind of questions do stupid people ask? Do they get smart just in time to ask a question? -Scott Adams

Hey! I've got okayish internet now! Now I can try all those cool demos I've seen!
User avatar
Toasterman
 
Posts: 75
Joined: Thu Jul 22, 2010 4:22 am
Location: Drowning in Dial-Up Ocean
Score: 7 Give a positive score

Re: "layered" music

Postby sonicfire » Sun Jan 30, 2011 6:03 pm

thats what you could do, yes! start two sounds at the same time and let them loop forever. start the second with volume of zero.
only enable (volume=1) the second sound that should be the additional layer (like drums or something) when you need it.
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Re: "layered" music

Postby Toasterman » Sun Jan 30, 2011 6:15 pm

Heh, for some reason, I thought you couldn't change the volume of sound :oops:
-a self answered question, is that a new dimension of fail or what? :lol:

On a side note, how can you know what channel a sound is on?
Most of my sound and music is generated in game, so is there a way to return somethings channel instead of just guessing?
(I've not really used the stopSound() function much)
"If there are no stupid questions, what kind of questions do stupid people ask? Do they get smart just in time to ask a question? -Scott Adams

Hey! I've got okayish internet now! Now I can try all those cool demos I've seen!
User avatar
Toasterman
 
Posts: 75
Joined: Thu Jul 22, 2010 4:22 am
Location: Drowning in Dial-Up Ocean
Score: 7 Give a positive score

Re: "layered" music

Postby Game A Gogo » Sun Jan 30, 2011 6:21 pm

if I'm not mistaking, playsound2 returns an int, which is the channel the sound is played on. You should check the documentation for further information
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: "layered" music

Postby sonicfire » Sun Jan 30, 2011 9:21 pm

Game A Gogo wrote:if I'm not mistaking, playsound2 returns an int, which is the channel the sound is played on. You should check the documentation for further information


Exactly! :)

Use something like:

Code: Select all
musicAvol = 1;
musicBvol = 0;

musicAch = 0;
musicBch = 0;

(...)

musicAch = PlayMusic("musicA.wav", musicAvol, 999);
musicBch = PlayMusic("musicB.wav", musicBvol, 999);


And whenever you want to "play" music B:

Code: Select all
musicBvol = 1;


and for completely stopping any music either stopSound(musicAch); or stopSound(musicBch);


not sure if this also works with playmusic or playmusic2, but it should.
(i still dont know the real differences between playsound and playmusic, i always use playsound :) )

hope that helps :)
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Re: "layered" music

Postby Game A Gogo » Sun Jan 30, 2011 9:42 pm

playmusic always plays the music in the first channel
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: "layered" music

Postby Toasterman » Sun Jan 30, 2011 9:52 pm

Thanks :)
That ought to work

The reason I was interested- I thought it would be cool for the music to change dynamically in the level depending on whats happening
Like if the character goes underwater the music turns all muffled or different instruments play, or something
Or in a town or large building, the music looses some of the instruments when you enter a house or move up a level
Maybe it could get more complex the deeper you go into a dungeon or level
Something like that
"If there are no stupid questions, what kind of questions do stupid people ask? Do they get smart just in time to ask a question? -Scott Adams

Hey! I've got okayish internet now! Now I can try all those cool demos I've seen!
User avatar
Toasterman
 
Posts: 75
Joined: Thu Jul 22, 2010 4:22 am
Location: Drowning in Dial-Up Ocean
Score: 7 Give a positive score

Re: "layered" music

Postby sonicfire » Sun Jan 30, 2011 11:24 pm

Game A Gogo wrote:playmusic always plays the music in the first channel


Thanks so much! Didn´t know that :)
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Re: "layered" music

Postby BloodRedDragon » Sun Feb 13, 2011 2:30 pm

I tried this with a guitar hero style game, where the music beats were synced with a grid actor at a constant velocity. The one problem is that if your computer's sound card isnt that great, and the audio quality is higher than 22050 hz, then the music may skip spontaneously every now and then, causing one track to go out of time with another.

One other idea:

Super Mario Galaxy (both games) have homeworld tracks that add more instrumental parts depending on how far you get in the game, meaning there is about five different tracks for the homeworld that change every time you return after defeating a boss (maybe?) This way, you wouldnt have to worry about audio sync. :)
Current projects:
Techno-Tank Arena: on hold
Techno-Tank SuperPortal (working title): 0.1%
Bowels of Galaxies: 35% (was a bit too optimistic)
User avatar
BloodRedDragon
 
Posts: 123
Joined: Tue Jan 29, 2008 10:07 pm
Location: The Underworld
Score: 5 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest