"Expected 1 channels in audio block, got 2" when encoding a sample #24
-
so I'm working on this game installer (fallout 3 :)) and I need to resample ogg files. as you can see I'm using https://github.com/pdeljanov/Symphonia to decode the original audio and I'm trying to then push the samples into the writer. here's a log from the application
this happens when I run it with following parameters RUST_LOG=debug cargo run --package hoola-audio --release -- resample-ogg /tmp/file_example_OOG_1MG.ogg /tmp/reencoded-ogg.ogg --target-frequency 48000 I'm almost certain I'm misusing it so maybe someone could take a look at my code please? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
all right, I've figured it out - I need to split channels into separate audio blocks |
Beta Was this translation helpful? Give feedback.
-
here's working code example for future reference https://github.com/Niedzwiedzw/hoolamike/blob/feature/tale-of-two-wastelands-installer/crates/hoola-audio/src/main.rs |
Beta Was this translation helpful? Give feedback.
-
I'm happy to hear you've figured out a solution to your problem! As you may have already noticed, For instance, |
Beta Was this translation helpful? Give feedback.
I'm happy to hear you've figured out a solution to your problem!
As you may have already noticed,
vorbis_rs
, like the C APIs it wraps and as stated in its documentation, expects audio sample blocks to be provided in planar format, which means the samples are structured as an array of arrays: the outer array represents the channels, and each inner array contains the consecutive samples for a channel.For instance,
[[a, b, c], [d, e, f]]
would be a representation of a planar audio sample buffer for two channels, where the first channel would have samples[a, b, c]
, and the second channel samples[d, e, f]
.