[[ Interpolate -> game.Audio.Music Volume ]] does nothing.
JodyMitoma
Member Posts: 307
Why is it that when I try to have music fade in at an interpolate value of 1 at the beginning of my levels, the music doesn't fade in at all, but instead comes in abruptly?
Basically, the Interpolate -> game.Audio.Music Volume function does nothing at all. I've tried changing the values, and still nothing. I even tried mute (0), it does not mute. Please assist. Thank you kindly in advance.
Comments
You have imported your music as a 'sound' rather than 'music' ?
All my sounds are .ogg. All my music are .m4a.
I have a Play Music behavior going, that allows me to chose one of my .m4a's.
.ogg's are only select-able under Play Sound.
So I'm the only one having this problem? O.o That's insanity! Nobody else using the Windows version of Creator had ever wanted to have music fade in/fade out smoothly? Poop.
Can someone please chime in?
So not only have you tried interpolate, but have you tried change attributes? Are you changing the value of the music attribute on a different scene from where it's being played? Are you constraining the music volume to 1, for some reason?
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Change attribute? If I were to go that route, would I need 10 "change attribute's", and increase the volume one by one from 0 to 100? That seems rather code heavy for nothing.
I doubt I have any interpolate's setting music to 1 anywhere else, but I shall check. Thanks for your ideas.
...I don't think you follow.
The music volume goes from 0 to 1. The numeric value of 1 means that it's at 100%. 0, as you may have guessed, means that the volume is switched off.
Having said that, you only need one change attribute to change the music volume...period. If you want the music volume off, simply change the value to 0.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Ah nope, I definitely understood that all.
What I'm wanting however, is for the volume of the music to fade in from 0 (mute) up to full volume (1), at an interpolated time of 1 second.
Oh, for my previous post I meant from 0 to 1, in "0.1" intervals..
And you're using Windows? Could the Windows interpolate behavior be broken? Let me try it on Mac.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
I have no idea. Yes, Windows Creator. Thank you kindly for that.
PS. Interpolation of a graphic changing size, and fading in and out works perfectly without problem. Just having trouble with fading in/out music.
It works fine on Mac. Here are my behaviors and rules. I had this project already set up with the "music" as a sound file. That's why you see the Play Sound in the logic stack.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Heh.
You see, that's a problem though because I don't want to fade in/out all of the "sound" in my level, I want to fade in/out just the music. But thank you very much for taking the time!
I just tested with fading in/out a "Sound", and it works perfectly fine, but when attempting to fade in/out a "Music", it just decides not to give a crap.
Hmm... Unless we can interpolate one specific sound somehow?
Ah, the hell with it - I'll just make the music file a sound file, and interpolate all sounds for the first 0.5, or 0.75 second of each level.
Thank you again, for your attempted assistance!
I guess this is a bug that we may have to get looked into.
Don't give up !
It sounds like how you have it set up is correct - and there's a bug of some sort going on, but it should work just as you describe.
You could fade up just the individual sound track (rather than the whole 'sound' channel) - hold on let me work out a quick equation for you . . . .
. . . back in a second.
@JodyMitoma
In the Play Sound behaviour enter the following into the expression window for volume . . . . .
self.time
Simple as that, so the volume starts out at 0 and after 1 second the volume is 1 . . . and none of the other sounds are effected by the fade and stay at whatever volume you set them at.
If you want a slower fade:
self.time/10 (10 seconds)
If you want a faster fade:
self.time * 10 (0.1 seconds)
. . .
One note: In theory the 'Volume' is constantly tracking the actor's self.time, but as volume can't go above 1 you don't have to worry about it getting progressively louder, but I'm not sure whether the continued tracking of self.time by the volume expression would use up any processor cycles, I can't imagine it puts any strain whatsoever on a project but if you did want to stop the actor tracking its self.time once the volume had faded up to 1 you can wrap your play sound behaviour in a rule that says - when attribute self.time is less than 1 . . .
That is truly outstanding work. I had no idea you could put in behaviors there... but I guess you can pretty much do anything you want! Good call on that one, and thank you so much for figuring out a fix for my issue here. I greatly appreciate you taking the time out of your day to help a struggler. Absolutely phenomenal.
self.time and game.time did not work here.
Also, on another note, I have a popup screen that shows up at the beginning of every level, and I have it so that this popup (paused) screen pauses the MUSIC... so, damn it.
Edit: Nevermind. Apparently just "Play Sound" isn't working at all in the case that I need it to. Gah.
Edit 2: AAAAAND fixed. ^_^
Edit 3: I love you, @Socks.
They work absolutely fine for me, might be a Mac / PC thing ? (I'm on a Mac).
I've always said 'it didn't work' is the least helpful feedback you can get when attempting to track down an issue.
Can you say in what way it didn't work, i.e. the track wouldn't play at all, it played but without a fade up so it came in a full volume or your starting volume and stayed at that level, GS told you game.time was an invalid expression. It faded up but stopped at the end of the fade up . . . etc
It feels like someone trying on clothes in a shop trying to buy a jacket who tells the assistant - after having tried on a jacket - "nope, no good" - the assistant is left wondering whether it was too small, too big, uncomfortable, wrong colour . . . etc . . so doesn't really know whether to get a larger one or a smaller one and so on.
So, was the expression too tight ?
Did you select game.time from the pull down menu or type it in by hand ?
Another option: make an attribute 'VOL', select this in the expression window for the sound's volume. Then add an interpolation behaviour that interpolates VOL from 0 to 1.
You could simply turn the volume of the music down rather than pause it, would that work for your game ?
So sorry you had to write all of that, Socks. And the only reason I put "it didn't work", was because I was going to attempt to fix it myself, which I did. I had edited my post 3 times after initially posting it, 5 minutes after posting the post itself.
Never attempt to fix a broken expression by yourself ! They can be very dangerous. if you are going to attempt a fix then wear protective gloves and goggles.
Glad you sorted it out !