HydrogenAudio

Hydrogenaudio Forum => General Audio => Topic started by: systmcrsh on 2015-05-25 10:31:05

Title: trying to get the most out of converting to 8bit audio.... (sox/ssrc)
Post by: systmcrsh on 2015-05-25 10:31:05
hi, i often use this forum as reference but dont generally post... if this belongs in another subforum let me know and i'll move it

i'm scripting a routine to convert 16/44 audio to a format for old amiga computers... specifically to 8bit wav at a variety of sample rates.

the amiga uses a unique way of playing back audio based on cpu clock and screen refresh. there's a variety of sample rates that are optimal... i'll choose one that SSRC doesn't complain about converting to, 27928...

so far my script is:

Code: [Select]
sox infile.wav tempfile.wav silence 1 0.1 -48.16d reverse silence 1 0.1 -48.16d reverse pad .5 .5

-> removes any audio below -48.16 dB at the start and end of the input file and saves the remainder to a tempfile. according to wikipedia 48.16 is the SNR of 8 bit audio. sox also pad's the tempfile with .5s of silence at the beginning and end because ssrc (below) seems to have problems with short samples of audio.

Code: [Select]
ssrc_hp --twopass --bits 8 --dither 2 --pdf 2 --rate 27928 --normalize tempfile.wav anothertempfile.wav

-> ssrc's noise shaping sounds better to my ear than sox, or that sox won't let me use most filter options below 44100

Code: [Select]
sox anothertempfile.wav final.wav trim 0.5 reverse trim 0.5 reverse

-> removes the .5s padding at the start and end because of the ssrc problem above and saves the final wav file.

here is an example of the above using a roland tr-808 bassdrum:

infile (16/44): 808in.wav (http://www.dirtybomb.tk/808in.wav)
outfile (8/27828): 808out.wav (http://www.dirtybomb.tk/808out.wav)

and another example using a roland tr-808 cymbal:

infile (16/44): cymin.wav (http://www.dirtybomb.tk/cymin.wav)
outfile (8/27828): cymout.wav (http://www.dirtybomb.tk/cymout.wav)

i'm curious if there's any way to improve the quality of the resulting audio. i know that's subjective... i'm mainly curious in which ways i can tweak or alter the settings in my script... for instance, if i could live without a few more decibels in SNR could i optimally reduce the amp of the noise shaping in ssrc... does that make sense? if so, then what that ratio would be... ie, -48.16 vs --amp of noise shaping...

or if i might alter the script depending on the frequency range of the infile...

or if there's some compression options in sox i could use that would reduce the noise shaping of the audio...

or, if there is a completely different way of doing things that might result in a file sounding better (less noise, no crazy artifacts), that would be awesome...

if someone can make those outfiles sound better, i'd be really interested and really grateful to hear them )
Title: trying to get the most out of converting to 8bit audio.... (sox/ssrc)
Post by: systmcrsh on 2015-05-25 12:35:08
was just thinking about something else...

i once wrote a bitcrusher effect that i added a LP/HP filter to because lower frequencies seemed to respond more dramatically to bit reduction...

its interesting in the above audio examples that the file with the lower frequency has more noise... maybe because of the noise shaping algorithm... but maybe because its more complicated to noise shape lower frequencies... just like how they seem to respond more to bit reduction...

i suspect that in the above audio examples if i used no noise shaping at all that the effect of bit reduction would still be more noticeable on the bassdrum example...

as if high frequencies require less bit and more rate and lower frequencies require more bit and less rate...
Title: trying to get the most out of converting to 8bit audio.... (sox/ssrc)
Post by: Kamedo2 on 2015-05-25 16:00:17
Here is my try with wav8bit 3.0.0. This is challenging because of the low 27928 Hz sampling rate. 13964Hz is clearly audible and we cannot use a noise-shaping to move the noise from audible to ultrasonic.

http://zak.s206.xrea.com/bitratetest/808out.3b8.wav (http://zak.s206.xrea.com/bitratetest/808out.3b8.wav)
http://zak.s206.xrea.com/bitratetest/cymout.3b8.wav (http://zak.s206.xrea.com/bitratetest/cymout.3b8.wav)
Title: trying to get the most out of converting to 8bit audio.... (sox/ssrc)
Post by: systmcrsh on 2015-05-26 03:44:13
thanks for giving it a shot. i tried your wav8bit3 utility but was unable to get as good of a result than with ssrc... to my ears anyway.

also, it seems that although 48.16dB is the SNR of 8 bit audio, another 6.02dB can be added for a total of 54.18dB. anything below that just results in noisy artifacts...

why an extra 6.02dB can be added, i'm not exactly sure... but i was looking at this page when i tried it: http://electronics.stackexchange.com/quest...imum-dbfs-of-96 (http://electronics.stackexchange.com/questions/85435/why-do-16-bit-systems-have-a-minimum-dbfs-of-96)

for some reason i can't edit my post above, but the code should read:

Code: [Select]
sox infile.wav tempfile.wav silence 1 0.1 -54.18d reverse silence 1 0.1 -54.18d reverse pad .5 .5


also updated the outfiles.