User Tools

Site Tools


cs276:a16:tgc-lab4

Mirror Lab

{{:cs276:a16:screen_shot_2016-10-04_at_4.10.52_pm.png|

Example by Krister Olsson Modifications due to spc

import krister.Ess.*;

AudioChannel myChannel, channel2; SineWave myWave, wave2; Silence mySilence; void setup() {

size(256,200);

start up Ess Ess.start(this); create a new AudioChannel

myChannel=new AudioChannel();
channel2 = new AudioChannel();

set the channel size to 6 seconds myChannel.initChannel(myChannel.frames(8000)); generate 3 seconds of a soft sine wave

myWave=new SineWave(480, 0.5);
wave2 =new SineWave(480*2, 0.1);

mySilence=new Silence();
mySilence.fill=50;
mySilence.generate(myChannel,myChannel.frames(0),myChannel.frames(2000));

myWave.generate(myChannel, myChannel.frames(2000), myChannel.frames(3000));

mySilence.generate(myChannel,myChannel.frames(5000),myChannel.frames(1000));

wave2.generate(myChannel, myChannel.frames(6000), myChannel.frames(2000));
// generate 2 more seconds of the sine wave
// starting at offset 4 seconds into the audio stream
wave2.generate(myChannel, Ess.ADD, myChannel.frames(2000), myChannel.frames(3000));

play myChannel.play(); } void draw() { } we are done, clean up Ess

public void stop() {

Ess.stop();
super.stop();

}

cs276/a16/tgc-lab4.txt · Last modified: 2016/11/10 14:46 by tom311