Capture Sound via a Script?

A sound can be manually recorded by using the controls in the sound recorder.

Is it possible to capture a sound generated with a Snap! sound block (such as Play Note) via a script?

image

the only way that I know of is setting your microphone to the sound mixer, which I have right now, so it records your computer audio.

What about untitled script pic?

So I clearly don't understand how to use this block.
Play Note followed by Set Sound Sample to Microphone Samples just results in an empty list. What am I overlooking?

image

Currently I can trigger the note / sound in Snap! and capture the sound in a separate window with Audacity, but I would like to do this all in Snap!

The launch block

PLAY NOTE FOR _BEATS doesn't go on to the next command until it's done playing. @18001767679 correctly suggests that putting the PLAY in a LAUNCH would work. Alternatively, PLAY FREQUENCY down at the bottom of the Sounds palette will keep playing until you tell it to STOP FREQUENCY.

The Launch block did capture a sound sample. The amplitude was low, but that could possibly be addressed by moving the mic closer to the speaker. The more significant limitation is that the sound captured is only 512 samples. With a sampling rate of 48,000 samples per second, that is a significant constraint. Is there a way to increase the sample size? (Thanks)

image

Settings > Microphone resolution. (Yes, "resolution" is a funny name for it; it's a long story.)