view src/uk/ac/qmul/eecs/depic/daw/beads/sonification/AutomationSound.java @ 2:c0412c81d274

Added documentation
author Fiore Martin <f.martin@qmul.ac.uk>
date Thu, 18 Feb 2016 18:35:26 +0000
parents 3074a84ef81e
children
line wrap: on
line source
/*  
 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;

/* not used */
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);
	}

}