Live audio recording and playback

I'm looking to make a Snap! project that records microphone audio and plays it back, I already know of the library block, but I'm looking for something that can record audio in real time, and maybe even play it back real time.

Think of this as a devlog if you will, but you are still able to pitch in and help if you want.

sample block similarities

I've looked into the microphone samples block and the samples of an imported sound, and I think I see some similarities, I don't know how audio in Snap! works, so this is just a guess, but the audio samples block and the microphone samples block seem to report the same numbers.

I actually threw something together and it works awesome, well, better than I was expecting at least. It actually produced normal human sound, the only problems are that it just sounds slightly robotic and plays too fast.
sound recorder script pic
I'm gonna be fully honest, I wasn't expecting such good results so early on.

For the sample rate, you should set it to 1000280155 instead of a fixed 48000

I released a project with what I've done so far.

I added that there, It didn't really come across my mind.

Maybe try doing this?
Screenshot 2024-01-02 210539

Screenshot 2024-01-02 210549

I set it to high and it played at a normal speed! Well, it's just slightly off but I ain't no choosing beggar.

By the way, here's the updated code.
sound recorder script pic

I just had a thought about how you could make the script even better. The sample rate is the number of samples per second, and the microphone resolution (in the microphone block) is the number of samples captured by the microphone samples block. You could use this information to determine how long you should wait before recording new samples.


Don't necro


live audio t1 script pic
bett, heres the answer

doesnt work so well. i was thinking there should be a way to convert live audio into some sort of data