Skip to content

Two frames are added at the end of data stream that does not exists in the original VGM file #3

@bhrousseau

Description

@bhrousseau

In vgmparser.py, the parser add two frames at the end of data stream that does not exists in the original VGM file.
Thoses two added frames breaks the music rythm when the stream is looped.

The first one is added when token x66 is found. As per VGM specification, x66 is end of file or goto marker when a loop exists. this token does not mean there is a frame wait.
I understand that the vgc player is based on frame "blocks" that can not be splitted between an end and a start of a file, so vgm files should be prepared in this regard. Well formed VGM files that plays frame based stream should end by x63 x66 or x62 x66.
Trackers like "Furnace" has options to convert to frame based loops when exporting vgm files, and will end the file correctly (this is not the case for Deflemask).

So here, it is recommended to not append data when command is x66 :

			# 0x62 - Wait 735 samples (60th of a second)
			# 0x63 - Wait 882 samples (50th of a second)
			# 0x66 - End of sound data
			elif command in [b'\x62', b'\x63', b'\x66']:
				self.command_list.append({'command': command, 'data': None})

				# Stop processing commands if we are at the end of the music
				# data
				if command == b'\x66':
					break

Just before the EOF, the last wait should also be removed :

		# eof
		data_block.append(0x00)	# append one last wait
		data_block.append(0xFF)	# signal EOF

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions