Issue with resupply cabinet sound replacement

Discussion in 'Mapping Questions & Discussion' started by Pocket, Oct 15, 2015.

  1. Pocket

    aa Pocket func_croc

    Messages:
    4,489
    Positive Ratings:
    2,219
    So, you remember that project I was working on that would turn someone else's Minecraft recreation of Mann Manor back into a playable TF2 map? I ran into a weird problem.

    See, among other things, I reskinned the resupply cabinet as a wooden chest. And thanks to Freyja's advice on replacing sounds, I was able to successfully swap out the sound it usually makes when you open and close one. It took me some trial, error, and judicious use of snd_refresh to get it to sync up properly with the actual animation, since the pause in between the open and close sequences is hard coded into the game. But once I finally got it right, I discovered a new issue: The sound file cuts off before it can finish!

    My first thought was that there must be a hard limit to how long this sound will play. So I double-checked whether the open and close sequences were in fact as fast as they are in the real game, and sure enough, they were a bit too slow. So I cut them down, recompiled the model, and reloaded the game; even without changing the sound file in any way, the faster animations failed to mess up the syncing. But then I got another idea: What if it was cutting out the sound at the moment the animation ended? So I added a little extra time to the end of the close sequence to see if it did anything. But again, the sound stopped the split second the lid landed.

    Any clue what might be happening here? Is there maybe an actual hard limit on length?
     
  2. Pocket

    aa Pocket func_croc

    Messages:
    4,489
    Positive Ratings:
    2,219
    SOLUTION FOUND: CHECK IT OUT PLEASE THIS IS INTERESTING

    I decided to try a hackier approach: changing the actual sound to a silent one and adding ambient_generics that trigger OnAnimationBegun. I'd forgotten that this means it'll play twice, when it opens and when it closes, but this did teach me that when it plays the second time, when it's closing, it stops at the same spot in the sound clip even though the animation has long since stopped. So apparently there is a hard limit on length, for some reason, and it's for any sound clips, not just func_regenerate. But then I had a weird idea — what if the limit isn't on length, but file size? I had been using a WAV file. So I re-exported as MP3 this time and tried again, and sure enough, that fixed it. So I went back to my original approach and it worked perfectly.

    So, a word to the wise: I don't know why or since when, but there's something preventing WAV files from playing more than a scant few seconds. MP3 does not have this limitation. I know it was probably already a no-brainer for most of you, but definitely always use MP3 for any custom sounds you want to use in your map. This has been Pocket with your irregularly scheduled public service announcement.
     
    • Thanks Thanks x 4