ipatix / agbplay

Music player for the most common GBA sound format
GNU Lesser General Public License v3.0
119 stars 20 forks source link

(Pokemon FR/LG) Pitch Bend Issues #59

Closed Samtastic1 closed 1 year ago

Samtastic1 commented 1 year ago

In some songs in FireRed LeafGreen, most notibaly the Trainer Battle theme (song 160), the pitch bends on the guitars will fail to pitch bend correctly compared against the MIDI being played on a soundfont.

On a normal load of the ROM, the pitch bends will end early and cause a blip of an extra note. It doesn't do this on shorter bends but for longer high pitched bends it's more noticeable.

Me and Kurausukun have found one workaround on modifying the MIDi file so the guitars are in seperate tracks.

It does not do this on the synth track that plays mostly the same notes or even track 4 on the guitars.

I tried this using a version of SAPPY 2006 and by setting the note limiter to 1, the bends played normally, no blips.

Pitch Bend Example.zip

ipatix commented 1 year ago

Applying a note limiter is not a fair comparison. My guess is that the song data is actually faulty and it may happen because the note that bends down actually ends after the pitch resets back to normal.

agbplay prevents note in release state (after they are stopped but are still fading out) to be affected by pitch bends and volume changes, so it's probably not such a case.

Samtastic1 commented 1 year ago

Yeah I guess it could be to do with corrupted song data. There's no overlapping on the synth varriant of the same melody. That one is fine.

ipatix commented 1 year ago

I just checked, the song data is fine. This prevention mechanism that's supposed to disallow changes to notes in release state actually is enabled for volume change events only.

There may be a reason why I chose to do this back then. Perhaps it's the LFOs, but then again LFOs also exist for volume.

The main question is: Are LFOs supposed to affect notes in release state? If no, this could sometimes lead to akward situations where the LFO suddenly stops, even though you are still hearing the note fading out (possibly at a non-center pitch or volume). Currently agbplay would only simply allow disabling or enabling LFO+event changes during not release but not both of them individually.

I'll have to think about this for a bit.

Samtastic1 commented 1 year ago

I see. Is there a way to disable it? Here's the original OST; it doesn't 'blip' like that. I also tested this in emulators like mGBA and I don't hear any overlapping there.There may be a way to add it to the JSDN file. https://www.youtube.com/watch?v=M3o5-Ny4eU0

On Mon, May 22, 2023 at 11:09 AM Michael Panzlaff @.***> wrote:

I just checked, the song data is fine. This prevention mechanism that's supposed to disallow changes to notes in release state actually is enabled for volume change events only.

There may be a reason why I chose to do this back then. Perhaps it's the LFOs, but then again LFOs also exist for volume.

The main question is: Are LFOs supposed to affect notes in release state? If no, this could sometimes lead to akward situations where the LFO suddenly stops, even though you are still hearing the note fading out (possibly at a non-center pitch or volume). Currently agbplay would only simply allow disabling or enabling LFO+event changes during not release but not both of them individually.

I'll have to think about this for a bit.

— Reply to this email directly, view it on GitHub https://github.com/ipatix/agbplay/issues/59#issuecomment-1556938949, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGMZPJBXSV2QOFTWS4TADCLXHM3OHANCNFSM6AAAAAAYE7TMJ4 . You are receiving this because you authored the thread.Message ID: @.***>

Samtastic1 commented 1 year ago

Here's one perfect no 'blip' on an old version of SAPPY. SAPPY_Pitch Bends.zip

Samtastic1 commented 1 year ago

Here's something I notice. If you leave the bend where it is and put it back to 0, it won't reset itself and stay there. The MIDI can be perfected with no blips if you leave the pitch bend at a certain value and have the next notes play on another track. Smooth Guitar Bend.zip

ipatix commented 1 year ago

6bd736ec232ced57d5a15f3a4aca43ef95f19497

I'll ignore the LFO issue for now since it should only be a problem (even if at all) when pitch LFOs are very extreme and release times are long.

Either way, your problem should be fixed by the latest change.