Initial game sound fade-in starts at full volume before fading from -0.2 on device but not preview.

dmengldmengl 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. :)

Answers

  • LumpAppsLumpApps Member Posts: 2,881
    Try fading from -0.2 to 1.2
    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?
  • dmengldmengl Member Posts: 4
    Thanks for the speedy response.

    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.
  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    Before the fade rule try to add a change attribute for the device sound volume to 0.

  • LumpAppsLumpApps Member Posts: 2,881
    Have you tried when time is ≥ 0
    Because now timer should be exactly 0 when the sound plays while it is in fact 0 or bigger.
  • Rob2Rob2 Member Posts: 2,402
    edited March 2012
    There is a bug(?) that ignores values set in the left panel (Game, devices) and always sets audio and music to 1 so Marks suggestion should cure it.

    edit: oops.. but you are finding a difference between desktop and viewer ..err..maybe a codec issue.
  • dmengldmengl Member Posts: 4
    Mark: that added an extra stutter to the whole thing so now there is two drastic drops in volume!

    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!
  • dmengldmengl Member Posts: 4
    Also, it's still replicated when my game restarts so it's not just an initialising thing. Hmm...
  • Rob2Rob2 Member Posts: 2,402
    edited March 2012
    I would get some display texts or the debugger on the case to see what is going on with volumes. Display texts are great because they update automatically - they are basically constrained to whatever attribute you choose.

    Not necessarily relevant here but GS converts wavs on import and gives you the option of sound or music.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    edited March 2012
    Why are you trying to start from below 0? you are prob screwing with the system by using -0.2 and 1.2 as far as I know the sound value only works from 0 to 1

    0 being no sound and 1 being max sound
  • CloudsClouds Member Posts: 1,599
    edited March 2012
    Why are you trying to start from below 0? you are prob screwing with the system by using -0.2 and 1.2 as far as I know the sound value only works from 0 to 1

    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.
  • Rob2Rob2 Member Posts: 2,402
    edited March 2012
    +1 the audio system attributes behave just like any other rounding to min or max.

  • dmengldmengl Member Posts: 4
    Thanks Mark. That actually works perfectly (probably something I should have tried myself).

    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.
  • CloudsClouds Member Posts: 1,599
    edited March 2012
    @MarkOnTheIron
    @dmengl Is that what your looking for?

    http://dl.dropbox.com/u/8244920/Sound Fade In.zip


    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:


    image
  • Rob2Rob2 Member Posts: 2,402
    @dmengl Is that what your looking for?

    http://dl.dropbox.com/u/8244920/Sound Fade In.zip

    Plays perfectly the first time and then the glitch as shown by Tynan.

    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 !!

Sign In or Register to comment.