GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Kindle fire sound delay

The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,913Member
edited November 2011 in Tech Support
Is there any resolution to the issue with the sound delay on the Kindle Fire? I've heard it mentioned it has something to do with the version of Android it uses. Since the Fire is the hottest platform and with it featured as a publishing option on the GameSalad web-banner, Is there any solution to this sound issue. Right now there is no way I can publish to the amazon market. Our children's interactive books are narrated with follow along highlighted words and the delay makes it impossible to time out right.

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,913Member
    Kindle Fire has just released an update hoping this might fix the sound delay issue.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,913Member
    Well they need to take down the Web banner and stop advertising it.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,913Member
    I found this in a developer blog it explain how to code for the android 2.2 bug. http://developer.anscamobile.com/forum/2011/02/19/audio-delay-android
  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,913Member
    edited November 2011
    Somone needs to set the correct time stamp for these post as well...lol it's not 11:21pm
  • beefy_clyrobeefy_clyro Posts: 5,390Member
    It is in English time :)
  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,913Member
    I've been doing some research and the issues with version 2.2 have to do with preloading the sound file asset. I don't know if sound files are preloaded in GS or not. This could explain T-Shirts find as music files may be preloaded. If GS could give us say a option, much like preloading our art, then we could choose to preload the sounds we want so it doesn't effect processor speed. I'm posting what I read from an android blog on this issue. It seems the key is how you use soundpool classes.

    The SoundPool class manages and plays audio resources for applications.

    A SoundPool is a collection of samples that can be loaded into memory from a resource inside the APK or from a file in the file system. The SoundPool library uses the MediaPlayer service to decode the audio into a raw 16-bit PCM mono or stereo stream. This allows applications to ship with compressed streams without having to suffer the CPU load and latency of decompressing during playback.

    In addition to low-latency playback, SoundPool can also manage the number of audio streams being rendered at once. When the SoundPool object is constructed, the maxStreams parameter sets the maximum number of streams that can be played at a time from this single SoundPool. SoundPool tracks the number of active streams. If the maximum number of streams is exceeded, SoundPool will automatically stop a previously playing stream based first on priority and then by age within that priority. Limiting the maximum number of streams helps to cap CPU loading and reducing the likelihood that audio mixing will impact visuals or UI performance.

    Sounds can be looped by setting a non-zero loop value. A value of -1 causes the sound to loop forever. In this case, the application must explicitly call the stop() function to stop the sound. Any other non-zero value will cause the sound to repeat the specified number of times, e.g. a value of 3 causes the sound to play a total of 4 times.

    The playback rate can also be changed. A playback rate of 1.0 causes the sound to play at its original frequency (resampled, if necessary, to the hardware output frequency). A playback rate of 2.0 causes the sound to play at twice its original frequency, and a playback rate of 0.5 causes it to play at half its original frequency. The playback rate range is 0.5 to 2.0.

    Priority runs low to high, i.e. higher numbers are higher priority. Priority is used when a call to play() would cause the number of active streams to exceed the value established by the maxStreams parameter when the SoundPool was created. In this case, the stream allocator will stop the lowest priority stream. If there are multiple streams with the same low priority, it will choose the oldest stream to stop. In the case where the priority of the new stream is lower than all the active streams, the new sound will not play and the play() function will return a streamID of zero.

    Let's examine a typical use case: A game consists of several levels of play. For each level, there is a set of unique sounds that are used only by that level. In this case, the game logic should create a new SoundPool object when the first level is loaded. The level data itself might contain the list of sounds to be used by this level. The loading logic iterates through the list of sounds calling the appropriate SoundPool.load() function. This should typically be done early in the process to allow time for decompressing the audio to raw PCM format before they are needed for playback.

    Once the sounds are loaded and play has started, the application can trigger sounds by calling SoundPool.play(). Playing streams can be paused or resumed, and the application can also alter the pitch by adjusting the playback rate in real-time for doppler or synthesis effects.

    Note that since streams can be stopped due to resource constraints, the streamID is a reference to a particular instance of a stream. If the stream is stopped to allow a higher priority stream to play, the stream is no longer be valid. However, the application is allowed to call methods on the streamID without error. This may help simplify program logic since the application need not concern itself with the stream lifecycle.

    In our example, when the player has completed the level, the game logic should call SoundPool.release() to release all the native resources in use and then set the SoundPool reference to null. If the player starts another level, a new SoundPool is created, sounds are loaded, and play resumes.
  • Rob2Rob2 Posts: 2,402Member
    The whole reason that sound effects are treated differently from music is that they need to play instantly and often with multiple instances occurring simultaneously. A short delay before a background music/environment track started would be acceptable or easily dealt with but this problem needs to be fixed as soon as possible. Good audio is easily 50% of any project sometimes. Presumably there is an issue with decoding (weather it is in software or hardware) as I believe the sound effects are done by hardware with music being done by the game engine.

    Lets hope the real cause is that GS have their androids mixed up!

    Fire 2.3.4
    Nook Tablet 2.3
    Nook Color 2.2
This discussion has been closed.