-
Notifications
You must be signed in to change notification settings - Fork 49
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
After upgrading to 0.10, audio quickly cuts out #116
Comments
Hm, if I bypass the subtrack and play directly to the audio manager's main track I don't experience that issue. However for some reason though the above code no longer respects the volume being set on the sample. All samples seem to be triggering at 100% volume, even if its set to 0.0. |
Ah okay, reading the release notes I see that volume units have changed from amplitude to decibels, which explains the second thing. Not sure I understand the first issue fully still but I have a workaround for now. |
One more thing I'm experiencing here - in 0.10 when I'm triggering lots of overlapping samples (with essentially the code above), I hear a high pitched buzzing at a particular frequency. My guess is that it could have something to do with the buffered sampling, but I'm not sure yet. I may resolve this one myself again, but posting here in case you know any obvious reasons :) |
I confirmed the buzzing is 344 hz which is 44100 / 128 (default buffer size), so that tracks with aliasing around the buffer hmm |
Okay, reducing the internal buffer size from 128 to 16 seemed to help. There does seem to be a bit of a tradeoff between buffer size and artifacts. I'm not sure if the artifacts are caused by the reduced precision in clock (as you mention in the release notes) or just by the buffering in the first place. It could have to do with the way I'm adding random sample offsets to avoid artifacts from triggering many samples at once every 1/60th of a second. If you happen to know of a better setup for that I would be curious to know :) |
I have to ask: why are you playing thousands of sounds per second? |
I am building a large scale ecosystem simulation that has hundreds of thousands of little critters 🙂 Lots of sounds can be triggered at this scale. One plan I had for optimization is baking multiple samples together to trigger all at once. Kira has been working great so far (thanks for open sourcing it!), and I'm surprised how many samples I can play just in the naive way. Curious to know how you might approach this particular scenario. |
Can I try the sim out? Hard to comment on anything without hearing it for myself. |
I sent you an invite to the repo! |
OK, I think the artifacts were in fact because the clocks are less precise now. I could imagine playing a lot of sounds at regular intervals creating new harmonics. |
I was suspecting that could be an issue. But also I'd think that the random offsets I'm adding which are larger than the clock precision would mitigate that. Perhaps the offsets are only a little larger and so its only partially mitigated. |
The start times are quantized to the internal buffer size in general. |
Ah that makes sense! I can probably get by using a smaller buffer size, but I wonder how hard it would to allow samples to start at an arbitrary time, perhaps by offsetting the index into the sample buffer? Not that familiar with the Kira internals yet. |
On 0.9.4, I was able to trigger thousands of short samples per second without issue. For some reason when upgrading to 0.10.1, sounds play for a very brief fraction of a second on startup and then cut out, regardless of how many samples are playing. I made only minor tweaks to satisfy the new api changes. This is what my code looks like:
No errors are logged.
The text was updated successfully, but these errors were encountered: