Skip to content

Updated white noise algorithm #29

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

grrrr
Copy link

@grrrr grrrr commented Apr 23, 2025

Hi,
the AudioSynthNoiseWhite_F32 class in master does not work for me at all.
I have reimplemented the class using a lean algorithm from Puredata.

@boblark
Copy link
Collaborator

boblark commented Apr 24, 2025

You are right. It would not function in a pure F32 Audio. Turns out that was converted to this library when we had no F32 input classes, so there was always some I16 memory. I will get back on the pull request, but for now, just add
AudioMemory(1); in your setup and it should run fine. This is just a temporary fix. Bob
(Also, note that there is a AudioSynthGaussian_F32 class that is also white noise, but has a Gaussian distribution. The one you have been working with has a white spectrum and a uniform distribution. Both are useful, but check which you want.)

@grrrr
Copy link
Author

grrrr commented Apr 25, 2025

Thank you, the missing memory explains it – i am still new to Teensy audio.
However, given that F32 relies on floating point machinery anyway, i think that parts of the code from the past could really need some overhaul.

@boblark
Copy link
Collaborator

boblark commented Apr 26, 2025

Yes, some of the original classes were straight I16 to F32 conversions. In this case, it has produced an interesting problem that the resulting output only takes 65536 different values, whereas the 24-bit mantissa of the F32 can express 256 times that many. The dilemma is that somebody may already be using the class and if we fix the problem, their output data can change. So, I propose we only fix the I16 memory problem for this class and then create a new F32 class that produces a uniform distribution at 24-bit level. We leave a note behind, suggesting the old class not be used. The pink noise probably has this same problem, I have not looked.
Anybody have thoughts on this?

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.

2 participants