McKay42 / McOsu

Custom unofficial osu! practice client with Virtual Reality support
GNU General Public License v3.0
427 stars 41 forks source link

Play different hitsounds when too early or too late #327

Closed kiwec closed 1 year ago

kiwec commented 2 years ago

Useful for knowing where you tend to hit too early or too late in general, and for training deathstreams.

Demo: https://www.youtube.com/watch?v=Wdk1bVEmus8

For the hitsounds, I pitched the default McOsu miss sound up/down. Feel free to edit or restart this PR from scratch if needed (sounds should probably be named "too-early" and "too-late" instead).

Devocub commented 2 years ago

I decided to make it too finally https://cdn.discordapp.com/attachments/222386288081371136/927554618521714698/2022-01-03_16-28-56.mp4

kiwec commented 2 years ago

I decided to make it too finally https://cdn.discordapp.com/attachments/222386288081371136/927554618521714698/2022-01-03_16-28-56.mp4

How did you get the live pitch change to work? I tried with BASSFX but since that only accepts streams and not samples, I could only play one hitsound at a time (which sucks for high BPM/streams).

Also love the hitsounds, what's the skin? :stuck_out_tongue:

McKay42 commented 2 years ago

How did you get the live pitch change to work?

I've never needed a feature of that sort, which is why the Sound::setFrequency() function does not persist for overlayable sounds with multiple channels in the engine (BASSFX and Sound::setPitch() is overkill for such a simple pitch shift sound effect). I'd simply add a third parameter to SoundEngine::play() which sets the frequency as a multiplier, and then BASS_ChannelSetAttribute(handle, BASS_ATTRIB_FREQ, baseFrequency * multiplier), whereby baseFrequency is whatever the audio file is using (this is not always the same frequency as in BASS_Init()!).

However, this approach with playback frequency modification has the sideeffect of also modifying the hitsound playback length, meaning that it will desync the music from the hitsound depending on the amount changed (no change meaning perfect sync). But, players listening to pitch are probably already ignoring music/hitsound sync, similar to players purely playing by visuals.

BassFX's BASS_ATTRIB_TEMPO_FREQ does actually re-process the audio data to shift the pitch while keeping the playback length exactly the same, but has some overhead for doing so and is annoying to use for samples/effects.

From a practicing and game design perspective, I think that a few (maybe 4 total) discrete hitsounds for early/late with a fixed defined pitch change are better than dynamically changing the pitch depending on the hit delta all the time by small meaningless amounts.

Devocub commented 2 years ago

How did you get the live pitch change to work?

The solution are already exist in code - for spinner spin.

Also love the hitsounds, what's the skin? 😛

my hs.zip

However, this approach with playback frequency modification has the sideeffect of also modifying the hitsound playback length, meaning that it will desync the music from the hitsound depending on the amount changed

It's already not synced due to audio engine imprecision, keyboard polling and player being not perfect (most impact), and sometimes you deliberatly hit earlier/later. Even huge changes in freq (and length) feels completely ok.

think that a few (maybe 4 total) discrete hitsounds for early/late with a fixed defined pitch change are better

Yeah, freq modifier can be reset if 300, and kept for else, or quantized some other way. But even without that frequency qunatization it is barely notiecable if you hit inside of 300, though it depend on hitsounds and frequency modifier amount which is adjustable. https://youtu.be/p96Bob8A8J4 (2x freq change at 100 ms delta)

khang06 commented 2 years ago

m_tooslow and m_toofast are not initialized to NULL in OsuSkin::OsuSkin, causing it to randomly crash for me

kiwec commented 2 years ago

m_tooslow and m_toofast are not initialized to NULL in OsuSkin::OsuSkin, causing it to randomly crash for me

Fixed