lol-voice


Namelol-voice JSON
Version 1.0.4.1 PyPI version JSON
download
home_pagehttps://github.com/Virace/py-bnk-extract
Summary通过解析英雄联盟游戏内WAD、BNK、WPK、BIN等文件来提取音频文件,并可以按照触发事件分类
upload_time2024-05-04 11:42:40
maintainerNone
docs_urlNone
authorVirace
requires_python>=3.8
licenseGPL-3.0-only
keywords league wad bnk
VCS
bugtrack_url
requirements xxhash zstd
Travis-CI No Travis.
coveralls test coverage No coveralls.
            当前仓库已转移到https://github.com/Virace/league-tools

当前仓库已转移到https://github.com/Virace/league-tools

当前仓库已转移到https://github.com/Virace/league-tools


# py-bnk-extract

英雄联盟语音解包工具, 由Python语言编写.



- [介绍](#介绍)
- [安装](#安装)
- [使用](#使用)
- [问题](#问题)
- [维护者](#维护者)
- [感谢](#感谢)
- [许可证](#许可证)


### 介绍
可以将英雄联盟中wpk或bnk中音频文件按照皮肤的触发条件分类解包, 默认为wem音频格式, 使用 [vgmstream](https://vgmstream.org/downloads) 可转码.

- [index.py](lol_voice/index.py#L250)中 _extract_audio_ 函数逻辑以及HIRC部分块结构和WPK文件结构参考[Morilli](https://github.com/Morilli)编写的解包工具[https://github.com/Morilli/bnk-extract](https://github.com/Morilli/bnk-extract)
- [WAD.py](lol_voice/formats/WAD.py)中 文件结构以及部分逻辑来源于[https://github.com/CommunityDragon/CDTB](https://github.com/CommunityDragon/CDTB) 和 [https://github.com/Pupix/lol-file-parser](https://github.com/Pupix/lol-file-parser)

其余bnk文件结构来参考:[http://wiki.xentax.com/index.php/Wwise_SoundBank_(*.bnk)](http://wiki.xentax.com/index.php/Wwise_SoundBank_(*.bnk))


### 安装


`pip install lol-voice`

`pip install -e git+https://github.com/Virace/py-bnk-extract@package#egg=lol_voice`

### 使用
此包适合提取已知皮肤语音, 如需全部提取请关注 [lol_extract_voice](https://github.com/Virace/lol_extract_voice)
```
from lol_voice import extract_audio
from lol_voice.formats import WAD


def example():
    """
    按触发事件文件夹分类提取 剑魔 语音文件
    :return:
    """

    # 临时目录和最终输出目录
    temp_path = r'D:\Temp'
    out_path = r'D:\Out'

    # 英雄名字, 以及对于默认皮肤的三个文件路径
    champion = 'aatrox'
    bin_tpl = f'data/characters/{champion}/skins/skin0.bin'
    audio_tpl = f'assets/sounds/wwise2016/vo/zh_cn/characters/aatrox/skins/base/{champion}_base_vo_audio.wpk'
    event_tpl = f'assets/sounds/wwise2016/vo/zh_cn/characters/aatrox/skins/base/{champion}_base_vo_events.bnk'

    # 需要解析两个WAD文件, 这个路径修改为自己的游戏目录
    wad_file1 = r"D:\League of Legends\Game\DATA\FINAL\Champions\Aatrox.wad.client"
    wad_file2 = r"D:\League of Legends\Game\DATA\FINAL\Champions\Aatrox.zh_CN.wad.client"

    # 将上面三个文件提取到临时目录
    WAD(wad_file1).extract([bin_tpl], temp_path)
    WAD(wad_file2).extract([audio_tpl, event_tpl], temp_path)

    # 根据三个文件对应提取语音并整理
    extract_audio(
        bin_file=os.path.join(temp_path, os.path.normpath(bin_tpl)),
        event_file=os.path.join(temp_path, os.path.normpath(event_tpl)),
        audio_file=os.path.join(temp_path, os.path.normpath(audio_tpl)),
        out_dir=out_path
    )

if __name__ == '__main__':
    example()
```
### 问题
待解决:
 - ~~不同事件调用相同语音, 导致文件重复~~
 - 不排除文件有缺失问题, event文件解析不完整



### 维护者
**Virace**
- blog: [孤独的未知数](https://x-item.com)

### 感谢
- [@Morilli](https://github.com/Morilli/bnk-extract), **bnk-extract**
- [@Pupix](https://github.com/Pupix/lol-file-parser), **lol-file-parser**
- [@CommunityDragon](https://github.com/CommunityDragon/CDTB), **CDTB** 
- [@vgmstream](https://github.com/vgmstream/vgmstream), **vgmstream**

- 以及**JetBrains**提供开发环境支持
  
  <a href="https://www.jetbrains.com/?from=kratos-pe" target="_blank"><img src="https://cdn.jsdelivr.net/gh/virace/kratos-pe@main/jetbrains.svg"></a>

### 许可证

[GPLv3](LICENSE)
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Virace/py-bnk-extract",
    "name": "lol-voice",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "league, wad, bnk",
    "author": "Virace",
    "author_email": "Virace@aliyun.com",
    "download_url": "https://files.pythonhosted.org/packages/44/9e/66926b95d2d702ca46f6859b9a31862c902db5946343c15aca830ae1d5fa/lol_voice-1.0.4.1.tar.gz",
    "platform": null,
    "description": "\u5f53\u524d\u4ed3\u5e93\u5df2\u8f6c\u79fb\u5230https://github.com/Virace/league-tools\n\n\u5f53\u524d\u4ed3\u5e93\u5df2\u8f6c\u79fb\u5230https://github.com/Virace/league-tools\n\n\u5f53\u524d\u4ed3\u5e93\u5df2\u8f6c\u79fb\u5230https://github.com/Virace/league-tools\n\n\n# py-bnk-extract\n\n\u82f1\u96c4\u8054\u76df\u8bed\u97f3\u89e3\u5305\u5de5\u5177, \u7531Python\u8bed\u8a00\u7f16\u5199.\n\n\n\n- [\u4ecb\u7ecd](#\u4ecb\u7ecd)\n- [\u5b89\u88c5](#\u5b89\u88c5)\n- [\u4f7f\u7528](#\u4f7f\u7528)\n- [\u95ee\u9898](#\u95ee\u9898)\n- [\u7ef4\u62a4\u8005](#\u7ef4\u62a4\u8005)\n- [\u611f\u8c22](#\u611f\u8c22)\n- [\u8bb8\u53ef\u8bc1](#\u8bb8\u53ef\u8bc1)\n\n\n### \u4ecb\u7ecd\n\u53ef\u4ee5\u5c06\u82f1\u96c4\u8054\u76df\u4e2dwpk\u6216bnk\u4e2d\u97f3\u9891\u6587\u4ef6\u6309\u7167\u76ae\u80a4\u7684\u89e6\u53d1\u6761\u4ef6\u5206\u7c7b\u89e3\u5305, \u9ed8\u8ba4\u4e3awem\u97f3\u9891\u683c\u5f0f, \u4f7f\u7528 [vgmstream](https://vgmstream.org/downloads) \u53ef\u8f6c\u7801.\n\n- [index.py](lol_voice/index.py#L250)\u4e2d _extract_audio_ \u51fd\u6570\u903b\u8f91\u4ee5\u53caHIRC\u90e8\u5206\u5757\u7ed3\u6784\u548cWPK\u6587\u4ef6\u7ed3\u6784\u53c2\u8003[Morilli](https://github.com/Morilli)\u7f16\u5199\u7684\u89e3\u5305\u5de5\u5177[https://github.com/Morilli/bnk-extract](https://github.com/Morilli/bnk-extract)\n- [WAD.py](lol_voice/formats/WAD.py)\u4e2d \u6587\u4ef6\u7ed3\u6784\u4ee5\u53ca\u90e8\u5206\u903b\u8f91\u6765\u6e90\u4e8e[https://github.com/CommunityDragon/CDTB](https://github.com/CommunityDragon/CDTB) \u548c [https://github.com/Pupix/lol-file-parser](https://github.com/Pupix/lol-file-parser)\n\n\u5176\u4f59bnk\u6587\u4ef6\u7ed3\u6784\u6765\u53c2\u8003:[http://wiki.xentax.com/index.php/Wwise_SoundBank_(*.bnk)](http://wiki.xentax.com/index.php/Wwise_SoundBank_(*.bnk))\n\n\n### \u5b89\u88c5\n\n\n`pip install lol-voice`\n\n`pip install -e git+https://github.com/Virace/py-bnk-extract@package#egg=lol_voice`\n\n### \u4f7f\u7528\n\u6b64\u5305\u9002\u5408\u63d0\u53d6\u5df2\u77e5\u76ae\u80a4\u8bed\u97f3, \u5982\u9700\u5168\u90e8\u63d0\u53d6\u8bf7\u5173\u6ce8 [lol_extract_voice](https://github.com/Virace/lol_extract_voice)\n```\nfrom lol_voice import extract_audio\nfrom lol_voice.formats import WAD\n\n\ndef example():\n    \"\"\"\n    \u6309\u89e6\u53d1\u4e8b\u4ef6\u6587\u4ef6\u5939\u5206\u7c7b\u63d0\u53d6 \u5251\u9b54 \u8bed\u97f3\u6587\u4ef6\n    :return:\n    \"\"\"\n\n    # \u4e34\u65f6\u76ee\u5f55\u548c\u6700\u7ec8\u8f93\u51fa\u76ee\u5f55\n    temp_path = r'D:\\Temp'\n    out_path = r'D:\\Out'\n\n    # \u82f1\u96c4\u540d\u5b57, \u4ee5\u53ca\u5bf9\u4e8e\u9ed8\u8ba4\u76ae\u80a4\u7684\u4e09\u4e2a\u6587\u4ef6\u8def\u5f84\n    champion = 'aatrox'\n    bin_tpl = f'data/characters/{champion}/skins/skin0.bin'\n    audio_tpl = f'assets/sounds/wwise2016/vo/zh_cn/characters/aatrox/skins/base/{champion}_base_vo_audio.wpk'\n    event_tpl = f'assets/sounds/wwise2016/vo/zh_cn/characters/aatrox/skins/base/{champion}_base_vo_events.bnk'\n\n    # \u9700\u8981\u89e3\u6790\u4e24\u4e2aWAD\u6587\u4ef6, \u8fd9\u4e2a\u8def\u5f84\u4fee\u6539\u4e3a\u81ea\u5df1\u7684\u6e38\u620f\u76ee\u5f55\n    wad_file1 = r\"D:\\League of Legends\\Game\\DATA\\FINAL\\Champions\\Aatrox.wad.client\"\n    wad_file2 = r\"D:\\League of Legends\\Game\\DATA\\FINAL\\Champions\\Aatrox.zh_CN.wad.client\"\n\n    # \u5c06\u4e0a\u9762\u4e09\u4e2a\u6587\u4ef6\u63d0\u53d6\u5230\u4e34\u65f6\u76ee\u5f55\n    WAD(wad_file1).extract([bin_tpl], temp_path)\n    WAD(wad_file2).extract([audio_tpl, event_tpl], temp_path)\n\n    # \u6839\u636e\u4e09\u4e2a\u6587\u4ef6\u5bf9\u5e94\u63d0\u53d6\u8bed\u97f3\u5e76\u6574\u7406\n    extract_audio(\n        bin_file=os.path.join(temp_path, os.path.normpath(bin_tpl)),\n        event_file=os.path.join(temp_path, os.path.normpath(event_tpl)),\n        audio_file=os.path.join(temp_path, os.path.normpath(audio_tpl)),\n        out_dir=out_path\n    )\n\nif __name__ == '__main__':\n    example()\n```\n### \u95ee\u9898\n\u5f85\u89e3\u51b3\uff1a\n - ~~\u4e0d\u540c\u4e8b\u4ef6\u8c03\u7528\u76f8\u540c\u8bed\u97f3, \u5bfc\u81f4\u6587\u4ef6\u91cd\u590d~~\n - \u4e0d\u6392\u9664\u6587\u4ef6\u6709\u7f3a\u5931\u95ee\u9898, event\u6587\u4ef6\u89e3\u6790\u4e0d\u5b8c\u6574\n\n\n\n### \u7ef4\u62a4\u8005\n**Virace**\n- blog: [\u5b64\u72ec\u7684\u672a\u77e5\u6570](https://x-item.com)\n\n### \u611f\u8c22\n- [@Morilli](https://github.com/Morilli/bnk-extract), **bnk-extract**\n- [@Pupix](https://github.com/Pupix/lol-file-parser), **lol-file-parser**\n- [@CommunityDragon](https://github.com/CommunityDragon/CDTB), **CDTB** \n- [@vgmstream](https://github.com/vgmstream/vgmstream), **vgmstream**\n\n- \u4ee5\u53ca**JetBrains**\u63d0\u4f9b\u5f00\u53d1\u73af\u5883\u652f\u6301\n  \n  <a href=\"https://www.jetbrains.com/?from=kratos-pe\" target=\"_blank\"><img src=\"https://cdn.jsdelivr.net/gh/virace/kratos-pe@main/jetbrains.svg\"></a>\n\n### \u8bb8\u53ef\u8bc1\n\n[GPLv3](LICENSE)",
    "bugtrack_url": null,
    "license": "GPL-3.0-only",
    "summary": "\u901a\u8fc7\u89e3\u6790\u82f1\u96c4\u8054\u76df\u6e38\u620f\u5185WAD\u3001BNK\u3001WPK\u3001BIN\u7b49\u6587\u4ef6\u6765\u63d0\u53d6\u97f3\u9891\u6587\u4ef6\uff0c\u5e76\u53ef\u4ee5\u6309\u7167\u89e6\u53d1\u4e8b\u4ef6\u5206\u7c7b",
    "version": "1.0.4.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/Virace/py-bnk-extract/issues",
        "Homepage": "https://github.com/Virace/py-bnk-extract",
        "Repository": "https://github.com/Virace/py-bnk-extract"
    },
    "split_keywords": [
        "league",
        " wad",
        " bnk"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0024e2e7b976a3e56c72a33ec0cdc72e1ac589e0dc0a3c72fd78b336d7f75315",
                "md5": "be21047cddf4e5689fb3ef5f2752cb48",
                "sha256": "40686ce7104c1e88be29ebf0865182823e78c161669ff81ecabf6386cb93a929"
            },
            "downloads": -1,
            "filename": "lol_voice-1.0.4.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "be21047cddf4e5689fb3ef5f2752cb48",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 49620,
            "upload_time": "2024-05-04T11:42:38",
            "upload_time_iso_8601": "2024-05-04T11:42:38.650073Z",
            "url": "https://files.pythonhosted.org/packages/00/24/e2e7b976a3e56c72a33ec0cdc72e1ac589e0dc0a3c72fd78b336d7f75315/lol_voice-1.0.4.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "449e66926b95d2d702ca46f6859b9a31862c902db5946343c15aca830ae1d5fa",
                "md5": "888e7d26aff18bcef15007dc8c832b88",
                "sha256": "88b4fb7b58e9fbf18a0fcb0cb371b3926954ad8816df45ea2198d189537dd537"
            },
            "downloads": -1,
            "filename": "lol_voice-1.0.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "888e7d26aff18bcef15007dc8c832b88",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 30381,
            "upload_time": "2024-05-04T11:42:40",
            "upload_time_iso_8601": "2024-05-04T11:42:40.805154Z",
            "url": "https://files.pythonhosted.org/packages/44/9e/66926b95d2d702ca46f6859b9a31862c902db5946343c15aca830ae1d5fa/lol_voice-1.0.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-04 11:42:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Virace",
    "github_project": "py-bnk-extract",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "xxhash",
            "specs": [
                [
                    "==",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "zstd",
            "specs": [
                [
                    "==",
                    "1.4.8.1"
                ]
            ]
        }
    ],
    "lcname": "lol-voice"
}
        
Elapsed time: 0.54693s