OpenGothic icon indicating copy to clipboard operation
OpenGothic copied to clipboard

Audible difference in music playback

Open Nindaleth opened this issue 4 years ago • 7 comments

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:

  • Both original and OpenGothic will play the menu music for a while on startup. After it finishes, I reload the save to force a fresh start of the music track. OpenGothic restarts the music ~0.5s after the loading is finished, that's why the previous state of the loop can be heard shortly at the beginning - I don't mind that and don't consider that an issue at the moment.
  • I've noticed that readme lists the Music as in progress, is this issue the reason or is there something else?

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

Nindaleth avatar Jan 28 '21 18:01 Nindaleth

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:

  • Music, consists of PCM/ADPCM sound samples - those are simple and done reliably.
  • Sound samples grouped by bands(Dx8::Band)
  • Instrument(Dx8::PatternList::Instrument) = list of notes + curves + reference to band
  • Pattern = array of instruments

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.

Try avatar Jan 28 '21 20:01 Try

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.

Nindaleth avatar Jan 28 '21 20:01 Nindaleth

@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 :(

VitalyPetrov avatar Dec 25 '23 21:12 VitalyPetrov

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

Try avatar Dec 26 '23 20:12 Try

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

hwnde avatar Feb 24 '24 09:02 hwnde

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. 😀

JaXt0r avatar Mar 06 '24 22:03 JaXt0r

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.

Try avatar Mar 06 '24 23:03 Try