I am attempting to make an audio sequencer using Matrix sine square saw and noise waves using ControlP5 matrix grid of 16 x 16 to play notes according to which wave is selected in an itemlist (menu)
I would like to know if anyone can tell me how to change the colors in the blocks according to which wave I have selected.
For example, if I select "sine" in the menu, the block color of the matrix is green, if I select "saw wave" the blocks are purple etc and the blocks of the different wave types retain their color according to which wave was selected...
I have included a screen shot. I can change the block colors using:
where activeCellSIne is a color variable set to green...
but when I switch between waveforms ALL the blocks change color and I want to be able to retain the colors of the blocks determined by the wave selected...
Hi all. I am making an audio wave sequencer as part of an audio programming module at Uni.
I am using ControlP5 for the sequencer matrix (16x16) which plays notes according to the position of the matrix pointer and the placement of blocks in the matrix. I want to implement an ADSR on the waveforms. I am using the Minim library and the sine, square, saw and noise functions.
I can't use Ugens because there is a problem with Ugens and processing 2.07 on the Uni computers so I want to write a class of an ADSR (envelope generator) with Attack, decay, sustain and release controls to give more dynamism to the sounds.
I have only just started using processing so am a noob although I have some programming experience using Arduino and am concurrently learning VHDL.
I have included my code which is very messy at the moment and the example of the ADSR class is only a half arsed attempt at the moment.. The sequencer works but I can't work out how I could implement an envelope generator as an object. Has anyone attempted this before??
If so, I would love some pointers....
The code for the sequencer and the ADSR class are below:
import controlP5.*;
import ddf.minim.*;
import ddf.minim.signals.*; // new code
import ddf.minim.effects.*; // new code
//import ddf.minim.ugens.*;
import rwmidi.*;
ControlP5 gui; // new controlP5 gui instance called"gui"
ControlWindow controlWindow;
Dong[][] d;
public int temp=200;
int tem;
int note;
// public float maxamp,attack,decay,sustain,release;
int nx = 16; // x co-ord cells
int ny = 16; // y co-ord cells
float god; // public var for control outside of ....function
float fref;
float pref;
float p;
Minim minim; // new minim instance called "minim"
ADSR my_ADSR;
Knob maxA,att,dec,sus,rel; // ADSR controls
MidiInput input; // new Midiinput instance called "input"
MidiOutput output2; // new Midioutput instance called "output"
ListBox l; // new controlP5 menubox called "l"
Knob Freq; // new controlP5 Knob instance called Freq (controls pitch of wave
Knob Amp;
Knob tempo;
Slider lpfSlider; // slider for low pass cutoff
Slider bpfSlider; // slider for band pass cutoff
Slider bpfBW ; //slider for band pass bandwidth
LowPassFS lpf;
BandPass bpf;
WhiteNoise noise; // new minim instance of white noise called "noise"
SquareWave sqr1; // new minim instance of squarewave called "sqr1"
SawWave saw ; // new minim instance of sawwave called "saw"
SineWave sine; // new minim instance of sinewave called "sine"
AudioOutput out; // new minim instance of audio output called "out"
boolean noise_is_on = false; /* boolean cases for waves. not used yet.
boolean sqr_is_on = false;
boolean saw_is_on = false;
boolean sine_is_on = false;
*/
void setup() {
size(1200, 700);
minim = new Minim(this); // "minim" is a new call to open minim for use
out = minim.getLineOut(Minim.STEREO); // declaration of out as minims' line out for audio
gui = new ControlP5(this); // declaration of gui as controlP5s' gui for use
This is the sequencer code. I used the minim and controlp5 libraries, oh and Ruin wesens RW MIDI because I intend to build a wireless MIDI transmitter box to enable the user to manipulate sound parameters from afar.. :)
The start of the ADSR class is below:
class ADSR
{
int attack_time;
float decay_time;
float sustain_level;
float release_time;
ADSR () {
attack_time=50;
decay_time=70;
sustain_level=0.5;
release_time=500;
}
void setattack()
{
delay(attack_time/4);
sqr1.setAmp(0.1);
delay(attack_time/4);
sqr1.setAmp(0.2);
delay(attack_time/4);
sqr1.setAmp(0.4);
delay(attack_time/4);
sqr1.setAmp(0.6);
}
}
Any help of comments or feedback of good or bad kind welcome.