Reverse engineering of loop points in VAGs !
Posted: October 21st, 2015, 7:00 am
Hi !
Wanted to share this with you as I've discovered it
Detection of loop points in VAGs that continuously plays (aka sampler loop)
Using the code from bitMaster floating around on the web,
Note 1 : one should early exit the function by watching input stream position, instead of relying on flag no. 7 (many times this don't seem to be sufficient).
Note 2 : the end point of a loop region will be always at EOF, i.e. everything beyond is discarded, i.e. if your input WAV was 5 sec long and loop was between 1sec and 2sec, the output VAG will be 2 sec. (this is for people converting WAV/AIFF to VAG, wondering why they suddenly end being shorter than the source)
Btw it also seems to work for lower-level format .VH/.VB combo.
Thanks for the docs btw as they've been quite helpful
Wanted to share this with you as I've discovered it

Detection of loop points in VAGs that continuously plays (aka sampler loop)
Using the code from bitMaster floating around on the web,
- watch for flag no. 6, right before where it watches for no. 7 (EOF)
- then will be the sample value where the loop begins !
Code: Select all
(value - 56)/2 // value is the current position in bytes of the output stream being generated
Note 1 : one should early exit the function by watching input stream position, instead of relying on flag no. 7 (many times this don't seem to be sufficient).
Note 2 : the end point of a loop region will be always at EOF, i.e. everything beyond is discarded, i.e. if your input WAV was 5 sec long and loop was between 1sec and 2sec, the output VAG will be 2 sec. (this is for people converting WAV/AIFF to VAG, wondering why they suddenly end being shorter than the source)
Btw it also seems to work for lower-level format .VH/.VB combo.
Thanks for the docs btw as they've been quite helpful
