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

Fix macOS crackling/stuttering related to SDL buffer, use Portaudio for playback instead of SDL #576

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

Conversation

adroste
Copy link

@adroste adroste commented Apr 14, 2021

For some reason the use of SDLPlayback in combination with PortaudioInput causes weird playback issues on my Mac.
The issue can be partly resolved by using an extremely large buffer size for the SDL playback (8196 and above).

If I use
PortaudioPlayback + PortaudioInput -> no issues (low latency < 2ms possible with a few code changes)
SDLPlayback + SDLInput -> no issues (low latency <2ms possible with a few code changes)

Therefore the following commit fixes all my issues. What was the reason for using SDLPlayback when Portaudio is available?

Fixes #573

@s09bQ5
Copy link
Collaborator

s09bQ5 commented Apr 14, 2021

I feel uncomfortable with changing the default for all *NIX platforms if it so far appears to be a problem only on macOS.

I think the goal has always been to get rid of PortAudio since we were already linking to SDL for graphics, keyboard, and mouse. We didn't use SDL for recording audio in the past because the API didn't support it. Now it does, which recently led me to add the --without-portaudio configure switch.

@adroste
Copy link
Author

adroste commented Apr 14, 2021

If the goal is to get rid of PortAudio then the fix should be to don't define "HavePortaudio" on Darwin.
However, PortaudioInput+PortaudioPlayback and SDLInput+SDLPlayback work fine, mixing them breaks things (for whatever reason).

Edit: The behavior of Portaudio is less prone to config issues. Portaudio seems to set the buffers/latency to a stable minimum, whereas SDL just uses your configured buffer size causing crackling/stuttering or even no audio if set too low.

@s09bQ5 Before I make another commit, what would be your preferred way to remove Portaudio on macOS? Just undef the HavePortaudio if Darwin?

@s09bQ5
Copy link
Collaborator

s09bQ5 commented Nov 22, 2021

I'd say the best way is to change the default value of with_portaudio in configure.ac from "check" to "no" if configure is run on macOS.

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.

Audio crackling / stuttering on macOS with Audio Interface
2 participants