buggy behaviour in part.onStep()
See original GitHub issuethe pattern below has 8 beats, play() is called 8 times but part.onStep
is called 7 times.
When the part is looping, part.onStep
is still only called 7 times.
let sound, m = 0, n = 0;
function setup () {
masterVolume(0.4);
const pat = [1,1,1,1,1,1,1,1];
const phrase = new p5.Phrase('phrase', play, pat);
const part = new p5.Part();
part.onStep(() => {
console.log(`step ${++n}`);
});
part.addPhrase(phrase);
part.setBPM(60);
part.start();
// part.loop();
sound = new p5.MonoSynth();
userStartAudio().then(() => {
console.log("user start audio");
});
}
function draw () {
background(0);
}
function play (time, notused) {
console.log(`play ${++m}`);
sound.play('D4');
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Rotation is buggy #2 - Saiyato/volumio-rotary-encoder-plugin
Hi, I managed to get the plugin working, but the behaviour is very erratic. Sometimes it raises the volume, sometimes it lowers it...
Read more >Who's afraid of a big bad optimizing compiler? - LWN.net
These cannot possibly all be buggy, can they? Answer. However, the remainder of this article will assume properly aligned and machine-word-sized accesses, in ......
Read more >Suspension Design and testing of an All-Terrain Vehicle using ...
The essential parameters were identified to model the suspension system, both front and rear of a Baja Buggy. The designing was performed ...
Read more >THE JOEL TEST quick note: 12 STEPS TO BETTER CODE
complete steps to reproduce the bug; expected behaviour; observed (buggy) behaviour; who handle it; whether it has been fixed or not.
Read more >I made a coding error which caused a big production issue ...
Every programmer writes buggy code at some point. ... I had a function called barx(), and I wasn't sure it was being called...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just checked with p5.js 1.0.0 and the problem still persists.
The expected behavior in the example above would be: part.onStep should be called 8 times.
Using part.loop() instead of part.start(), part.onStep should be called 8 times for each loop as long as it is looping.
Hi, the above code was my program demonstrating the problem.