[↑]
SmileBASIC4 Replica Reference
WAVSETA
1. Set the instrument sound waveform

WAVSETA InstrumentNumber,Attack,Decay,Sustain,Release,Array[,ReferencePitch][,WaveStart][,WaveEnd]

・Version 3 compatibility mode
・Depending on sample length and reference pitch, correct pitch may not be produced.

Arguments

InstrumentNumber

Instrument number for setting the waveform: 224 to 255

Attack

Time to increase the volume to maximum: 0 to 127 (faster as the value increases)

Decay

Time until the volume decreases from the maximum value and becomes constant: 0 to 127 (faster as the value increases)

Sustain

Volume when extending the sound: 0 to 127 (louder as the value increases)

Release

Time until volume decreases to 0: 0 to 127 (faster as the value increases)
・When the release is set to 0, the playback sound cannot be stopped with BGMSTOP, but it can be forcibly stopped with the SNDSTOP command.

Array

A 1D array containing waveforms
・One element is treated as one sample of 8 bits. (128 is subtracted and treated as a value of -128 to 127)

ReferencePitch

Specify the note number of the pitch of the defined waveform.

・The default is 69 ("O4A": A of octave 4).

WaveformStart

Specify the index of the top position of the waveform.

・0, if not specified.

WaveformEnd

Specify the index of the end position of the waveform.

・If not specified, it'll be the end of the array.

Example

DIM W[2048]
WAVSETA 224,127,0,0,127,W,69,0,2047
BGMPLAY "@224O4A1" 
2. Set the instrument sound waveform

WAVSETA InstrumentNumber,Attack,Decay,Sustain,Release,Array,ReferencePitch,LoopStart,LoopEnd,SampleFrequency[,Offset][,BEEPLoopFlag]

・Accommodates waveforms as long as the sound memory capacity allows (at a sample frequency of 48000Hz for about 80 seconds)
・Loop setting and sample frequency can be specified.
・Depending on the sample length, reference pitch, and sample frequency, the correct pitch may not be produced.

Arguments

InstrumentNumber

Instrument number for setting the waveform: 224 to 255

Attack

Time to increase the volume to maximum: 0 to 127 (faster as the value increases)

Decay

Time until the volume decreases from the maximum value and becomes constant: 0 to 127 (faster as the value increases)

Sustain

Volume when extending the sound: 0 to 127 (louder as the value increases)

Release

Time until volume decreases to 0: 0 to 127 (faster as the value increases)
・When the release is set to 0, the playback sound cannot be stopped with BGMSTOP, but it can be forcibly stopped with the SNDSTOP command.

Array

A 1D array containing waveforms
・One element is treated as one signed 16-bit sample.

ReferencePitch

The note number of the pitch of the defined waveform

・The default is 69 ("O4A": A of octave 4).

LoopStart

The index of the top position of the loop of the waveform (with offset)

・0, if not specifiied.

LoopEnd

The index of the loop end position of the waveform (with offset)

・If not specified, it'll be the end of the array.

SampleFrequency

Waveform sample frequency (in Hz): 1 to 96000

・The default is 28160.

Offset

The index of the reference start position of the array

・0, if not specified.

BEEPLoopFlag

Specify whether to loop when playing waveform in BEEP

・0, if not specified (does not loop).

Example

DIM W[2048]
WAVSETA 224,127,0,0,127,W,69,1024,2047,44100,0,#false
BGMPLAY "@224O4A1" 
About this site
Our site is an unofficial manual site of programming software "SmileBASIC" for NintendoSwitch™.
I acquire the content of the site from the official reference site of the SmileBoom Co.Ltd. that is the development and sales cause of the software in real time (a minimum period of 24 hours update) and display it. For automatic update, contents may become improper.
Please confirm the correct content in an official site.

June 3, 2020
by mim
OK
|