AntonioND / gbt-player

A music player library for the PSG audio channels of the GB, GBC and GBA.
MIT License
281 stars 20 forks source link

Desync issue when combined with Maxmod #20

Open copyrat90 opened 1 year ago

copyrat90 commented 1 year ago

I tried combined_maxmod example for my song, but there's a slight desync (slight off?) with it.

Here's the unsplit s3m file if you want to check it out. https://cdn.discordapp.com/attachments/831589248239009832/1076882958721490954/unsplit_creepy_castle_back_door.s3m (It's discord attachment link because github doesn't support s3m format)

For example, the lead melody (channel 6) is slightly late for the 0:31 ~ 0:32 on the gba playback video, but it matches 0:09 ~ 0:10 on the openmpt playback video.

GBA playback

https://user-images.githubusercontent.com/34793045/219988918-5c72b55d-2ecb-446e-9f64-f9f2b66abb01.mp4

OpenMPT playback (trimmed for the noticeable part, matches from 0:22 on the video above)

https://user-images.githubusercontent.com/34793045/219990429-770e124c-7ddb-4f91-ad72-c02e482017d7.mp4

copyrat90 commented 1 year ago

More noticeable example here.

This one is also related with #19, as I switch the lead melody from Ch1 to Ch6 in order to use the pitch bend (Exx, Gxx), which is currently unsupported on GBT.

You can hear the slight off on the melody from the GBA playback, where this channel switch takes place.

OpenMPT playback

https://user-images.githubusercontent.com/34793045/224999153-c40a05a3-4797-4b1a-bc0b-fb1b9c9b6148.mp4

GBA playback

https://user-images.githubusercontent.com/34793045/224999407-ffd987e1-6ed9-42e6-9084-fc3f9f9491d7.mp4

GBA playback (with drums, more mess)

https://user-images.githubusercontent.com/34793045/225014897-48851415-b177-4d5d-9cb3-111126c37806.mp4

I could move this melody to the Channel 6 entirely, but it would be nice if any of #20 or #19 is fixed.

AntonioND commented 1 year ago

Hmmm ok, I think that I notice it better here.

The problem is that the only way I see to make this more reliable is to modify maxmod to add a hook that is called each tick. In reality, maxmod advances ticks whenever the song requires it based on the BPM, but GBT can't do that, so even a tiny difference means that at some point GBT will have to catch up, or wait for a frame to update.