Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bhrousseau opened this issue Feb 15, 2024 · 0 comments

Comments

@bhrousseau
Copy link

bhrousseau commented Feb 15, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant