Skip to content

add a noise parameter#13

Open
leontoddjohnson wants to merge 1 commit intoschollz:mainfrom
leontoddjohnson:main
Open

add a noise parameter#13
leontoddjohnson wants to merge 1 commit intoschollz:mainfrom
leontoddjohnson:main

Conversation

@leontoddjohnson
Copy link

This will just incorporate a noise parameter into the engine; based loosely on the one from the fall engine.

I've tested this out several times at home, and performed with it twice with no problems so far!

@schollz
Copy link
Owner

schollz commented Mar 21, 2026

@leontoddjohnson looks great!!! Only concern is how much it reduces max polyphony? Pink noise is expensive from what I remember

@leontoddjohnson
Copy link
Author

Ah, good point, and good question! I'm not sure, though ... For whatever it's worth, I have been using this update with tutti, and I haven't run into any latency issues at all, even with running noise on up to 12 voices at once (i.e., 3 "sustained" re-triggers across 4 instruments, simultaneously). It looks like you mention up to 14 voices (pushing 20), so maybe the reduction in polyphony isn't too bad?

@sonocircuit
Copy link

the addition of noise is really cool. I believe max polyphony is 40 voices right now. One thing that is less expensive is using a buffer with noise and playing back from a random position. I adopted this technique from double-decker and you can find it in nb_tonic. One could implement a function that approximates the pink noise/dust mix and use that to fill a buffer.

@leontoddjohnson
Copy link
Author

leontoddjohnson commented Mar 23, 2026

Oh! Cool idea!

Also, thank you for the clarification on polyphony. Should we add a note about this number on the lines thread? Right now, it reads like the maximum is 14-20 voices, unless I'm missing something ...

I will just need to try this thing out with the noise as I have it, and see how it performs at the 40-voice (ish) range. If there are no issues, then I will report back. If there are issues, then I can just continue to keep the fork separate (i.e., close the pull request without merging), and I'll adjust dependent scripts to only use the noise parameter if it's available in the engine.

If I get a chance later down the road, I will try out the "noise buffer" idea, and maybe re-create a pull request ... That is a super helpful tip that I could use in other scripts, too!

@schollz
Copy link
Owner

schollz commented Mar 23, 2026

Yeah I was going to suggest the noise buffer too! Honestly you could just record the output of the PinkNoise+Dust to a .wav file and then have a PlayBuf to play it from a random position, like @sonocircuit suggests. Its like trading disk space (there is TONS) for CPU (there is little).

Also my measurements I think were using a Raspberry Pi 4? It definitely depends on the device...I'd try it with the least powerful one you have.

@leontoddjohnson
Copy link
Author

Gotcha, I'll give it a shot. TBDeeee ...

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.

3 participants