Csound Csound-dev Csound-tekno Search About

[Csnd] 24bit->16bit conversion in Csound

Date2008-12-10 16:56
Frommark jamerson
Subject[Csnd] 24bit->16bit conversion in Csound
Hello, 

     During an effort to look into the effects of dither, I was trying to convert 24bit files into 16bit files.  The file used was a mono 1k sine tone generated in Csound, using GEN10, with table size 65536, and an oscil amplitude of 10000.  This file sounded and looked perfect.  Then I tried converting the file to a 16bit file in Csound.  I tried loscil and fout to write a 16bit file.  The result was unacceptable, with what sounded like FM sideband modulation. The spectrum analysis also looked extremely messy, with a bunch of extra noise all over the place.  Next I tried using diskin followed by soundin, figuring it might be a problem with my loscil setup. The same results, exactly.  I know that converting a 24bit file to a 16bit file without using dither will lead to a degradation in sound quality, but this seemed excessive.  In an attempt to verify my concerns, I tried the same sort of experiment in a consumer DAW software, by rendering the same 24bit
 file as a 16bit file, with no dither, and got a much cleaner result.  The new file sounded indiscernable form the 24bit source, but the spectrum analysis confirmed a difference, with extra noise across the spectrum, but not anywhere near the levels of the Csound version.  
    So here's my question:  Does anyone do this sort of conversion in Csound, and get acceptable results, if so what methods do you use?  Also, something I just thought of is that I am using the Float version of Csound, is this possibly the cause of these results (would the double version eliminate this sort of thing)? 

                                                                               Mark