Return-To-The-Roots / s25client

Return To The Roots (Settlers II(R) Clone)
http://www.rttr.info
GNU General Public License v2.0
478 stars 77 forks source link

SFX clarity and playback speed issues #1246

Open Richard-L opened 4 years ago

Richard-L commented 4 years ago

bird-tweet-sfx.zip

^Compare these bird tweet sounds of original S2 and RttR. I've always found RttR's very weird sounding, like something I've never ever heard in the original S2.

Is it possible to fix this?

Flamefire commented 4 years ago

@Spikeone @Flow86 This might be due to wrong resampling. The sound.scs defines how it is resampled. How was this file created and could it be fixed (if that's the cause)?

Flow86 commented 4 years ago

it was kind of manually, because some sounds didnt have the default 11025hz I think. but the file could be wrong.

@Flamefire what about that fileformat for .bob overriding?

Flamefire commented 4 years ago

what about that fileformat for .bob overriding?

Sorry, I don't understand the connection to bob files.

Flow86 commented 4 years ago

never mind, I thought about the format of the scs file for the bob linking stuff?

Flamefire commented 4 years ago

Not really because we have 1 line per target index which is unfeasible for the few thousand entries in the bob files when you only want to add/change some. It would have been better if empty was not there: It seems the feature of mapping different source and target indices is not used, so removing all empty lines we'd have something usable <index> <"copy" or frequency>. We could parse it like the proposed bob.link format where copy will be -1 but that doesn't make sense for the link-format where only numbers are allowed. Could be done though, maybe via a custom header in the text file (check palette animations in libsiedler2) or a function parameter handleCopy (or so)

Flow86 commented 4 years ago

yes of course we would have to extend it, and modernize it (to ignore those copy lines)

Richard-L commented 4 years ago

Since sampling rate is brought up, in fact all RttR SFX sound damper compared to vanilla S2 to me, as if the sampling rate was too low. Sometimes the pitch is also off, for example with the "baa" of the sheep I can hear this consistently.

Even just the "tick" of clicking through menus is something vanilla S2 doesn't have.

Happy to upload more recordings to exemplify if you need.

Flamefire commented 4 years ago

If you want you can work on this yourself:
All sounds are in a file SOUND.LST in the original S2 folder. Those are resampled to 44100Hz using the source frequencies as set in the sound.scs file (RTTR folder) which is a simple text file.

So 2 options:

  1. Either unpack the wav files and work with them to find the right frequency
  2. Change the entry in the sound.scs adjusting the source frequency, restart rttr and check if it sounds right now.

For 1: The created wav files have a fixed frequency of 11025Hz which is a hard-coded guess and likely wrong for some which is why we use the sounds.scs in the first place. So you either need to work with the binary data in tha wav files as raw PCM data or use a hex editor to change the 2 4Byte values in the WAV header that set the frequency and byterate.

To find out which sound index is which search the source code for GetSoundN("sound" and PlayNOSound. The code there should be pretty easy to read even when you don't know any C++

Flow86 commented 4 years ago

the problem is, that there is no wav header in the file itself. thats why we create one, with the sample rate set from sound.scs, then we upsample it to 44100 so SDL(-mixer) can play them.

Richard-L commented 4 years ago

farmer-sfx.zip

^comparison of farmer sound from vanilla S2 and RttR.

Currently most SFX are either too unclear in sound quality, or play back at wrong speed.

Spikeone commented 4 years ago

@Richard-L @Flamefire any news on that? Thought you changed the sound.scs some time ago :)

Flamefire commented 4 years ago

I just changed the format a bit, not the values. Someone with experience with sounds can do that, see https://github.com/Return-To-The-Roots/s25client/issues/1246#issuecomment-638884713 :)

Richard-L commented 4 years ago

@Spikeone not possible to get good quality SFX like you hear on DosBox, so I lost interest.