Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Criminal Enterprises
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

*DO NOT* SHARE MEDIA OR LINKS TO LEAKED COPYRIGHTED MATERIAL. Discussion is allowed.

[?] Good sound and sound playback for pops, bangs and crackles


ikt
 Share

Recommended Posts

I'm adding an anti-lag feature to my Turbo Fix script, but I'm running into a presentation issue - namely audio.

The stock pops, bang and crackle sounds used in the game scripts are woefully unfit for anti-lag sounds. I've since switched to irrKlang to play sounds, which somewhat works, but it sounds *terrible*.

This is what it sounds like, when creating an explosion on the exhaust bone:


Pretty decent, but too loud and the explosions make to AI go full tilt. It's got a bit too much of an echo. It's a miracle the cops aren't called on me.

This is my attempt with irrKlang, using a random assortment of bangs from freesound.org:
 

 

Why does it sound so horrible? Is it the choice of sounds? Is it the timing between the sounds? Is it irrKlang and me spamming the sounds? I'm playing it at a similar rate as the first video.

My current implementation lives here: https://github.com/E66666666/GTAVTurboFix/tree/feature/pop-crackle-bang (TurboScript.cpp: updateTurbo function and the DoExplodyThing function)


Aside from increasing time (which doesn't change the still-horrible sound but at least makes pacing bearable) I'm kind of out of ideas.


What I'm aiming for is a similar experience like this:

 


The logic, I've got down already. I plan on playing the first 12 or so pops and bangs pretty loudly, and transition to a burbling poppy sound after that.

Edited by ikt
Link to comment
Share on other sites

Hmm, actually sounds like the sound engine cutting off already-playing sounds instead of playing them (or multiple instances of one sound) simultaneously. There's this weird distortion too.

Link to comment
Share on other sites

Okay, seems like irrKlang doesn't like playing two streams at once. It sounds decent when just one sound is being played.

I'm now having trouble with positioning.
 

    Vector3 camPos = CAM::GET_GAMEPLAY_CAM_COORD();
    Vector3 camRot = CAM::GET_GAMEPLAY_CAM_ROT(0);
    Vector3 camDir = RotationToDirection(camRot);

    UI::DrawSphere(camPos + camDir, 0.125f, 255, 0, 0, 255);
    UI::ShowText(0.5f, 0.5f, 0.5f, std::to_string(Length(camDir)));

    mSoundEngine->setListenerPosition(
        { camPos.x, camPos.y, camPos.z },
        { camDir.x, camDir.y, camDir.z },
        { 0, 0, 0 },
        { 0, 0, 1 }
    );

    // Per bone
    Vector3 bonePos = ENTITY::GET_WORLD_POSITION_OF_ENTITY_BONE(vehicle, boneIdx);
    UI::DrawSphere(bonePos, 0.125f, 0, 255, 0, 255);

    // A random pick of one of the .wav files
    mSoundEngine->play3D(mSoundNames[randIndex].c_str(), { bonePos.x, bonePos.y, bonePos.z });


1. DrawSphere correctly draws a sphere in front of the camera, so the direction vector and camera position is okay.

2. DrawSphere correctly draws a sphere on the exhaust bone, so that coordinate is also okay.

3. Sound is played and does move from side to side, but it's quite random depending on the vehicle angle and camera angle.

 

From documentation, setListenerPosition's 2nd argument is the direction vector, so that should be good? The fourth argument is the world "up" vector, which is positive Z in GTA.

Link to comment
Share on other sites

Is the sound engine using the same coordinate system as the game? By that I mean does a rotation of a certain value in the game match a rotation value the sound engine expects? If not, then the direction it's getting might be different to what it expects. There are two systems, Left-Handed and Right-Handed.

 

GTA5 is unusual in the fact that the heading works anti-clockwise, East is 270 degrees and the Rotation.Z value for that is -90f. Normally you would expect heading and Rotation.Z to both be positive 90. That's how the Right-Handed system works, but the sound engine might expect values based on the Left-Handed system.

 

It might not be relevant but GTA5's rotation and heading system has caused me headaches in the past and it might be contributing here as well.

Edited by LeeC22
Link to comment
Share on other sites

Oh man, that might actually have been the problem! Thank you so much, I never considered rotation directions not matching, especially since it had an "up" vector definition.

 

I ended up making the "up" vector point down, which works perfectly.

Link to comment
Share on other sites

The whole system is weird because normally X = Left/Right, Y = Up/Down and Z = In/Out, hence the terms Z-Buffer... and Z-fighting. I don't know if this X,Y,Z orientation is the same in earlier GTA games, it does seem a strange design choice, unless there are advantages to it in some strange universe. It's Rockstar, who knows...

 

Good that you got it working though, that's the important part.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.