Quantcast
Channel: NAudio
Viewing all articles
Browse latest Browse all 5831

New Post: why divide by 32768f

$
0
0
I found this code online and I have been using it, but I do not know why you have to
divide by 32768f. and why do you have to make it a short ?
I want my to be a double to that is why I added
buffer1[tempint] = (double)sample32;
is there a better way of doing it ?
void waveIn_DataAvailable(object sender, WaveInEventArgs e)
        {
t sample = (short)((buffer[index + 1] << 8) |
                                        buffer[index + 0]);

                float sample32 = sample / 32768f;
                buffer1[tempint] = (double)sample32;
                tempint++;
}
and why do you have to divide by 32768f?

Viewing all articles
Browse latest Browse all 5831

Trending Articles



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