use of net.beadsproject.beads.ugens.BiquadFilter in project narchy by automenta.
the class drum_machine_01 method setup.
// construct the synthesizer
public void setup() {
AudioContext ac = new AudioContext();
// set up the envelope for kick gain
kickGainEnvelope = new Envelope(ac, 0.0f);
// construct the kick WavePlayer
kick = new WavePlayer(ac, 100.0f, WaveFactory.SINE);
// set up the filters
kickFilter = new BiquadFilter(ac, BiquadFilter.BESSEL_LP, 500.0f, 1.0f);
kickFilter.in(kick);
// set up the Gain
kickGain = new Gain(ac, 1, kickGainEnvelope);
kickGain.in(kickFilter);
// connect the gain to the main out
ac.out.in(kickGain);
// set up the snare envelope
snareGainEnvelope = new Envelope(ac, 0.0f);
// set up the snare WavePlayers
snareNoise = new WavePlayer(ac, 1.0f, WaveFactory.NOISE);
snareTone = new WavePlayer(ac, 200.0f, WaveFactory.SINE);
// set up the filters
snareFilter = new BiquadFilter(ac, BiquadFilter.BP_SKIRT, 2500.0f, 1.0f);
snareFilter.in(snareNoise);
snareFilter.in(snareTone);
// set up the Gain
snareGain = new Gain(ac, 1, snareGainEnvelope);
snareGain.in(snareFilter);
// connect the gain to the main out
ac.out.in(snareGain);
// set up the keyboard input
// MidiKeyboard keys = new MidiKeyboard();
// keys.addActionListener(new ActionListener(){
// @Override
// public void actionPerformed(ActionEvent e)
// {
// // if the event is not null
// if( e != null )
// {
// // if the event is a MIDI event
// if( e.getSource() instanceof ShortMessage)
// {
// // get the MIDI event
// ShortMessage sm = (ShortMessage)e.getSource();
//
// // if the event is a key down
// if( sm.getCommand() == MidiKeyboard.NOTE_ON && sm.getData2() > 1 )
// keyDown(sm.getData1());
// // if the event is a key up
// else if( sm.getCommand() == MidiKeyboard.NOTE_OFF )
// keyUp(sm.getData1());
// }
// }
// }
// });
ac.start();
Util.sleep(100000L);
}
Aggregations