Initial game sound fade-in starts at full volume before fading from -0.2 on device but not preview.
dmengl
Member Posts: 4
I've searched the forum a fair way but I can't seem to find a solution.
At the very start of my game, i have ambient sounds that fade in over 2 seconds. This works fine in the windowed preview but when testing on the device the fade in never starts at zero. There's a short half second blast of sound at 1 and then the fade in begins.
I've set my global sound and musical 'devices' volumes to 0 from the outset. If I delay the fade in, the exact same issue is repeated just at the later time.
Is there a hole in my design or is this a glitch that only happens on the device? Is there a solution?
Thanks for your time.
At the very start of my game, i have ambient sounds that fade in over 2 seconds. This works fine in the windowed preview but when testing on the device the fade in never starts at zero. There's a short half second blast of sound at 1 and then the fade in begins.
I've set my global sound and musical 'devices' volumes to 0 from the outset. If I delay the fade in, the exact same issue is repeated just at the later time.
Is there a hole in my design or is this a glitch that only happens on the device? Is there a solution?
Thanks for your time.
Answers
This resolved an issue where sounds cut of when fading to zero.
It's a different problem but perhaps it resolves yours.
How have you set it up? Do you use interpolate to fade?
Lump Apps and My Assets
Unfortunately I'm already fading from -0.2 to 1.2. The fade itself is completely intact and smooth, just no matter how I program it the volume is initially at full for a split second before the fade starts.
Basically i have a touch making a bunch of actors appear, lets call it 'touchON' with a timer 'timer' that counts how long touchON has been true for the entirety of the game
game.Audio.sound volume = 0
Volume1 = -0.2
when 'touchOn' is false and 'timer' = 0 (ie. game initialises in a neutral state)
Play sound at volume 'Volume1'
interpolate Volume1 to 1.2 over 3 seconds.
//
Again, it only happens on the device (iPhone3gs). It's like there's a 1.5 second lag before any sound control is cued.
Because now timer should be exactly 0 when the sound plays while it is in fact 0 or bigger.
Lump Apps and My Assets
edit: oops.. but you are finding a difference between desktop and viewer ..err..maybe a codec issue.
Ludwig: I have taken the timer out of it completely, I am still getting the same issue.
Rob: three .caf files all converted with afconvert from .wav files. I have just re-rendered the original sound files to .ogg and the problem is replicated.
I've also searched the entire project for anywhere I may have placed a stray volume change, so far I haven't found anything. Will have to see if the problem is replicated on another device. That may take some time though...
Gah!
Not necessarily relevant here but GS converts wavs on import and gives you the option of sound or music.
0 being no sound and 1 being max sound
Any values above 1 give you maximum volume (1) and any values below 0 give you maximum attenuation (0) so there is no worry about 'screwing' with the system, for example a volume of 15 or 324 will simply play back at maximum volume (1) while -56 or -12,000 will be silent (0).
The reason you might want to go to -0.2 or +1.2 (strictly speaking this only need be just under -0.1 or just over +1.1 but a value of 0.2 is a convienient number) is to 'trim off' the last 0.2 of the interpolate behaviour - as there is a glitch where the interpolate 'jumps' the final 0.1+ of it's interpolation.
This issue is applicable to anything using interpolate and shows up particularly badly on things that fade over a small value range (ie: alpha channel fades from 0 to 1 and from 1 to 0 . . . . or audio fades from 0 to 1 and from 1 to 0) . . . and although the issue effects all interpolate behaviours - on something like a 100 pixel interpolated move you are not going to notice that the last 0.1 (a tenth of a pixel) of that 100 pixel move 'jumps' as GameSalad does not show sub-pixel events - and even if it did it would be imperceivable - whereas having the last 10% of a 0-1 value range missing is very noticeable when fading (in the case of the OP) over 2 seconds.
Also strictly speaking you need only add the additional 0.2 of interpolation to the end of your interpolation (as that is where the glitch is) - so a perfectly smooth fade up would be 0 to 1.2 (no need for -0.2 to 1.2) - and a perfectly smooth fade out/down would be 1 to -0.2.
http://dl.dropbox.com/u/8244920/Sound Fade In.zip
There's clearly some bug in what I have done. It was pretty late when I initially posted so I'm sure I can work it out. I'll take it from here. Must learn to sleep on things. haha
Thanks so much for all the help guys.
There is still a fairly obvious glitch at the start of the sound, here's a picture of the waveform as it's playing in GameSalad, you can see the glitch at the start:
Also seems to cause some pretty unusual bugs on my old core2duo.
If I drag the Play Sound and Interpolate behaviours out of the timer when I play the project my system audio is knocked out for the duration of the now silent audio file !!