Try / OpenGothic

Reimplementation of Gothic 2 Notr
MIT License
1.14k stars 80 forks source link

Audible difference in music playback #117

Open Nindaleth opened 3 years ago

Nindaleth commented 3 years ago

Lastly I've been spending some hours in Valley of Mines in the original and have gotten used to the one song playing in most of the area. When reaching the area in OpenGothic, the music sounds different, although the same data should be used for playback as in the original.

For the comparison, I've recorded two videos, in both I've loaded a save standing in a similar place, so that the music starts to play from the beginning. It can be heard throughout the video that OpenGothic sounds differently for some reason, but the most audible part is between 1:00 and 1:15. Another one is the drum sounding a lot quieter between 0:00 and 0:10.

Notes:

Original: https://user-images.githubusercontent.com/6383928/106178749-71fa0280-619a-11eb-962e-e3aa3a5c1b23.mp4

OpenGothic: https://user-images.githubusercontent.com/6383928/106178725-6c042180-619a-11eb-9433-7041176caa9b.mp4

Try commented 3 years ago

OpenGothic sounds differently for some reason

There is more than "some" reason :D Most likely there is more than one issue in my implementation of DirectX music.

Original uses DXMusic from DirectX7, OpenGothic - emulate DX8 music as good as it can. DX8 format structure is based on DLS-sound format + some stuff on top of it.

To keep it short:

OpenGothic handles pattern switch by itself and instrument rendering by library TinySoundFont.

The soundtrack : изображение

The drummer represented by instrument №22 and №23.

The issue: Sound samples of drummer plays same way in DirectMusicProducer and OpenGothic, but the whole instrument has big difference in sound volume: OpenGothic is very quiet. I don't see a reason why instrument 22, 23 should be more laugh - I'm probably missing something big.

Note: I'm taking DirectMusicProducer is a reference implementation, as it probably most 'correct' one. Note2: all sources related to music can be found in game/dmusic. Note3: it's been more than a year since I've done most of current music implementation - already forgot some things. Note4: OpenGothic renders instrument fist and apples curves later - this is probably wrong.

Nindaleth commented 3 years ago

Whoa, that's an explanation I didn't expect! I thought Gothic was mixing together a few MP3s or something, not that there is full-blown DX8-provided music tracker.

But your explanation does seem to point to "only" one reason - everything I can hear wrong with the current state could be explained by improper volume leveling. There are no missing (or invalid) instruments or incorrect durations - the drums are just too quiet and the strings are just too loud. On further listening, I can hear now that the violin sound plays for that long time even in the original, the difference is that in original the volume curve goes downward and the violin thus gets quieter in the last few seconds.

VitalyPetrov commented 8 months ago

@Try hi! Do you have any ideas how to fix this issue? I tried the last build and it's the only significant issue as for me :(

Try commented 8 months ago

Hi, @VitalyPetrov !

No good ideas unfortunately. Ideally we would like to use third party library for music, yet there seem to be no such for DX-music. Can you also point so particular soundtracks to check/test, other than mine-valley?

PS: "debugging" by listening is horrible experience :D

hwnde commented 6 months ago

@Try Perhaps DX music implementation from Wine could help? https://gitlab.winehq.org/wine/wine/-/tree/master/dlls/dmusic?ref_type=heads

JaXt0r commented 6 months ago

Hi Try. Did you investigate libdmusic? It was built in 2019 and mentioned to be the music implementation for ReGoth. If feasible, it should be easy to use for OpenGothic as kind of ReGoth's successor. 😀

Try commented 6 months ago

Hi, @JaXt0r !

Yes, been there, done that. libdmusic has same level of completeness as ReGoth. For Hall of Idorath music was turn into bit-noise.