Stutter and lag when playing multiple samples repeatedly · Issue #74 · processing/processing-sound (original) (raw)
Navigation Menu
- GitHub Copilot Write better code with AI
- GitHub Models New Manage and compare prompts
- GitHub Advanced Security Find and fix vulnerabilities
- Actions Automate any workflow
- Codespaces Instant dev environments
- Issues Plan and track work
- Code Review Manage code changes
- Discussions Collaborate outside of code
- Code Search Find more, search less
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
When using SoundFile class and triggering samples repeatedly it will start to stutter eventually. This is not happening in another audio library - Beads. Also reported here: https://discourse.processing.org/t/sound-library-bugs-lagging-noise-choppy/4718 Example code below:
import processing.sound.*;
int timer;
SoundFile[] file = new SoundFile[5];
void setup() {
size(640, 480);
background(0);
for (int i=0; i<file.length; i++) {
file[i] = new SoundFile(this, "http://soundbible.com/grab.php?id=1705&type=wav" );
}
timer = millis();
frameRate(30);
}
int numplays = 0;
void draw() {
//around 800-1100 plays it will start to stutter
if (numplays<1000) {
if (millis() > timer + 20 ) {
int i = (int)random(0, file.length);
file[i].play();
numplays++;
println(numplays);
timer = millis();
}
}
}