RecordAudio(file$, length[, table])
file$. The length parameter must be
set to the desired recording length in milliseconds. For example, to record
10 seconds of audio pass 10000 in the length parameter.
The optional table argument table allows you to configure further parameters
of the recording operation. The following tags are currently recognized in
the table argument:
Frequency:
Channels:
Bits:
Format:file$.
Note that on slower systems like 68k AmigaOS 3 it's recommended to use an
output audio format that doesn't use any compression (e.g. uncompressed RIFF WAVE)
to make sure the file saver can keep up with the audio recorder and there is
no buffer underrun. Thus, on slower systems you could first record to an
uncompressed RIFF WAVE file and then convert this file to a compressed audio
format using SaveMusic() after recording has finished. By default, Hollywood
supports the following two sound formats:
#SNDFMT_WAVE:
#SNDFMT_SVX:Additional sound formats can be made available by plugins.
Bitrate:Format tag supports audio compression
using a specific bitrate, this tag can be used to specify that bitrate.
For the #SNDFMT_WAVE and #SNDFMT_SVX formats this tag doesn't have any effect.
Quality:Format tag supports audio compression
using a specific quality setting, this tag can be used to specify that quality.
For the #SNDFMT_WAVE and #SNDFMT_SVX formats this tag doesn't have any effect.
Throttle:RecordAudio() will throttle itself to avoid consuming 100% of
the CPU cycles. On very slow systems (e.g. 68k AmigaOS 3), however, this
throttle could lead to a decline in performance. If that is the case, you
can set this tag to False to tell RecordAudio() not to throttle anything.
Defaults to True.
Async:True, RecordAudio() will operate in asynchronous mode. This means that
it will return immediately, passing an asynchronous operation handle to you. You can then
use this asynchronous operation handle to finish the operation by repeatedly calling
ContinueAsyncOperation() until it returns True. This is
very useful in case your script needs to do something else while the operation is in progress,
e.g. displaying a status animation or something similar. By putting RecordAudio() into asynchronous
mode, it is easily possible for your script to do something else while the operation is
being processed. See ContinueAsyncOperation for details. Defaults to False.
Adapter:
UserTags:
Note that on AmigaOS and compatibles audio recording requires exclusive access to the
audio hardware so if you've accessed the audio hardware before you need to call CloseAudio()
to shut it down first before you can call RecordAudio() and of course no other programs that
are using the audio hardware may be running when you call RecordAudio() on Amiga.
RecordAudio("test.wav", 10000, {Channels = 1})
The code above records 10 seconds worth of audio data and saves them to the
file test.wav. The audio data will be recorded in 44.1khz, 16-bit mono
format.