Record a monophonic 16-bit PCM sound into either memory space, a file or array.

(This task neglects to specify the sample rate, and whether to use signed samples.
The programs in this page might use signed 16-bit or unsigned 16-bit samples, at 8000 Hz, 44100 Hz, or any other sample rate.
Therefore, these programs might not record sound in the same format.)

begin_funct({wav}, Record sound);
    set_decision(linger);
    find_thing()_first()_microphone()_bitrate(16)_tech(PCM)_samplerate(signed16, unsigned16)_rangefrom(8000, Hz)_rangeto(44100, Hz)_export(.wav)
        ? with_found()_microphone()_label(mic);
        : err_funct[]_err(Sorry, no one has a microphone!);
          exit_funct[];
    ;
    with_microphone[mic]_record()_durat({secs}, 30)_var(recording);
    [Record sound]_ret([recording]);
    reset_decision();
end_funct[];
 
// Record a monophonic 16-bit PCM sound into memory space:
exec_funct(Record sound)_var(PCMRecording)_me();         // The variable 'PCMRecording' is the sound in memory space
 
// Record a monophonic 16-bit PCM sound into a file or array:
exec_funct(Record sound)_file(foo.wav)_me();         // The file 'foo.wav' is the sound in a file