Name
SaveSample -- save sample to disk (V5.0)
Synopsis
SaveSample(id, f$[, fmt, t])
Library
sound

Function
This command saves the sample specified in id to the file specified in f$. The optional argument fmt specifies the format in which the sample should be exported. By default, Hollywood supports the following two sound formats:

#SNDFMT_WAVE:
Use the RIFF WAVE format. This is the default.

#SNDFMT_SVX:
Use the IFF 8SVX (8-bit) or IFF 16SV (16-bit) format. (V11.0)

Additional sound formats can be made available by plugins.

Starting with Hollywood 10.0, SaveSample() accepts an optional table argument that allows you to pass additional arguments to the function. The following tags are currently supported by the optional table argument:

Bitrate:
If the file format specified in the outfmt argument 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. (V11.0)

Quality:
If the file format specified in the outfmt argument 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. (V11.0)

Adapter:
This tag allows you to specify one or more file adapters that should be asked if they want to save the specified file. If you use this tag, you must set it to a string containing the name(s) of one or more adapter(s). Defaults to the adapter set using SetDefaultAdapter(). See Loaders and adapters for details. (V10.0)

UserTags:
This tag can be used to specify additional data that should be passed to loaders and adapters. If you use this tag, you must set it to a table of key-value pairs that contain the additional data that should be passed to plugins. See User tags for details. (V10.0)

Inputs
id
identifier of sample to save
f$
path to save location
fmt
optional: format in which to export the sample (defaults to #SNDFMT_WAVE)
t
optional: table containing further options (see above) (V10.0)
Example
@SAMPLE 1, "ouch.8svx"

SaveSample(1, "ouch.wav")
The code above loads a sample in the IFF 8SVX format and saves it as a RIFF WAVE sample.

Show TOC