Mercurial > hg > cmdp
diff src/uk/ac/qmul/eecs/depic/daw/beads/sonification/AutomationSound.java @ 0:3074a84ef81e
first import
author | Fiore Martin <f.martin@qmul.ac.uk> |
---|---|
date | Wed, 26 Aug 2015 16:16:53 +0100 |
parents | |
children | c0412c81d274 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/uk/ac/qmul/eecs/depic/daw/beads/sonification/AutomationSound.java Wed Aug 26 16:16:53 2015 +0100 @@ -0,0 +1,76 @@ +/* + Cross-Modal DAW Prototype - Prototype of a simple Cross-Modal Digital Audio Workstation. + + Copyright (C) 2015 Queen Mary University of London (http://depic.eecs.qmul.ac.uk/) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +package uk.ac.qmul.eecs.depic.daw.beads.sonification; + +import net.beadsproject.beads.core.AudioContext; +import net.beadsproject.beads.core.UGen; +import net.beadsproject.beads.core.UGenChain; +import net.beadsproject.beads.data.Buffer; +import net.beadsproject.beads.ugens.BiquadFilter; +import net.beadsproject.beads.ugens.Function; +import net.beadsproject.beads.ugens.Noise; +import net.beadsproject.beads.ugens.TapIn; +import net.beadsproject.beads.ugens.TapOut; +import net.beadsproject.beads.ugens.WavePlayer; + +public class AutomationSound extends UGenChain { + private WavePlayer sinOsc; + private UGen noise; + private BiquadFilter highPass; + private Function add; + private TapIn delayIn; + private TapOut delayOut; + + public AutomationSound(AudioContext ac) { + super(ac, 0, 2); + + /* create ugens */ + sinOsc = new WavePlayer(ac,0.0f,Buffer.SINE); + noise = new Noise(ac); + highPass = new BiquadFilter(ac,1); + delayIn = new TapIn(ac,10f); + delayOut = new TapOut(ac,delayIn,0.01f); + + + /* configure ugens */ + sinOsc.setFrequency(noise); + sinOsc.setPhase(-0.35f); + + highPass.setType(BiquadFilter.BESSEL_HP); + highPass.setFrequency(2000); + highPass.setQ(3.25f); + + /* connect ugens */ + delayIn.addInput(sinOsc); + add = new Function(delayOut,sinOsc){ + @Override + public float calculate() { + return x[0] + x[1]; + } + + }; + delayIn.addInput(add); + highPass.addInput(add); + + /* output of this ugen */ + addToChainOutput(highPass); + } + +} +