// sound file "1.wav" => string filename; if( me.args() ) me.arg(0) => filename; // the patch SndBuf buf => BPF bpf => Gain g => dac; 5 => buf.chunks; 1000 => bpf.freq; 5 => bpf.Q; 0 => buf.rate; 0 => buf.freq; 1 => buf.loop; // maui elements MAUI_View control_view; MAUI_Button play_clip; MAUI_Button listen_adc; MAUI_Slider volume_slider; MAUI_Slider rate_slider; MAUI_Slider freq_slider; MAUI_Slider bpf_slider; // set view control_view.size( 400, 275 ); control_view.name( "Sound Control" ); // button (play_clip) play_clip.pushType(); play_clip.size( 100, 80 ); play_clip.position( 0, 0 ); play_clip.name( "CLIP" ); control_view.addElement( play_clip ); // latch button listen_adc.toggleType(); listen_adc.size( play_clip.width(), play_clip.height() ); listen_adc.position( 300, 0 ); listen_adc.name( "ADC" ); control_view.addElement( listen_adc ); // volume volume_slider.range( 0, 5 ); volume_slider.size( 200, volume_slider.height() ); volume_slider.position( 200, 200 ); volume_slider.value( g.gain() ); volume_slider.name( "Gain" ); control_view.addElement( volume_slider ); // rate rate_slider.range( 0, 1 ); rate_slider.size( 200, rate_slider.height() ); rate_slider.position( 0, 135 ); rate_slider.value( buf.rate() ); rate_slider.name( "Rate" ); control_view.addElement( rate_slider ); // loop freq_slider.range( 0, 2 ); freq_slider.size( 200, freq_slider.height() ); freq_slider.position( 0, 200 ); freq_slider.value( buf.freq() ); freq_slider.name( "Freq" ); control_view.addElement( freq_slider ); // bpf bpf_slider.range( 0, 10000 ); bpf_slider.size( 400, bpf_slider.height() ); bpf_slider.position( 0, 75 ); bpf_slider.value( bpf.freq() ); bpf_slider.name( "BPF" ); control_view.addElement( bpf_slider ); control_view.display(); function void playClip() { while( true ) { play_clip => now; filename => buf.read; } } function void listenAdc() { while( true ) { listen_adc => now; adc => g; listen_adc => now; adc =< g; } } function void controlGain() { while( true ) { volume_slider => now; volume_slider.value() => g.gain; } } function void rate() { while( true ) { rate_slider => now; rate_slider.value() => buf.rate; } } function void freq() { while( true ) { freq_slider => now; freq_slider.value() => buf.freq; } } function void band() { while( true ) { bpf_slider => now; bpf_slider.value() => bpf.freq; } } spork ~ playClip(); spork ~ listenAdc(); spork ~ controlGain(); spork ~ rate(); spork ~ freq(); spork ~ band(); while( true ) 1::day => now;