cyb3rpsych0s1s / audioware

Audio modding tool for Cyberpunk 2077
7 stars 0 forks source link

How to use it ? #20

Closed donk7413 closed 1 week ago

donk7413 commented 3 months ago

Hi ! I'm interested about your project and wanna try to use it in my mods.

How to do with CET mod ?

Roms1383 commented 3 months ago

Thanks for your interest in Audioware @donk7413 !

Before going into the explanations, please note that these are subject to evolve, because what I implemented so far for Audioware was actually only what I needed for Addicted. Only recently people started to show interest in Audioware, so I'm gonna add more features and make it definitely more flexible down the line.

So basically you can see from Addicted optional files:

  1. add a folder to host your files: you can pick between r6\audioware or mods e.g. r6\audioware\MyMod

  2. inside create a yaml file which, for now, has to be named voices.yml here's what it looks like:

    version: 1.0.0 # this is just a reminder to yourself, if you want to version your file
    voices:
    ono_hhuh: # ID of your custom voice (this has to be unique)
    fem: # female version
      en-us: # locale for your language e.g. english here
        file: vanilla/en-us/v_q113_f_1956c7fde04e1000.Wav # path of the sound relative to this file (has to be in same folder)
        subtitle: Huh? # subtitle automatically played alongside sound
    male: # male version
      en-us:
        file: vanilla/en-us/v_q113_m_1956c7fde04e1000.Wav
        subtitle: Huh?
    # more sounds ...

    In its current form it's still limited to voices, but gender (fem/male) is not mandatory, only the locales are.

    And yes adding SFX without any locale is already planned

  3. play like any sound from vanilla, using your custom voice IDs, e.g.

    let game = GetGameInstance();
    let player = GetPlayer(game);
    GameInstance.GetAudioSystem(game).Play(n"ono_hhuh", player.GetEntityID(), n"V");

    I'm not familiar with Lua, but it should be roughly something like:

    
    local gameInstance -- GameInstance
    local player -- ref<PlayerPuppet>

player = Game.GetPlayer(gameInstance) Game.GetAudioSystem():Play(CName.New("ono_hhuh"), player:GetEntityID(), CName.New("V"))


The way your sound will currently be routed to appropriate track internally depends on the parameters given previously to `Play(eventName: CName, opt entityID: EntityID, opt emitterName: CName) -> Void`: 
- if `entityID` is the player,  `emitterName` is used to display subtitle
- if `entityID` is a NPC, `emitterName` is used to display subtitle and song is played "spatially" (the further the player is from the entity the lighter, the closer the louder)
- if there's no `entityID` it's played on a more general track
The routing logic can [be found here](https://github.com/cyb3rpsych0s1s/audioware/blob/main/audioware/src/engine/tracks.rs#L140-L181), and it's bound to evolve.
> note: `PlayOverThePhone` has a separate dedicated track with a sound effect to muffle audio, as over the phone.

If there's any error you can find them, like any native plugin, under `red4ext/logs`.

There's a few [more features you probably saw in the readme](https://github.com/cyb3rpsych0s1s/audioware?tab=readme-ov-file#features), but there will be definitely more to come.

p.s: I leave this issue opened for now, if you want to ask further questions, but I'll automatically close it after a few days otherwise.
donk7413 commented 3 months ago

Thanks for your answer ! 😀

So I literally followed your instructions :

1 - Downloaded the Addicted FR pack (i'm french), game in french : here

2 - Placed it in mods folder, for science, i rename it test_sound and rename the reference in info.json too info.json : { "name": "test_sound", "version": "1.0.0", "customSounds": [] } folder : image

3 - audioware is installed and working (looking at the red4ext logs)

4 - I do by CET: Game.GetAudioSystem():Play("ono_hhuh", Game.GetPlayer():GetEntityID(),"V")

5 - It doesn't work, and in red4ext logs, i got:

[2024-05-22 07:21:23.001] [audioware] [warning] unknown sound (ono_hhuh)

Any idea ?

BTW the fact that you will add without locale is really great, because my mods are currently all in english, whatever the locales of the player.

Roms1383 commented 3 months ago

1 - Downloaded the Addicted FR pack (i'm french)

I'm french too, do not hesitate to reach me out on Discord if you want to chat directly.

5 - It doesn't work, and in red4ext logs, i got:

That's very strange indeed, because it seems correct. I'd suggest you contact me on Discord so we can review your installed files faster.

BTW the fact that you will add without locale is really great, because my mods are currently all in english, whatever the locales of the player.

Yes, in the meantime you can live with defining everything under en-us while waiting for the release :)

Roms1383 commented 1 week ago

@donk7413 guide now available at https://cyb3rpsych0s1s.github.io/audioware/ 👌