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

Commented Unassigned: 32bit PCM into 16bit PCM [16397]

$
0
0
How can i convert 32 bit PCM wave into 16 bit PCM??

I was making software to record system volume using LoopBackCapture. Its capturing data of 32 bit PCM ( 32 bit PCM: 48kHz 2 channels wBitsPerSample:32 dwChannelMask:3 subFormat:00000003-0000-0010-8000-00aa00389b71 extraSize:22 )

I want to convert it into a 16 bit stereo data....I am not able to get it...

Its my code to convert the data from 32 bit PCM into 16 bit PCM. I am getting some noises and some real song data. Need help...

```
Private Function FX32TO16(ByVal input As Byte(), ByVal len As Integer) As Byte()
Dim output As Byte() = New Byte(len / 2 - 1) {}
Dim outputIndex As Integer = 0
For n As Integer = 0 To len - 1 Step 4
output(outputIndex) = input(n + 2)
output(outputIndex + 1) = input(n + 3)
outputIndex += 2
Next
Return output
End Function
```
Comments: WaveFloatTo16Provider is intended for this purpose (assuming your captured data is floating point rather than 32 bit int).

Viewing all articles
Browse latest Browse all 738

Trending Articles



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