CharlieFuu69 / RenPy_RhythmBeats

Sistema de Acción Rítmica para juegos hechos con Ren'Py
GNU General Public License v3.0
12 stars 2 forks source link

Beatmap creation issue #32

Closed de-luxe110 closed 7 months ago

de-luxe110 commented 8 months ago

Sorry to bother you again, thank you that finally the new module works with the beatmap and song you provided. However when I placed my own beatmap, it would not load in-game. I am a musician myself so I used FL Studio to make the beatmap, however I dunno if the MIDI data exported from FL Studio Mobile is different but I reference the beat information with the one you provided and it checks out so I still don't know where the problem lies.

image

This is a comparison to the beatmap you've provided and the beatmap I created, if that is the reason why it's not being read, please tell me.

image

CharlieFuu69 commented 8 months ago

Hey buddy, that's some strange behavior. Making beatmaps with drums, I never had problems. What's more, if you want, I can provide you with the MIDI of the sample beatmap for you to study. To my eye, your beatmap looks pretty good. Could you provide me with your beatmap so I can try it on my machine?

CharlieFuu69 commented 8 months ago

If my intuition is correct, this could even be a read error that does not break the normal execution of the code, otherwise the load() method would not hesitate to report a RhythmBeatsException("Beatmap read error: <Error>")

As the developer of the project, I apologize for these inconveniences. Any relevant information will be very helpful to improve the rhythmic system =D

[FUTURE UPDATE NOTE]: For upcoming updates, the structure of the beatmap files will change from CSV to JSON format, minimizing any failures due to read errors.

For the moment, I could only recommend using FL Studio Mobile on your mobile or on an Android emulator on PC (example: Bluestacks, Nox Player).

de-luxe110 commented 8 months ago

Hello, I did manage to make it work but it's very strange. I changed the audio from an .mp3 to an .ogg and the beatmap finally worked. I dunno if the audio file type is relative to how the beatmap is loaded but it is working now. I think I just need to convert all my songs to .ogg and it should somehow work with your module.

CharlieFuu69 commented 8 months ago

My God...

Believe me, right now I have an expression that you can't even imagine. The type of audio file, when passed as an argument to the class, should not influence the reading of the beatmap, since the audios are played by a standard Ren'Py function: renpy.music.play, and they work independently in the code.

This is summarized by the following code:

if not self.playback_active:
    renpy.music.play(self.song_file, channel="music", loop=False, tight=True)
    self.playback_active = True

I think your bug reports (or paranormal events with the module) have opened my curiosity.

I will strive to polish this system better. It seems reasonable that it is still in Beta status.

de-luxe110 commented 8 months ago

I do appreciate you taking the time to look at it, though I really don't know myself what's happening when I am certain that I did everything properly. But yeah, I converted my audio back to .mp3 and the beatmap doesn't load up, but when I loaded an .ogg version, it works albeit with a slight delay. So I don't know how it became file specific when your code says it's not. ^^;

CharlieFuu69 commented 8 months ago

I have a slight hunch that the internal chronometer of the rhythmic system is responsible here, so I have the following question:

  1. When using an MP3 file as an audio source, does the audio track play, even without notes appearing in the waterfall?

It occurs to me that you could do a little test to debug this. Go to the stage_hud screen (in case you copied the example from Section 4), and paste the following line inside the vbox:

text "Epoch time: %.01f s" %(my_instance.epoch)

It should look like this:

vbox:
    pos(0.1, 0.1)
    text "Matched notes: %s" % (my_instance.perfect + my_instance.great)
    text "Miss notes: [my_instance.miss]"
    text "Combo: [my_instance.combo]"
    text "Epoch: %.01f s" %(my_instance.epoch)

The heart of the rhythm system is a clock that starts parallel to the audio track, which I call "Epoch" (Like the famous UNIX Time).

Put the MP3 file as an argument to song_file and play the song. That should show you in the game HUD, the exact time of the stopwatch. If that clock doesn't ascend even with the track playing, you could possibly be looking at a Ren'Py error.

de-luxe110 commented 8 months ago

With the .mp3 loaded it, the epoch time is just at 0.0 but it plays the .mp3 file and no notes are showing. But the epoch time works with the .ogg file with a slight delay from the notes.

image

CharlieFuu69 commented 8 months ago

I think that thanks to your comment, I have just discovered an error in Ren'Py, because the one responsible for starting that timer is the following:

renpy.music.get_duration(channel="music")

In short, that function should return the total length of the audio track (in seconds). Apparently, with MP3 files this function is... useless, since it should return a number other than zero.


[NOTE]: If you feel that the beatmap is lagging slightly behind the audio, try adjusting the map offset, passing the following parameter to the RhythmPlayground() class:

offset_map = -50

What does this mean? The beatmap will be 50 milliseconds ahead of the song. With 50 or more milliseconds, you will start to notice that the notes will arrive more on time =D

A positive value will cause the beatmap to be delayed with respect to the audio track.

Link: Documentation - Section 3, item 1

de-luxe110 commented 8 months ago

I did try adjusting the offset of my song but I'm already at around -1000 and it still not syncronized, also the speed of the notes is somewhat different from the audio track even though they are on the same BPM. I've rechecked the MIDI I made and lined it with the audio track and they still sync in the DAW. I don't know how to fix this sync issue,

Is there an option here to adjust the speed of notes since I think it's being heavily delayed

CharlieFuu69 commented 8 months ago

Could you provide me with your beatmap and audio track so I can examine it when I have time? 1000 milliseconds is exactly 1 second delay so there should be noticeable differences when modifying offset_map or offset_game.

Contact (Discord): charliefuu69

de-luxe110 commented 8 months ago

I've already sent you a request on Discord since most of the files I'm working on are still in development so I can't just post them here.

But just to give you some insight, the notes are way slower compared to the audio playing so no matter how match I had on the beginning, it falls off in the middle. I made sure that the BPM for the audio and the MIDI are the same but it just doesn't work. If there's a way to adjust the speed of the beatmap to match the audio, I would love to know where that is since the offset doesn't match it that well.