bbbradsmith / hatariB

Libretro core for Hatari emulation of Atari ST STE TT Falcon
GNU General Public License v2.0
17 stars 3 forks source link

Floppy disk drive sound simulation - NTxC's DriveSound v0.9 #33

Open NTxC opened 4 months ago

NTxC commented 4 months ago

Here's my little contribution to this amazing project.

NTxC's DriveSound v0.9

Experience the authentic Atari ST floppy disk drive sounds as your favorite games/programs are loading in your hatariB libretro core! Check out the demo here: https://www.youtube.com/watch?v=1di2z2WGTbs

Download: NTxCs_DriveSound_v0.9.zip

In the attached archive are:

Supplied sounds are of an Epson SMD-480L disk drive from a YouTube video by Stefan Lindberg, linked here: https://www.youtube.com/watch?v=X_JCWWHKXIc

A unique feature of this patch is that there are two separate seeking sounds: one for backward seeking and one for forward seeking. This adds a lot to the authenticity of the experience.

What can be improved/added:

Darknior commented 4 months ago

So excellent i love this idea and feature :) Thanks a lot

bbbradsmith commented 4 months ago

Okay, I haven't examined the code yet but by the example it looks like:

Is that a correct assessment of the behaviour?

system/drivesound

Is "drivesound" some existing library or product? Does it apply to more than just Hatari?

Supplied sounds are of an Epson SMD-480L disk drive from a YouTube video by Stefan Lindberg

Do these have permission for redistribution, or are we expecting the user to download and supply their own to make this feature work? Maybe I could provide some built in synthesized approximations if these are not licensable.

Ideally we could embed a default set of samples and the user would not have to supply anything.

Conversion of sample rates

I think a simple bilinear resampling should be sufficient here, and the default samples at 48k should be enough. If the user wishes to use a different samplerate and wants better resampling they can override the default samples.

  • A compressor/limiter instead of simple clipping of the result of sample addition to prevent overflows/underflows.

I don't think we should construct an unnatural audio processing chain like this. If the problem is overflow, it can be solved more simply with an option to reduce the overall volume, of both Hatari's sound and the floppy sound.

NTxC commented 4 months ago

Okay, I haven't examined the code yet but by the example it looks like:

  • play a startup sound when the motor turns on
  • play looping motor sound while the motor remains on
  • play a click for 1 track seek
  • play a seek forward/back sound for multi-track seek

Is that a correct assessment of the behaviour?

Yes. It's also important to highlight that the seek fwd/back sounds aren't always played from the beginning; the starting point of playback is based on the current position of the drive's head.

system/drivesound

Is "drivesound" some existing library or product?

It is not - in this case it's just a folder name based on the branding of the patch. Perhaps it would be better to choose a directory like system/hatarib/drivesound instead.

Does it apply to more than just Hatari?

A few years ago I implemented a similar patch use in Steem SSE, but I never released it to the public, so I guess it doesn't in the end.

Supplied sounds are of an Epson SMD-480L disk drive from a YouTube video by Stefan Lindberg

Do these have permission for redistribution, or are we expecting the user to download and supply their own to make this feature work? Maybe I could provide some built in synthesized approximations if these are not licensable.

Ideally we could embed a default set of samples and the user would not have to supply anything.

The author of the original video with the recording of the drive sounds granted me full permission for redistribution (you can verify it in the comment section), so we can embed the samples from my .zip archive directly in the hatariB repository.

Conversion of sample rates

I think a simple bilinear resampling should be sufficient here, and the default samples at 48k should be enough. If the user wishes to use a different samplerate and wants better resampling they can override the default samples.

Good idea, I'm all for it.

  • A compressor/limiter instead of simple clipping of the result of sample addition to prevent overflows/underflows.

I don't think we should construct an unnatural audio processing chain like this. If the problem is overflow, it can be solved more simply with an option to reduce the overall volume, of both Hatari's sound and the floppy sound.

You're right, volume control should be sufficient to solve the problem.

Also, I noticed that sometimes when a drive sound is stopped it emits an audible short "click" which I presume comes from the possibility that the sound did not end at a zero-crossing, sort-of like a recording with a DC offset when it finishes playback.

bbbradsmith commented 2 months ago

I added a Github Actions CI build to this branch, in case anyone would like to try it.

Builds can be found here: https://github.com/bbbradsmith/hatariB/actions/workflows/build-ntxc-drivesound.yml

The builds are currently red because RPi fails, but there are valid Windows and Ubuntu builds inside.

(Otherwise, I haven't forgotten this, it's just taken time to get to.)

References for investigation: