Skip to content

Sample rates #32

Open
oliviamiller wants to merge 1 commit intoviam-modules:mainfrom
oliviamiller:sample-rates
Open

Sample rates #32
oliviamiller wants to merge 1 commit intoviam-modules:mainfrom
oliviamiller:sample-rates

Conversation

@oliviamiller
Copy link
Collaborator

@oliviamiller oliviamiller commented Mar 17, 2026

Use native sample rate for microphone input when supported

Previously the microphone always opened the PortAudio stream at the device's default sample rate, regardless what was configured. If the user requested a different rate (e.g. 16kHz), audio was captured at the device default (e.g. 44.1kHz) and resampled — even if the device natively supported 16kHz.

This PR uses Pa_IsFormatSupported to check whether the requested sample rate is natively supported before opening the stream. If it is, the stream is opened at the requested rate directly, avoiding unnecessary resampling. If not, it falls back to the device default and resamples as before.

1 approval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant