demozoo / cowbell

A universal web audio player for demoscene / tracker music
https://demozoo.github.io/cowbell/
BSD 3-Clause "New" or "Revised" License
75 stars 6 forks source link

sample values of the 'niche' music don't go below 0 #10

Closed HybridDog closed 8 years ago

HybridDog commented 8 years ago

l tried that: https://demozoo.github.io/cowbell/ l noticed, when recording the niche music using audacity, that the sample values are never below 0, see this screenshot: 2016-07-28-204258_1920x1080_scrot It happened with Dancing Queen (PSG), Worlds Apart (STC), Summer Mood (PT3) and Squareland Story (VTX). The strange behaviour also causes an audible odd sound quality. The problem didn't happen with the 4 other music files.

Since l don't know those file types, l'm not sure if this behaviour is wrong or maybe deliberate.

gasman commented 8 years ago

This is expected behaviour. These file formats are for music written for the AY / YM sound chip, which works by summing / masking the outputs of several square-wave generators - each generator is zero or a positive voltage.

As a result, I don't think it's possible to eliminate this offset without introducing worse artefacts. (I know that other emulators have tried, and broken the emulation as a result...)

HybridDog commented 8 years ago

ok, thanks,

so you could double the volume of the music just by beginning at -1 instead of 0 and multiplying with 2. Of course to not cause clicks, when pressing play or stop it must be avoided to immediately jump to -1.

gasman commented 8 years ago

I don't think that will help - that'll just give you a different constant offset. For example, a track that only uses volume levels below 50% will give you a waveform where everything is below zero.

HybridDog commented 8 years ago

You're right, putting it to -1 may also make a DC offset removing plugin work badly http://plugin.org.uk/ladspa-swh/docs/ladspa-swh.html#tth_sEc2.23