zmxv / react-native-sound

React Native module for playing sound clips
MIT License
2.78k stars 747 forks source link

delay between sounds played #839

Open j67Sv89n opened 4 months ago

j67Sv89n commented 4 months ago

I have 7 sounds, 2 seconds long, in mp3 format, sounds are pre-loaded into the array and processed by the Sound object, all sounds have a constant full sound, without any transitions or attenuations. I launch sounds sequentially going through them in a for loop, but between sounds I hear the presence of a delay of about 200-400ms, Why don't the sounds play continuously? after all, they are already loaded into the array. Is it possible to launch the next sound in the queue 200-400ms earlier in this case? to level out this constant delay?

    function playSound(sound, callback) {
      sound.play((success) => {
        if (success) {
          console.log(`Successfully finished playing sound: ${sound._filename}`);
          callback();
        } else {
          console.log('Playback failed');
        }
      });
    }
OlivierCo commented 2 months ago

use .wav format