Record sound: Difference between revisions
sort
(Added FreeBASIC) |
(sort) |
||
Line 273:
(play (record 65536))
</syntaxhighlight>
=={{header|Diego}}==▼
This <code>funct</code>ion returns a <code>{wav}</code> variable recorded from a thing in the mist. It understands that the found <code>thing</code> has a microphone, so will have microphone knowledge. If the caller does not have microphone knowledge, the callee will train the caller on first request.▼
<syntaxhighlight lang="diego">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</syntaxhighlight>▼
This is the <code>instruct</code>ion version, where the thing keeps the recording.▼
<syntaxhighlight lang="diego">begin_instruct(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()_label(recorder)_microphone()_label(mic);▼
: err_instruct[]_err(Sorry, no one has a microphone!);▼
exit_instruct[];▼
;▼
with_microphone[mic]_record()_durat({secs}, 30)_var(recording);▼
reset_decision();▼
end_instruct[];▼
// Record a monophonic 16-bit PCM sound into memory space:▼
exec_instruct(Record sound)_me();▼
with_thing[recorder]_microphone[mic]_var[recording]_var(PCMRecording); // The variable 'PCMRecording' is the sound in memory space▼
// Record a monophonic 16-bit PCM sound into a file or array:▼
exec_instruct(Record sound)_me();▼
with_thing[recorder]_microphone[mic]_var[recording]_file(foo.wav)_me(); // The file 'foo.wav' is the sound in a file</syntaxhighlight>▼
=={{header|FreeBASIC}}==
Line 396 ⟶ 436:
fmt.Println("Play-back completed.")
}</syntaxhighlight>
▲=={{header|Diego}}==
▲This <code>funct</code>ion returns a <code>{wav}</code> variable recorded from a thing in the mist. It understands that the found <code>thing</code> has a microphone, so will have microphone knowledge. If the caller does not have microphone knowledge, the callee will train the caller on first request.
▲<syntaxhighlight lang="diego">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</syntaxhighlight>
▲This is the <code>instruct</code>ion version, where the thing keeps the recording.
▲<syntaxhighlight lang="diego">begin_instruct(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()_label(recorder)_microphone()_label(mic);
▲ : err_instruct[]_err(Sorry, no one has a microphone!);
▲ exit_instruct[];
▲ ;
▲ with_microphone[mic]_record()_durat({secs}, 30)_var(recording);
▲ reset_decision();
▲end_instruct[];
▲// Record a monophonic 16-bit PCM sound into memory space:
▲exec_instruct(Record sound)_me();
▲with_thing[recorder]_microphone[mic]_var[recording]_var(PCMRecording); // The variable 'PCMRecording' is the sound in memory space
▲// Record a monophonic 16-bit PCM sound into a file or array:
▲exec_instruct(Record sound)_me();
▲with_thing[recorder]_microphone[mic]_var[recording]_file(foo.wav)_me(); // The file 'foo.wav' is the sound in a file</syntaxhighlight>
=={{header|GUISS}}==
|