RazTools / Audio

Tool that helps with audio files.
MIT License
26 stars 12 forks source link

Where to get VO for externals? #3

Closed davispuh closed 8 months ago

davispuh commented 8 months ago

Hi,

From https://github.com/Dimbreath/StarRailData we can get ExcelOutput/VoiceConfig.json where will be names for externals in VoicePath key like

  "103040552": {
    "VoiceID": 103040552,
    "VoicePath": "chapter3_3_firefly_253"
  },

But it doesn't match with any External hash so how do you get VO file? Maybe you need to prepend some value to this?

Modder4869 commented 8 months ago

something like https://gist.github.com/undefined9071/90cd0f6ede44affd2978ef5947b5e14a or SR

from json import load

NAMES = []
PATH = 'VoiceConfig.json'
LANGUAGES = ['English', 'Japanese', 'Chinese(PRC)', 'Korean']
GENDER = ['m', 'f']

if __name__ == '__main__':
    with open(PATH) as f:
        doc: dict = load(f)

    for k0, v0 in doc.items():
        if 'VoicePath' in v0:
            name = v0['VoicePath']
            if 'IsPlayerInvolved' in v0 and v0['IsPlayerInvolved']:
                for gender in GENDER:
                    values = [f"{x}/voice/{name}_{gender}.wem" for x in LANGUAGES]
                    for val in values:
                        NAMES.append(val + '\n')
            else:
                values = [f"{x}/voice/{name}.wem" for x in LANGUAGES]
                for val in values:
                    NAMES.append(val + '\n')

    with open('vo.txt', 'w') as f:
        f.writelines(NAMES)

    print("done !!")
davispuh commented 8 months ago

Awesome that works, basically we just need to prepend $LANG/voice/ and append .wem.

I did it with this oneliner

$ jq -r 'values[].VoicePath' ExcelOutput/VoiceConfig.json | sort -u | sed 's|^|English/voice/|' | sed 's|$|.wem|'

^ that matched ~25.5k out of ~30k so now I understand this :)

Thanks!