Skip to content
New issue

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

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

Already on GitHub? # to your account

Minimizing the bufferSize #59

Open
lucianthorr opened this issue Jun 16, 2019 · 4 comments
Open

Minimizing the bufferSize #59

lucianthorr opened this issue Jun 16, 2019 · 4 comments

Comments

@lucianthorr
Copy link

I've been working on a super simple midi-based synthesizer based heavily on your approach to handling the audio signal. I'd like to keep working on it but I can't seem to get the buffersize down enough so that the latency isn't so noticeable. I can get it down to about 22 milliseconds but any lower and there's a clicking sound. Do you have an idea as to why the smaller buffer sizes become problematic?

My start is here, if you're curious:
https://github.com/lucianthorr/aja/blob/3ee2d82b74f5ab6755732f9f30a0899d18cc2464/main.go#L24

@faiface
Copy link
Owner

faiface commented Jun 16, 2019

Hi, which OS are you using? AFAIK, the implementation on Linux allows for really short buffer sizes, while implementations on other OSs are a little worse (but still completely fine for games, media apps, etc).

@lucianthorr
Copy link
Author

I'm on a Mac. But that's good to know. I could very well be doing something else wrong somewhere else.

@faiface
Copy link
Owner

faiface commented Jun 16, 2019

Try Linux. Even a virtual machine could help. I was able to get 1/100s and less buffer size on Linux. Beep uses Oto for low level audio playback. Me and Hajime Hosi collaborated on it. It's a little unfortunate that the low level implementation for Mac isn't as good as for Linux. This is because the Mac implementation uses OpenAL, which is a pretty shit library with regards to latency. Hopefully, we'll improve it someday. The driver for Windows may actually also be good, but I've never tried it personally (Hajime Hoshi has implemented it).

@lucianthorr
Copy link
Author

Awesome. I'll give it a shot in virtualBox. I'll dig through some of that Oto code also. I'm trying to get a better understanding of how the lower level audio stuff works anyway.
Thanks for the feedback!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants