An audio_recorder records from the default audio input, normally the
microphone, into its audio_recorder<-sound,
a mono 16-bit sound of 44100 samples per second. While recording, audio_recorder<-level_message
is executed regularly (about 40 times per second) with the recorder and
the input level, a number between 0 and 1:
new(R, audio_recorder(message(Meter, value, @arg2))), send(R, record), ... send(R, stop), get(R, sound, Sound), send(Sound, save, 'recording.wav').
Given a sink, audio_recorder->record
writes the samples to it while recording rather than into audio_recorder<-sound.
A file becomes a WAV file; any other
source_sink gets the raw samples (audio_recorder<-format, audio_recorder<-frequency
and
audio_recorder<-channels)
using source_sink->write_as_file and
source_sink->close_as_file
when recording stops:
send(R, record, file('recording.wav'))
The system may ask the user for permission to use the microphone.
|video_writer*->record
writes the samples, or @nil
if it records into
audio_recorder<-sound.
|video_writer]to, this replaces the audio of
audio_recorder<-sound.
Otherwise the samples are written to to while recording, as
described above. If to is a video_writer, the samples are
added to its audio using video_writer->append_audio.
If the video_writer has no audio yet, it gets an audio track with the
frequency and channels of the recorder.s16, signed 16-bit in
native byte order.