Page 1 of 1

Reverse engineering of loop points in VAGs !

Posted: October 21st, 2015, 7:00 am
by aybe
Hi !

Wanted to share this with you as I've discovered it :mrgreen:

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

    Code: Select all

    (value - 56)/2 // value is the current position in bytes of the output stream being generated
    will be the sample value where the loop begins !
Basically we can now extract VAGs with their loop points preserved !!!

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 :clap