Quantcast
Channel: naudio Work Item Rss Feed
Viewing all articles
Browse latest Browse all 738

Commented Issue: Conversion to Float is wrong [16380]

$
0
0
This code is from SimpleCompressorStream there is the followig code
left = BitConverter.ToInt16(buffer, start) / 32768.0;

that is wrong because max short is 32767 while min short is -32768

the resulting code will span ranges from[-1 to 0.99999999999999999]
Comments: usually i would have done things like this var sSample = BitConverter.ToInt16(buffer, i + off); var sample = sampleCount == 0 ? 0.0 : sSample / ( sSample > 0 ? 32767.0 : 32768.0); I think that is wrong since you won't be able to cover[-1,1] interval with your conversion, you are introducing a kind of limiting with your code. What do you think? I sent you a little request for help last night, have you seen my code snippet??

Viewing all articles
Browse latest Browse all 738

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>