Skip to content
qirashiPublic

About

C++20 library for parsing, inspecting, and editing Wwise sound banks (.bnk) and packages (.pck).

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

wwiserlib

English | Русский

A C++20 library for Wwise SoundBanks (.bnk) and file packages (.pck). No dependencies beyond the standard library.

  • Parses a bank into a tree of every field: name, type, offset, size, value.
  • Dumps banks to XML in the wwiser -d xml format.
  • Resolves names from companion files: SoundbanksInfo.xml/.json, <bank>.xml/.json/.txt, Wwise_IDs.h, wwnames.txt, wwnames.db3.
  • Links objects: event → actions → containers → sounds → .wem.
  • Writes the tree back to a byte-identical .bnk, recomputing sizes.
  • Edits banks: field values, properties, adding, copying and removing HIRC objects, list items and .wem files, music lengths for a new .wem.
  • Reads, extracts and writes .pck: replacing, adding and removing banks and .wem files. Large packages are read from disk on demand.
  • Finds banks and events through SoundbanksInfo without parsing the banks.

Bank versions from v26 (Wwise 2007) to v172 (Wwise 2025.1). Checked on real games: v135 (World of Tanks Blitz) and v150 (World of Tanks); other versions are ported from wwiser's code.

Building

Requires CMake 3.25+ and a C++20 compiler with std::format; the gcc presets also need Ninja. Checked with GCC (MinGW) and MSVC (Visual Studio 2026) on Windows.

build.cmd (Windows) or build.sh builds a GCC Release and installs a clean copy into build/release/:

build/release/LICENSE                 MIT license
build/release/include/wwiser/*.h      headers
build/release/lib/libwwiser.a         library
build/release/lib/cmake/wwiser/       for find_package(wwiser)
build/release/bin/wwiser-dump.exe     XML dump of banks
build/release/bin/wwiser-pck.exe      .pck listing and extraction

test.cmd or test.sh builds the same with the tests and runs them; arguments go to ctest (test.cmd -R package). By hand, use the gcc, gcc-release and msvc presets:

cmake --preset gcc-release
cmake --build --preset gcc-release
ctest --preset gcc-release

Tests build with GCC only and fetch Catch2 through FetchContent. Game banks aren't in the repository: tests that need them look in testdata/ and are skipped when it is empty. libwwiser.a works with GCC (MinGW) only; with another compiler, add the sources with add_subdirectory.

Usage

add_subdirectory(external/wwiserlib)
# or: find_package(wwiser REQUIRED) with -DCMAKE_PREFIX_PATH=<path>/build/release
target_link_libraries(app PRIVATE wwiser::wwiser)
#include <wwiser/wwiser.h>

auto bank = wwiser::parse_bank_file("Init.bnk");
for (const auto& chunk : bank->children()) {
    // chunk->name(), chunk->attributes(), chunk->children() ...
}

Names and links:

wwiser::Parser parser;
parser.parse_banks(files);
const auto banks = parser.banks();

auto names = std::make_shared<wwiser::Names>();
names->load_for_banks(banks);         // SoundbanksInfo, wwnames.txt... next to the banks
names->load_database("wwnames.db3");  // optional shared names database
parser.set_names(names);

// big games: the report's .json instead of .xml (twice as fast), JSON strings unescaped
auto fast = std::make_shared<wwiser::Names>();
fast->set_unescape_json(true);
fast->load_for_banks(banks, {}, {.json_over_xml = true});

const wwiser::Hierarchy hierarchy(banks);
for (const wwiser::Object* event : hierarchy.events()) {
    for (const wwiser::MediaRef& ref : hierarchy.media(*event)) {
        if (const auto wem = hierarchy.find_media(ref.source_id)) {
            // wem->bytes(): the .wem from DATA
        }
    }
}

Editing and writing:

auto bank = wwiser::parse_bank_file("ambient.bnk");

// replacing a .wem: DATA is rebuilt with the bank's alignment, DIDX and uInMemoryMediaSize are updated
wwiser::replace_media(*bank, wem_id, new_wem_bytes);

// a field of a HIRC object
wwiser::Object* sound = wwiser::find_hirc_object(*bank, sound_id);
wwiser::find_field(*sound, "DirectParentID")->set_value(std::int64_t{parent_id});

// a copy of the sound with a new id before its container (Wwise writes children before parents)
wwiser::Object* container = wwiser::find_hirc_object(*bank, container_id);
wwiser::insert_hirc_object(*bank, wwiser::copy_hirc_object(*sound, new_id), container);
wwiser::add_child(*container, new_id);
wwiser::add_media(*bank, new_wem_id, wem_bytes);
wwiser::remove_hirc_object(*bank, old_id);

bank = wwiser::rebuild(*bank);  // added data shows up in the tree
wwiser::write_bank_file(*bank, "ambient_mod.bnk");  // chunk and object sizes are recomputed

set_value checks that the value fits the field type. Counters (NumReleasableHircItem, ulNumChilds, cProps, list counts) are updated at once, sizes on write. drop_references clears references to a removed object. Other lists have insert_item and remove_item.

Packages:

auto package = wwiser::Package::open("music.pck");  // only the header is kept in memory
for (const wwiser::PackageEntry& entry : package.entries()) {
    // entry.table (Banks / Sounds / Externals), entry.id, entry.language_id, package.bytes(entry)
}
package.extract("out");  // out/<id>.bnk, out/<language>/<id>.wem
package.replace(wwiser::PackageTable::Banks, bank_id, wwiser::write_bank(*bank));
package.add(wwiser::PackageTable::Sounds, new_wem_id, new_wem_bytes);  // language 0 (sfx)
package.remove(wwiser::PackageTable::Sounds, old_wem_id);
package.save("music.pck");  // over itself too, through a temporary file

Banks and events from SoundbanksInfo, to find which bank to open:

for (const wwiser::InfoBank& bank : wwiser::read_info_banks("SoundbanksInfo.json")) {  // or .xml
    // bank.name, bank.path, bank.language, bank.events[i].id / .name
}

Tools

  • wwiser-dump [-o out.xml] [-nl wwnames.txt] [-nd wwnames.db3] <bank>... dumps banks to XML. Name files are taken from next to the banks; wwnames.txt and wwnames.db3 also from the working and program folders.
  • wwiser-pck [-o dir] <package.pck>... lists packages; with -o it extracts them into dir/<package name>/.

Origin and license

wwiserlib is a C++ port, with fixes, of the wwiser parser by bnnm, commit 6d4b5bf (2026-11-04). The bank format research is wwiser's. Field and object names are kept, so dumps match wwiser's. Differences:

  • since v146, RTPC and state parameter ids are AkPropIDs (wwiser uses the v135 table there, shifting every id);
  • SoundbanksInfo.json is read object by object rather than line by line, so bank and event names don't mix up;
  • everything beyond parsing, dumps and names is new: links, writing, editing, .pck.

wwiserlib's code is released under the MIT license. wwiser has no license; its rights belong to its author. If the author of wwiser objects to this port, please reach out through the issues.

About

C++20 library for parsing, inspecting, and editing Wwise sound banks (.bnk) and packages (.pck).

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages