5 unstable releases

0.3.0 Aug 19, 2023
0.2.2 Aug 4, 2023
0.2.0 Jul 12, 2023
0.1.0 Jul 9, 2023
0.0.0 Jun 10, 2023

#1153 in Parser implementations

Download history 21/week @ 2024-07-26 2/week @ 2024-08-02 8/week @ 2024-09-20 2/week @ 2024-09-27

63 downloads per month

MIT/Apache

3.5MB
22K SLoC

fsbex

Crates.io Docs.rs License

fsbex is a library for extracting audio from FMOD sound banks. Only FSB version 5 is supported for now.

Example

Parsing a sound bank, then writing streams to files:

use fsbex::{Bank, AudioFormat};
use std::{
    error::Error,
    io::{BufReader, BufWriter},
    fs::File,
};

fn main() -> Result<(), Box<dyn Error>> {
    // open file for reading sound bank
    let file = BufReader::new(File::open("example.fsb")?);
    let bank = Bank::new(file)?;

    // report number of streams contained within the sound bank
    println!("{} streams within this sound bank", bank.num_streams());

    // check stream audio format
    if bank.format() != AudioFormat::Vorbis {
        return Err("expected Vorbis format".into());
    }

    // iterate over streams
    for (index, stream) in bank.into_iter().enumerate() {
        // check stream name
        let file_name = if let Some(name) = stream.name() {
            format!("{name}.ogg")
        } else {
            format!("stream_{index}.ogg")
        };

        // write stream data to file
        let output_file = BufWriter::new(File::create(file_name)?);
        stream.write(output_file)?;
    }

    Ok(())
}

Supported formats

fsbex supports encoding stream data for the following formats:

  • PCM (8, 16, 24, 32-bit integer)
  • PCM (32-bit float)
  • Vorbis

Acknowledgements

fsbex would not be possible without these projects:

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~4–12MB
~142K SLoC