setFilter()
Purpose
Set audio filter
Description
Applies a filter to the given audio channel
Syntax
setFilter( channel, type, cutoff )
Arguments
channel audio channel from 0 to 15
type off (0), lowpass (1) - all frequencies above cutoff cut, highpass (2) - all frequencies below cut
cutoff frequency at which the filter is applied
Example
tune = loadAudio( "David Silvera/music_disco_funky" )
type = 0
lowpass = 1
highpass = 2
cutoff = 200
press = false
playAudio( 0, tune, 1, 0.5, 1, -1 )
loop
clear()
c = controls( 0 )
if c.a and !press then
type = lowpass
endIf
if c.b and !press then
type = highpass
endIf
if !c.a and !c.b then
press = false
endIf
cutoff += c.ly * 10
cutoff = max( cutoff, 0 )
setFilter( 0, type, cutoff )
printAt( 0, 0, "Move the control stick up and down to adjust filter cutoff frequency" )
printAt( 0, 2, "Press the A button to select low-pass filter" )
printAt( 0, 3, "Press the B button to select high-pass filter" )
printAt( 0, 5, "Filter cutoff frequency: " + cutoff )
printAt( 0, 6, "Filter type: " + type )
update()
repeat
Associated Commands
audioLength(), getChannelStatus(), loadAudio(), note2Freq(), playAudio(), playNote(), setClipper(), setPan(), setVolume(), startChannel(), stopChannel()