videokit-ai / videokit

Low-code, cross-platform media SDK for Unity Engine. Register at https://videokit.ai
https://videokit.ai
Apache License 2.0
107 stars 14 forks source link

0.0.18-alpha.6: Microphone sample data too large #106

Closed marvpaul closed 8 months ago

marvpaul commented 9 months ago

This bug also happened in 0.0.18-alpha.4. I noticed because I'm generating a FFT spectrum from the sample data I'm fetching from the microphone using your VideoKit to generate a audio reactive component. With the updated version 0.0.18-alpha.4 / 0.0.18-alpha.6 it breaks my audio reactivity. After doing some research and comparing it with the previous version of Videokit (0.0.18-alpha.2) it seems to come from extraordinary high values inside the sample buffer. I noticed two main differences:

0.0.18-alpha.2 (audio reactivity works)

0.0.18-alpha.6 (audio reactivity dosen't works)

here's a repo where I reproduced the bug with no other dependencies. The script GetSamples uses the builtin microphone and commit the samples to the method CommitSamples. I just print out sample values > 1 here.

CommitSamples

olokobayusuf commented 8 months ago

@marvpaul what platform does this happen on? I presume it's on the Unity Editor, but is it macOS or Windows?

marvpaul commented 8 months ago

@marvpaul what platform does this happen on? I presume it's on the Unity Editor, but is it macOS or Windows?

Yes, it happens in the editor on Mac OS. Strangely enough it worked as expected in 0.0.18-alpha.2. I also tested the sample project with 0.0.18-alpha.2 and it works as usual, whereas alpha.4 and alpha.6 produce those unusual high values.

olokobayusuf commented 8 months ago

I'm pretty sure I've found the cause. Will confirm and push a new alpha build for you to repro.

marvpaul commented 8 months ago

Solved in your latest alpha! 🎉

olokobayusuf commented 8 months ago

Perfect!