get file_size asize math vs_offset = 0 math vlt = 1 math clt = 2 math channels = 0 math str = 0 math vs = 0 math svs = 0 math vsf = 0 for i = 0 < vlt for j = 0 < clt goto vs_offset for k = 0 < 4 get id_byte byte putarray 1 k id_byte next k getarray char_01 1 0 getarray char_02 1 1 getarray char_03 1 2 getarray char_04 1 3 if char_01 == 0x53 if char_02 == 0x54 if char_03 == 0x52 print " blocked(a header is provided every 2048 bytes that contains relevant info regarding that byte) STREAM format " if i = 0 if char_04 == 0x4c print " left-channel block " math channels + 1 endif if char_04 == 0x4d print " mono-channel block " math channels + 1 endif if char_04 == 0x52 print " right-channel block " math channels + 1 endif endif math str = 1 endif endif endif if char_01 == 0x56 if char_02 == 0x53 if char_03 == 0x00 if char_04 == 0x00 print " blocked(a header is provided every 2048 bytes that contains relevant info regarding that byte) VAG-STREAM format " math vs = 1 endif endif endif endif if char_01 == 0x53 if char_02 == 0x56 if char_03 == 0x53 if char_04 == 0x00 print " normal(as in, only the header is available from the first byte not every 2048 bytes) SEQ-VAG-STREAM format " math svs = 1 endif endif endif endif if char_01 == 0x56 if char_02 == 0x53 if char_03 == 0x46 if char_04 == 0x00 print " normal(as in, only the header is available from the first byte not every 2048 bytes) VAG-STREAM format " math vsf = 1 endif endif endif endif if str = 1 get interleave_per_block long get remaining_block_numbers long get str_03 long get block_config long get str_05 long get str_06 long get str_07 long if i = 0 xmath vlt "remaining_block_numbers + 1" if char_04 == 0x4d math clt = channels else if j = 1 math clt = channels endif endif endif endif if vs = 1 get block_config long # ^ 0-1 is mono/stereo flag, and not much is known beyond that get current_block_number long get remaining_block_numbers long get sample_rate_frequency long get volume_number long get vs_06 long get vs_07 long if i = 0 if j = 0 xmath channels "(block_config & 1) + 1" math vlt = remaining_block_numbers math clt = channels endif endif endif if svs = 1 get stream_config long # ^ 0-1 is mono/stereo flag, 2 is loop flag, again, nothing known beyond that get minimum_loop_sample_within_stream long get maximum_samples_within_stream long get sample_rate_frequency long get svs_05 long get svs_file_number long get volume_number long if i = 0 if j = 0 math vlt = 1 math clt = 1 endif endif endif if vsf = 1 get vsf_size long get vsf_file_number long get vsf_03 long get maximum_samples_within_stream long get vsf_05 long get minimum_loop_sample_within_stream long get stream_config long # ^ 0-1 is mono/stereo flag, 2 is loop flag, # although 0x10 exists as an additional flag as well get sample_rate_frequency long get volume_number long get vsf_10 long if i = 0 if j = 0 math vlt = 1 math clt = 1 endif endif endif math vs_offset >> 11 math vs_offset + 1 math vs_offset << 11 next j if i = 0 if svs != 1 && vsf != 1 xmath vs_size "(vlt << 11) * channels" if file_size == vs_size print " overall stream size(with blocked layout) is correct " endif endif endif next i