HackerPoet / FractalSoundExplorer

Explore fractals in an audio-visual sandbox
MIT License
1.13k stars 132 forks source link

Audio glitches when dragging mouse #4

Open PeterNerlich opened 3 years ago

PeterNerlich commented 3 years ago

I'm coming straight from the YT video and haven't even tried the program yet. Ignore this should it not apply any longer, though I'd be surprised if this is the case.

When dragging the mouse over different areas to see hear how the tone progressively changes small pops occur. I propose the theory that this is happening because when the location changes, the tone is sampled and played from the first iteration on, making the distance to the previous point (and thus the amplitude change imposed on the speakers) significantly larger than the previous and subsequent point pairs.

I propose to instead search ahead a few iterations on every location change and try to find a sufficiently close point to the would-be successor from the original series of points. Since we work with cyclic series and this is only intended for minute changes of a few pixels at worst, I suspect this might work out just fine. "sufficiently close" could be something like within half the distance between the last played sample and its would-be successor of the original series.

jwosty commented 3 years ago

A simpler solution could be to crossfade between the old point and the new point with a really small fade time; even a few milliseconds would do the trick. It would get rid of all those pops.

PeterNerlich commented 3 years ago

Yes, that would work, too. Though I expect audio engineers or other people with trained ears to notice an irregularity through that when continually dragging the more to explore the changes. But there's a good chance that's just my unreflected perfectionism speaking :grin: