function continuePlaying(entity, sound) {
    if (!entity.getData("fiskheroes:flying")) {
        return false;
    }
    
    var vel = entity.motion().length();
    var ticks = sound.ticksPlaying();
    var volume = 0;
    
    if (vel >= 0.01) {
        volume = Math.min(Math.max(vel * vel / 2, 0), 1);
    }
    
    if (ticks < 20) {
        volume *= ticks / 20;
    }
    
    if (volume > 0.8) {
        sound.setPitch(0.2 + volume);
    }
    else {
        sound.setPitch(1);
    }
    
    sound.setVolume(volume * 0.6);
    return true;
}
