[Release] Ao no Kiseki (PC) - Evolution OST Mod (with working loops)

moonblood666

Well-Known Member
OP
Member
Joined
Feb 24, 2014
Messages
484
Trophies
0
Age
39
XP
1,693
Country
Gambia, The
This is basically the full OST with loops working correctly. The problem with the Crossbell PC versions is that the loop codes (unlike the Trails in the Sky STEAM releases) don't store their loops in the ogg fileheaders themselves but externally in the t_bgm._dt file in the ../data/text/ folder. Simply replacing this file with the one provided and of course the ../data/bgm/ folder will make it work flawlessly. Before anyone asks: I didn't set the loops myself but I've had an older release of the game on one of my external HDDs which for some reason had the working/looping Evo OST. The only thing I did was to locate the file which contains the loops.

Theoretically this can also be done with Zero no Kiseki, but it requires to modify its t_bgm._dt and set the loops manually. It would be cool if there were a method to not only convert the Vita version's AT9 files but also read their loop codes. But sadly the latter is not possible yet (at least from my knowledge). So manually setting the loops for 100+ files seems to be the only possible way to make a Zero Evo mod as far as I know.

As for the Ao Evo OST itself: Unlike Zero Evo and Sora SC/3rd Evo this one has been done entirely by Yukihiro Jindo and Toshiharu Okajima without other arrangers, leading to a very faithful and consistent OST.

Original OST:



Evo OST:



Edit: due to copyright reasons and concerns I have deleted the complete OST mod pack. Instead I've uploaded just the file (t_bgm._dt) that houses the loop information. You have to copy/replace this file into the ../data/text/ folder. Of course you still need to either get the soundtrack files from somewhere else or convert the AT9 files from your Ao no Kiseki Evolution copy. I won't provide those.

Edit 2: Since some people asked, here a detailed How To on converting the Evo version OST into OGG files:

Prerequisites: Maidump version of Ao no Kiseki Evolution

Tools you need:

- Total Commander + the PSARC Plugin: https://totalcmd.net/plugring/PSARC.html (to unpack the PSARC files found in the Maidump to get the AT9 files)

- AT9 Tool: https://amicitiamods.jcink.net/index.php?showtopic=29

or this version

https://wololo.net/talk/viewtopic.php?t=44525

- WAV to OGG Converter: https://github.com/jcsnider/Batch-Wav-To-Ogg-Converter


Steps:

1. Get the Maidump and extract the PSARC file with Total Commander (it should be the data.psarc )

2. Create a folder and put the AT9Tool.exe as well as the AT9 files in this directory

3. Write a batch file (name it convert.bat or whatever), it belongs in the same directory as the AT9Tool and the AT9 files

Following code for the batch file:

Code:
@Echo off

mkdir wav_out

for %%f in (*.at9) do (
   at9tool -d "%%f" "wav_out\%%~nf.wav"
)

What it does: it creates a new directory, loops through the AT9 files and writes the WAVs into the wav_out directory

4. Convert the WAVs into OGGs with the Batch-Wav-To-Ogg-Converter

5. Paste the OGG files into the ../data/bgm/ game directory

6. Paste the "t_bgm._dt" I've provided into the ../data/text/ game directory
 

Attachments

  • AO_EVO_OST.rar
    1.3 KB · Views: 606
Last edited by moonblood666,

moonblood666

Well-Known Member
OP
Member
Joined
Feb 24, 2014
Messages
484
Trophies
0
Age
39
XP
1,693
Country
Gambia, The
I've deleted the files due to copyright concerns. I've reuploaded the t_bgm._dt file that contains the loops but you still need to get or convert the Evo soundtrack files yourself. There are many tutorials on how to convert the Vita version's AT9 files. Just make sure that the format you convert to is .ogg.
 

GuyBannings

New Member
Newbie
Joined
Mar 22, 2020
Messages
3
Trophies
0
Age
38
XP
45
Country
Bahrain
Thank you!

I've tried using the t_bgm._dt with different versions of the OST (a PC version I found, and also tried converting the vita at9 to ogg), and have been able to come close to perfect, but still some timing issues in some tracks.

