Skip to content

Commit

Permalink
Fix unpropagated audio sampling rate from microphones
Browse files Browse the repository at this point in the history
  • Loading branch information
lherman-cs committed Oct 30, 2020
1 parent 00877c7 commit 1720eee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions pkg/driver/microphone/microphone_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ func (m *microphone) AudioRecord(p prop.Media) (audio.Reader, error) {

a := wave.NewInt16Interleaved(
wave.ChunkInfo{
Channels: p.ChannelCount,
Len: len(buff) / p.ChannelCount,
Channels: p.ChannelCount,
Len: len(buff) / p.ChannelCount,
SamplingRate: p.SampleRate,
},
)
copy(a.Data, buff)
Expand Down
5 changes: 3 additions & 2 deletions pkg/driver/microphone/microphone_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,9 @@ func (m *microphone) AudioRecord(p prop.Media) (audio.Reader, error) {

a := wave.NewInt16Interleaved(
wave.ChunkInfo{
Channels: p.ChannelCount,
Len: (int(b.waveHdr.dwBytesRecorded) / 2) / p.ChannelCount,
Channels: p.ChannelCount,
Len: (int(b.waveHdr.dwBytesRecorded) / 2) / p.ChannelCount,
SamplingRate: p.SampleRate,
},
)

Expand Down

0 comments on commit 1720eee

Please sign in to comment.