{"id":18928135,"url":"https://github.com/hearthsim/python-fsb5","last_synced_at":"2025-08-21T20:32:26.057Z","repository":{"id":45267539,"uuid":"49449905","full_name":"HearthSim/python-fsb5","owner":"HearthSim","description":"Library and tool to extract audio from FSB5 (FMOD Sample Bank) files","archived":false,"fork":false,"pushed_at":"2021-12-26T17:50:26.000Z","size":460,"stargazers_count":139,"open_issues_count":15,"forks_count":40,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-28T07:21:15.730Z","etag":null,"topics":["audio","fmod-sample-bank","fsb","python"],"latest_commit_sha":null,"homepage":"https://hearthsim.info","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HearthSim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-11T19:45:05.000Z","updated_at":"2024-11-23T10:28:31.000Z","dependencies_parsed_at":"2022-09-17T03:50:30.461Z","dependency_job_id":null,"html_url":"https://github.com/HearthSim/python-fsb5","commit_stats":null,"previous_names":["synap5e/python-fsb5"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HearthSim%2Fpython-fsb5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HearthSim%2Fpython-fsb5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HearthSim%2Fpython-fsb5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HearthSim%2Fpython-fsb5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HearthSim","download_url":"https://codeload.github.com/HearthSim/python-fsb5/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230532448,"owners_count":18240792,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","fmod-sample-bank","fsb","python"],"created_at":"2024-11-08T11:23:05.907Z","updated_at":"2024-12-20T04:07:36.628Z","avatar_url":"https://github.com/HearthSim.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# python-fsb5\nPython library and tool to extract FSB5 (FMOD Sample Bank) files.\n\n### Supported formats\n\n- MPEG\n- Vorbis (OGG)\n- WAVE (PCM8, PCM16, PCM32)\n\nOther formats can be identified but will be extracted as `.dat` files and may not play as the headers may be missing.\n\n## Tool Usage\n\n```\nusage: extract.py [-h] [-o OUTPUT_DIRECTORY] [-p] [-q]\n                  [fsb_file [fsb_file ...]]\n\nExtract audio samples from FSB5 files\n\npositional arguments:\n  fsb_file              FSB5 container to extract audio from (defaults to\n                        stdin)\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -o OUTPUT_DIRECTORY, --output-directory OUTPUT_DIRECTORY\n                        output directory to write extracted samples into\n  -q, --quiet           suppress output of header and sample information\n                        (samples that failed to decode will still be printed)\n ```\n\n#### Resource files\nUnity3D packs multiple FSB5 files each containing a single sample into it's `.resource` files.\npython-fsb5 will automatically extract all samples if multiple FSB5s are found within one file.\nOutput files will be prefixed with the (0 based) index of their FSB container within the resource file e.g. `out/sounds-15-track1.wav` is the path for a WAVE sample named track1 which is contained within the 16th FSB file within sounds.resource.\n\n#### Unnamed samples\nFSB5 does not require samples to store a name. If samples are stored without a name they will use their index within the FSB e.g. `sounds-0000.mp3` is the first sample in sounds.fsb.\n\n## Requirements\n\npython-fsb5 should work with python3 from version 3.2 and up.\n\n`libogg` and `libvorbis` are required to decode ogg samples. For linux simply install from your package manager. For windows ensure the dlls are avaliable (ie. in System32 or the directory you are running the script from). Known working dlls are avaliable as part of the [release](https://github.com/HearthSim/python-fsb5/releases/tag/b7bf605).\n\nIf ogg files are not required to be decoded then the libraries are not required.\n\n## Library usage\n\n```python\nimport fsb5\n\n# read the file into a FSB5 object\nwith open('sample.fsb', 'rb') as f:\n  fsb = fsb5.FSB5(f.read())\n\nprint(fsb.header)\n\n# get the extension of samples based off the sound format specified in the header\next = fsb.get_sample_extension()\n\n# iterate over samples\nfor sample in fsb.samples:\n  # print sample properties\n  print('''\\t{sample.name}.{extension}:\n  Frequency: {sample.frequency}\n  Channels: {sample.channels}\n  Samples: {sample.samples}'''.format(sample=sample, extension=ext))\n\n  # rebuild the sample and save\n  with open('{0}.{1}'.format(sample.name, ext), 'wb') as f:\n    rebuilt_sample = fsb.rebuild_sample(sample)\n    f.write(rebuilt_sample)\n```\n\n#### Useful header properties\n\n- `numSamples`: The number of samples contained in the file\n- `mode`: The audio format of all samples. Can be one of:\n * `fsb5.SoundFormat.NONE`\n * `fsb5.SoundFormat.PCM8`\n * `fsb5.SoundFormat.PCM16`\n * `fsb5.SoundFormat.PCM24`\n * `fsb5.SoundFormat.PCM32`\n * `fsb5.SoundFormat.PCMFLOAT`\n * `fsb5.SoundFormat.GCADPCM`\n * `fsb5.SoundFormat.IMAADPCM`\n * `fsb5.SoundFormat.VAG`\n * `fsb5.SoundFormat.HEVAG`\n * `fsb5.SoundFormat.XMA`\n * `fsb5.SoundFormat.MPEG`\n * `fsb5.SoundFormat.CELT`\n * `fsb5.SoundFormat.AT9`\n * `fsb5.SoundFormat.XWMA`\n * `fsb5.SoundFormat.VORBIS`\n\n\n#### Useful sample properties\n\n- `name` : The name of the sample, or a 4 digit number if names are not provided.\n- `frequency` : The sample rate of the audio\n- `channels` : The number of channels of audio (either 1 or 2)\n- `samples` : The number of samples in the audio\n- `metadata` : A dictionary of `fsb5.MetadataChunkType` to tuple (sometimes namedtuple) or bytes.\n\nAll contents of sample.metadata is optional and often not provided. Several metadata types seem to override sample properties.\n\nSupported `fsb5.MetadataChunkType`s are:\n * `CHANNELS`: A 1-tuple containing the number of channels\n * `FREQUENCY`: A 1-tuple containing the sample rate\n * `LOOP`: A 2-tuple of the loop start and end\n * `XMASEEK`: Raw bytes\n * `DSPCOEFF`: Raw bytes\n * `XWMADATA`: Raw bytes\n * `VORBISDATA`: A named tuple with properties `crc32` (int) and `unknown` (bytes)\n\nIf a metadata chunk is unrecognized it will be included in the dictionary as an interger mapping to a bytes.\n\n#### Rebuilding samples\n\nSamples also have the `data` property.\nThis contains the raw, unprocessed audio data for that sample from the FSB file.\nTo reconstruct a playable version of the audio use `rebuild_sample` on the FSB5 object passing the sample desired to be rebuilt.\n\n\n## License\n\npython-fsb5 is licensed under the terms of the MIT license.\nThe full text of the license is available in the LICENSE file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhearthsim%2Fpython-fsb5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhearthsim%2Fpython-fsb5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhearthsim%2Fpython-fsb5/lists"}