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

Reduce audio stuttering by running background tasks #2135

Merged
merged 5 commits into from
Sep 13, 2019

Conversation

jepler
Copy link
Member

@jepler jepler commented Sep 10, 2019

This improves the situation where background tasks are starved by

  • bulk I/O (.read())
  • listdir
  • printing

Testing performed: Using nRF I2S audio (not yet in master) I started a 22050Hz, mono, 16-bit sample running in a loop and then ran the reproducers at the REPL:
while True: os.listdir('.')
while True: len(open('somefile.wav').read())

This reduced the amount of buffering in I2S audio required to not hear stuttering from ~200ms to 16m, as reflected in the current state of #2127.

This may be related to #470, or then again it may not.

While finding sources of clicks and buzzes in nrf i2sout, I identified
this site as one which could be long running.  Reproducer code was to
play a 22.05kHz sample and repeatedly print `os.listdir('')`
While finding sources of clicks and buzzes in nrf i2sout, I identified
this site as one which could be long running.  Reproducer code was to
play a 22.05kHz sample and repeatedly print `os.listdir('')`
While finding sources of clicks and buzzes in nrf i2sout, I identified
this site as one which could be long running.  Reproducer code was to
play a 22.05kHz sample and repeatedly print `os.listdir('')`
@tannewt
Copy link
Member

tannewt commented Sep 10, 2019

Interesting! Please take a look at the test failure and fix it. Thanks!

@jepler
Copy link
Member Author

jepler commented Sep 12, 2019

@tannewt weird failures with the next CI run ... more rate limits being hit?

##[warning]Failed to download action 'https://api.github.com/repos/actions/setup-python/tarball/v1'. Error Response status code does not indicate success: 401 (Unauthorized).
##[warning]Back off 28.517 seconds before retry.
##[error]Response status code does not indicate success: 401 (Unauthorized).

@tannewt
Copy link
Member

tannewt commented Sep 12, 2019

No, idea. I filed an issue about it: actions/setup-python#21 Ping there if you see it again.

I tried to re-run the checks but it might need a newer merge to test due to actions/checkout#23

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt tannewt merged commit 157429f into adafruit:master Sep 13, 2019
@jepler jepler deleted the audio-stuttering-background branch November 3, 2021 21:09
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.

None yet

2 participants