
setModulator()
Purpose
Set audio modulator
Description
Set a modulator on an audio channel
Syntax
setModulator( channel, wave, frequency, scale )Arguments
channel audio channel from 0 to 15
wave wave type (0 = Square, 1 = Saw, 2 = Triangle, 3 = Sine, 4 = Noise )
frequency frequency 10Hz to 20Khz (10 - 20000)
scale modulator scale
Example
waveType = [ "Square", "Saw", "Triangle", "Sine", "Noise" ]
w = 0
press = false
modFreq = 0
modScale = 0
playNote( 0, 3, 432, 1, 0, 0.5 )
loop
    clear()
    c = controls( 0 )
    if c.right and !press then
        w += 1
        press = false
    endIf
    if c.left and !press then
        w -= 1
        press = false
    endIf
    if !c.right and !c.left then
        press = false
    endIf
    modFreq += c.ly
    modScale += c.ry
    w = clamp( w, 0, 4 )
    modFreq = max( modFreq, 0 )
    modScale = max( modScale, 0 )
    setModulator( 0, w, modFreq, modScale )
    printAt( 0, 0, "Press left or right directional buttons to change modulation wave type" )
    printAt( 0, 1, "Wave Type: " + waveType[w] )
    printAt( 0, 3, "Move the left control stick up or down to adjust modulation frequency" )
    printAt( 0, 4, "Modulation Frequency: " + modFreq )
    printAt( 0, 6, "Move the right control stick up or down to adjust modulation scale" )
    printat( 0, 7, "Modulation Scale: " + modScale )
    update()
repeatAssociated Commands
audioLength(), getChannelStatus(), loadAudio(), note2Freq(), playAudio(), playNote(), setClipper(), setFilter(), setPan(), setVolume(), startChannel(), stopChannel()