I am using Naudio and I have a stream which I need to read as array and then when I have found maximum I need to multiply each value with ( 1/ biggest ) and then I should have values in my array as [-1,1].
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
I don't see really what you mean by "convert", but instead of the code you wrote you could just do:
This will result with floats between 0 and 1, since bytes are always positive.
float to short:
float num1; short num6 = (short)num1;
http://www.convertdatatypes.com/Convert-short-to-byte-in-CSharp.html
http://www.c-sharpcorner.com/uploadfile/mahesh/convert-long-short-single-to-byte-array-in-C-Sharp/