I'm curious to try your t_bgm._dt. Did you manually modify it, or is it the vita one? Do you know of a tool you can use to edit it?

Thanks :)
 

moonblood666

Well-Known Member
OP
Member
Joined
Feb 24, 2014
Messages
484
Trophies
0
Age
39
XP
1,693
Country
Gambia, The
Thank you!

I've tried using the t_bgm._dt with different versions of the OST (a PC version I found, and also tried converting the vita at9 to ogg), and have been able to come close to perfect, but still some timing issues in some tracks.

I'm curious to try your t_bgm._dt. Did you manually modify it, or is it the vita one? Do you know of a tool you can use to edit it?

Thanks :)

No, I did not modify the file myself. For some reason I've downloaded a version of Ao years ago which had the Evo OST with working loops and had it still on one of my external HDDs. It was a mere coincidence. I've tried to modify the file with a hex editor, but had no success. It might be encrypted, who knows. Even the Geofront team did not touch the file for their Zero modifications to make the Evo OST loop correctly. The loops are stored (hooked?) externally in a mod file (music.json) when you install the Geofront patch, they didn't touch the t_bgm._dt either.

Edit: the t_bgm._dt I've provided here is pretty much flawless. Played through the entire game last year and there were only 1 or 2 tracks where I slightly noticed when another loop started.
 
Last edited by moonblood666,

Pomax

New Member
Newbie
Joined
Jun 15, 2020
Messages
2
Trophies
0
Age
123
XP
52
Country
Canada
Just created an account explicitly to reply here: the t_bgm._dt format is pretty straight forward, but it's in a bit of a silly byte ordering. Every row is 16 bytes, with multi-byte values stored in Least Significant Byte First ordering. Each entry is a 16 byte row AAAABBBBCCCCXXYY where:

- AAAA is the four byte loop start, as sample number (rather than a time value) from the start of the audio file.
- BBBB is the four byte loop length, expressed as number of samples
- CCCC is the bgm filename's id
- XX is the track's shortcode (e.g. if the file is ed7150.ogg, the shortcode is 150)
- YY looping flag: 0=no loop, 1=loop

(Note that sample number is based on the audio sampling rate: the original files are sampled at 44100 samples per second, so a 1 minute track consists of 60 * 48000 = 2646000 samples)

Let's look at a concrete example: looking at the Crossbell City music, which is bgm file "ed7150.ogg", we see:

