Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make noises on Ubuntu 18.04 with Pulseaudio #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

teknico
Copy link

@teknico teknico commented Nov 15, 2018

WIP, don't merge, contains ugly workarounds to #1. :-)

On Ubuntu 18.04 with Pulseaudio, the with_max_sample_rate method returns
Format { channels: 1, sample_rate: SampleRate(192_000), data_type: I16 }
but the code assumes:
Format { channels: 2, sample_rate: SampleRate(44_100), data_type: F32 }
so we hard-wire it.

Then cpal returns a buffer of length 8820, which is not a multiple of 64: the code tries to fill the too short tail and we get an index out of bounds panic. The workaround shown here is to not use the buffer tail. I also tried skipping the tail of the last worker chunk, but in both cases the resulting audio is scratchy, because the waveform gets cut off or has additional pauses.

I could not find a way to tell cpal to use a given buffer size, nor to tell the workers to use a different chunk size.

Hard-wire the format, since the code only deals with one combination anyway.

Also use a ugly-sounding workaround for a buffer size not multiple of 64
causing a panic.
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