Open Developer-exe opened 3 years ago
Try repacking the audio stream. I think you might be able to do that by "converting" the BCSAR to another BCSAR. If not, convert to something like BCSTM and back. If that doesn't work it's most likely an issue with how the BCSAR container is packed
I'm sorry for making a mistake, the file in question is BCSTM, not BCSAR (I'll fix the comments as well as the title).
I've tried the following:
After testing all the files, the only one that plays is the original one. More than half of the files' information that differs seems to be unique, but they have two parameters that match for those files that don't work:
0x250
, all the other reencoded ones: 0x24A
)2051084
, all the other reencoded ones: 2051072
)Also, the sample count from data size in those reencoded files match the file's sample count as well as the loop end (the loop ends at the very end of the file).
The original file:
Last interleave size without padding: 0x250
All the other reencoded files:
Last interleave size without padding: 0x24A
So I've decided to recreate both working and non-working scenarios so that you could reproduce them as well to see the difference. To avoid any copyright infringement, I'll be using a royalty-free audio file.
These are the exact steps to creating both files:
ffmpeg -i "The Cannery.mp3" -ar 22050 "cannery.mp3"
<-- Set the sample rate to 22050 Hzffmpeg -i "cannery.mp3" -af atrim=start_sample=118262:end_sample=361122 "cannery2.mp3"
<-- Shorten the fileVGAudioCli.exe -i "cannery2.bcstm" -o "cannery2_vg.bcstm" --no-loop
More details are available below (both files were exported without the loop - it's not a problem):
I would be glad if this helped you with solving the problem.
The BCSTM files created using the VGAudio library work fine when decoded on a computer, but fail to play on a 3DS, specifically when applied as a background theme in the HOME menu. I've tried comparing the file information of two BCSTM files, which had everything in common but the library that was used to encode the file. The results can be seen below:
Original
``` Sample count: 2051072 (94,0083 seconds) Sample rate: 21818 Hz Channel count: 2 Encoding format: GameCube "DSP" 4-bit ADPCM Loop start: 157696 samples (7,2278 seconds) Loop end: 2051072 samples (94,0083 seconds) Interleave Count: 144 Interleave Size: 0x2000 Samples per interleave: 14336 Last interleave size without padding: 0x250 Last interleave size: 0x260 Samples in last interleave block: 1024 Sample count from data size: 2051084 Samples per seek table entry: 14336 Track 0 ------------------------- Channel Count: 2 Left channel ID: 0 Right channel ID: 1 Volume: 0x7F Panning: 0x40 Channel 0 ---------------------------------------- Coefficients: [0]: 0x0390, 0xFE4F [1]: 0x0A1C, 0xFB2E [2]: 0x0606, 0xFF7D [3]: 0x0989, 0xFDC3 [4]: 0x0746, 0xFC4A [5]: 0x0BA7, 0xFB2E [6]: 0x071F, 0xFFD3 Gain: 0x0000 Pred/Scale: 0x0000 History sample 1 (n-1): 0x0000 History sample 2 (n-2): 0x0000 Loop Pred/Scale: 0x0000 Loop History sample 1: 0x0069 Loop History sample 2: 0x0069 Channel 1 ---------------------------------------- Coefficients: [0]: 0x0179, 0xFF5C [1]: 0x08C5, 0xFBC8 [2]: 0x045A, 0x0160 [3]: 0x0991, 0xFD7E [4]: 0x054B, 0xFE04 [5]: 0x0AFB, 0xFB56 [6]: 0x0672, 0x00B3 Gain: 0x0000 Pred/Scale: 0x0000 History sample 1 (n-1): 0x0000 History sample 2 (n-2): 0x0000 Loop Pred/Scale: 0x0000 Loop History sample 1: 0x003A Loop History sample 2: 0x003A ```Re-encoded (VGAudio)
``` Sample count: 2051072 (94,0083 seconds) Sample rate: 21818 Hz Channel count: 2 Encoding format: GameCube "DSP" 4-bit ADPCM Loop start: 157696 samples (7,2278 seconds) Loop end: 2051072 samples (94,0083 seconds) Interleave Count: 144 Interleave Size: 0x2000 Samples per interleave: 14336 Last interleave size without padding: 0x24A Last interleave size: 0x260 Samples in last interleave block: 1024 Sample count from data size: 2051072 Samples per seek table entry: 14336 Track 0 ------------------------- Channel Count: 2 Left channel ID: 0 Right channel ID: 1 Volume: 0x7F Panning: 0x40 Channel 0 ---------------------------------------- Coefficients: [0]: 0x0388, 0xFE58 [1]: 0x0A1C, 0xFB2F [2]: 0x060C, 0xFF72 [3]: 0x097F, 0xFDCC [4]: 0x0745, 0xFC45 [5]: 0x0BA2, 0xFB35 [6]: 0x0713, 0xFFDC Gain: 0x0000 Pred/Scale: 0x0000 History sample 1 (n-1): 0x0000 History sample 2 (n-2): 0x0000 Loop Pred/Scale: 0x0069 Loop History sample 1: 0xF0EF Loop History sample 2: 0xF0EF Channel 1 ---------------------------------------- Coefficients: [0]: 0x0177, 0xFF5F [1]: 0x08C2, 0xFBCB [2]: 0x045C, 0x015B [3]: 0x0987, 0xFD87 [4]: 0x054C, 0xFE00 [5]: 0x0AF9, 0xFB5C [6]: 0x066C, 0x00B8 Gain: 0x0000 Pred/Scale: 0x0000 History sample 1 (n-1): 0x0000 History sample 2 (n-2): 0x0000 Loop Pred/Scale: 0x003A Loop History sample 1: 0xF2DE Loop History sample 2: 0xF2DE ```There seems to be a difference in offsets for the following:
0x250
vs0x24A
)2051084
vs2051072
)Other than that, the files seem to be identical.
May I ask if a fix is possible? I can provide more information or samples if needed. Also, thank you for the previous fix you've made! Many thanks in advance.