- id = 7150, so in hex that's 1BEE. We need that as a four byte hex value, so with leading zeroes that's [00 00 1B EE], but because t_bgm._dt uses Least Significant Byte First ordering, that turns into the actual byte sequence [EE 1B 00 00]. If we search the t_bgm._dt file for that value with a hex editor (like xvi32, or VS Code's most excellent "HexEditor" addon), we find the full 16 byte entry for this background track at hex position 270:

|__A__A__A__A_|__B__B__B__B_|__C__C__C__C_|__X__X_|__Y__Y_|
| 74 8F 07 00 | 98 64 47 00 | EE 1B 00 00 | 96 00 | 01 00 |


So, we know that:

- AAAA is 74 8F 07 00, which is 78F74 in normal hex ordering, which is decimal 495476: this track has its loop start at sample 495476 (which is around 0m 11s 235ms)
- BBBB is 98 64 47 00, which is 476498 in normal hex ordering, which is decimal 4678808: this track will loop once it hits sample 495476 + 4678808 = 5174284 (which is around 1m 57s)
- CCCC we already knew was EE 1B 00 00 for 1BEE in hex, or 7150 in decimal
- XX is 96 00 and looks like it's a two byte ordering number, followed by
- YY is 01 00 and appears to indicate that this is a looping track (we see [00 00] for tracks that never loop, like the intro animation track, and those track have [00 00 00 00] as loop start and end)

We can verify that these values are indeed what we're looking for by loading up the original ed7150.ogg in an audio editor and playing a loop region set to those start and end samples: it loops perfectly.

Updating this file so that the background loops work for the OST versions of each track is mostly a matter of figuring out the best loop interval, writing down the sample numbers for the loop start and end, and then updating t_bgm._dt accordingly. For my copy of the OST version of the Crossbell City theme, for example, the oggs use 48000 samples per second, and the track loop points are at samples 480199 (~0m10) and 5520176 (~1m55) for start and end respectively, which means the loop length is 5520176 - 480199 = 5039977. In hex, those start and length values are 753C7 and 4CE769, so in LSB ordering those are [C7 53 07 00] and [69 E7 4C 00] - so the new full entry would be:

|__A__A__A__A_|__B__B__B__B_|__C__C__C__C_|__X__X_|__Y__Y_|
| C7 53 07 00 ‭| 69 E7 4C 00 | EE 1B 00 00 | 96 00 | 01 00 |


There's 112 tracks, so it'd be a bit of manual work, especially since most OST songs are "doubled", so the loop start is fairly close to the start, but the loop end is about midway through, rather than at the end of the track. Although the benefit of duplication is that it's pretty easy to find a good interval in an audio editor that shows spectograms rather than (just) waveform; spotting repeated sections is super easy when you're looking at a spectrogram. Once you have those values, it's just a matter of copying the numbers by hand, or you could even automate it by putting the start/end/id triples into a file and then writing a node/php/perl/whatever script tho generates a new t_bgm._dt using the new, correct values and the old file to preserve line ordering and those xxxx values.
 
Last edited by Pomax,

Pomax

New Member
Newbie
Joined
Jun 15, 2020
Messages
2
Trophies
0
Age
123
XP
52
Country
Canada
Since I'm writing one anyway, I set up a github repo for the code that I use to generate my own t_bgm._dt, over on github,com, pomax/ao-no-background-music, which has all the instructions on how to use it as well as the most up to date t_bgm._dt

I've retimed all tracks since posting my original analysis, so if you just want to try your luck you can download mine and see if that works better for you.
 

Attachments

  • t_bgm.zip
    1.3 KB · Views: 371
Last edited by Pomax,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • Julie_Pilgrim @ Julie_Pilgrim:
    the internet
  • Julie_Pilgrim @ Julie_Pilgrim:
    @Psionic Roshambo i have 16 gb in my pc and i run into issues with ram more than i'd like to admit
  • HiradeGirl @ HiradeGirl:
    I got only 8GB of RAM. But I want 32GB.
  • Sonic Angel Knight @ Sonic Angel Knight:
    Time to just download more ram
  • K3Nv2 @ K3Nv2:
    Yeah search Google
  • Sonic Angel Knight @ Sonic Angel Knight:
    Or, I also heard that if you use flash memory, it can act as more "RAM" at least windows tell me when I stick a flash drive into it.
  • Veho @ Veho:
    It can act as a swap drive but that isn't more RAM, it's slooow.
  • K3Nv2 @ K3Nv2:
    I wish we could have 1Gbps external storage by now
  • K3Nv2 @ K3Nv2:
    Like for micro
  • Veho @ Veho:
    New Myoo.
  • SylverReZ @ SylverReZ:
    @Veho, Yooo noice
  • SylverReZ @ SylverReZ:
    Looks like a Famicom handheld
  • Veho @ Veho:
    Yeah, they were going for that.
  • Veho @ Veho:
    It's not very good though.
  • Veho @ Veho:
    I'm watching the review, the emulators it uses suck bawls.
  • Veho @ Veho:
    Software update might improve it.
  • Psionic Roshambo @ Psionic Roshambo:
    Or maybe someone will make like Emulation Station for it or something?
  • Veho @ Veho:
    That counts as a software update :tpi:
    +1
  • OctoAori20 @ OctoAori20:
    Ello
  • K3Nv2 @ K3Nv2:
    I can think of the design teams process another joystick and no audio or a joystick and mono audio
  • Veho @ Veho:
    "You think we can just put the speakers at the top
    ?" "NO!"
    +1
  • K3Nv2 @ K3Nv2:
    Pft stereo speakers you're fired
    +1
    K3Nv2 @ K3Nv2: Pft stereo speakers you're fired +1