本文整理汇总了Java中com.jsyn.engine.SynthesisEngine类的典型用法代码示例。如果您正苦于以下问题:Java SynthesisEngine类的具体用法?Java SynthesisEngine怎么用?Java SynthesisEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SynthesisEngine类属于com.jsyn.engine包,在下文中一共展示了SynthesisEngine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSet
import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
public void testSet() throws InterruptedException {
SynthesisEngine synthesisEngine = new SynthesisEngine();
synthesisEngine.setRealTime(false);
synthesisEngine.start();
synthesisEngine.sleepUntil(0.01);
Minimum min;
synthesisEngine.add(min = new Minimum());
double x = 33.99;
double y = 8.31;
min.inputA.set(x);
min.inputB.set(y);
synthesisEngine.sleepFor(0.01);
assertEquals("min set A", x, min.inputA.getValue());
assertEquals("min set B", y, min.inputB.getValue());
min.start();
synthesisEngine.sleepFor(0.01);
assertEquals("min output", y, min.output.getValue());
synthesisEngine.stop();
}
示例2: testSetBadPort
import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
/** if we use a port index out of range we want to know now and not blow up the engine. */
public void testSetBadPort() throws InterruptedException {
SynthesisEngine synthesisEngine = new SynthesisEngine();
synthesisEngine.setRealTime(false);
synthesisEngine.start();
Minimum min;
synthesisEngine.add(min = new Minimum());
min.start();
Exception caught = null;
try {
min.inputA.set(1, 23.45);
} catch (Exception e) {
caught = e;
}
assertTrue("Catch port out of range, caught " + caught,
(caught instanceof ArrayIndexOutOfBoundsException));
// Don't blow up here.
synthesisEngine.sleepUntil(0.01);
synthesisEngine.stop();
}
示例3: testMix
import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Test
public void testMix() throws InterruptedException {
sineOscillator.amplitude.set(3.0);
sineOscillator.frequency.set(320.0);
squareOscillator.amplitude.set(3.0);
squareOscillator.frequency.set(80.0);
triangleOscillator.amplitude.set(3.0);
triangleOscillator.frequency.set(80.0);
sawtoothOscillator.amplitude.set(3.0);
sawtoothOscillator.frequency.set(80.0);
//mixerStereo.addPort(sineOscillator.output);
//mixerStereo.addPort(squareOscillator.output);
//lineOut.input.connect(mixerStereo.output);
synth.add(sineOscillator);
synth.add(squareOscillator);
synth.add(sawtoothOscillator);
synth.add(triangleOscillator);
synth.add(lineOut);
add.inputA.connect(sineOscillator.output);
add.inputB.connect(squareOscillator.output);
add.inputA.connect(sawtoothOscillator.output);
System.out.println(add.getPortByName("triangle") +", "+add.getPortByName("sine")+", "+add.getPortByName("square"));
synth.add(add);
add.start();
//mixerStereo.activate();
//vcoa.getOutputPlug().connect(vcoa1.getInputPlug());
//out.activate();
lineOut.getInput().connect(add.output);
synth.start();
lineOut.start();
synth.sleepFor(5.0);
((SynthesisEngine)synth).printConnections();
}
示例4: TestVcoaToVcoa
import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Test
public void TestVcoaToVcoa() throws InterruptedException {
out.getInput().connect(vcoa.getOutput());
Vcoa vcoa1 = new Vcoa("VCOA1");
vcoa1.setOscillatorType(OscillatorType.SINE);
vcoa1.setAmplitudeSine(1.0);
vcoa1.setExponentialFrequency(0.5);
vcoa1.setLinearFrequency(0.5);
vcoa1.getOutput().connect(vcoa.getFm());
// to display curves
//AudioScope scope = new AudioScope( synth );
//scope.addProbe(vcoa.getTriangleOutput().getUnitOutputPort());
//scope.setTriggerMode( AudioScope.TriggerMode.AUTO );
//scope.getModel().getTriggerModel().getLevelModel().setDoubleValue( 0.0001 );
//scope.getView().setControlsVisible(true);
//scope.start();
//JFrame frame = new JFrame();
//frame.add(scope.getView());
//frame.pack();
//frame.setVisible(true);
out.start();
synth.start();
synth.sleepUntil(5);
((SynthesisEngine)synth).printConnections();
}
示例5: TestOutParameters
import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Test
public void TestOutParameters() throws InterruptedException {
out.getInput().connect(vcoa.getOutput());
synth.start();
out.start();
synth.sleepUntil(3);
out.getAmModulator().setValue(0);
synth.sleepUntil(6);
out.getAmModulator().setValue(0.1);
synth.sleepUntil(9);
((SynthesisEngine)synth).printConnections();
}
示例6: testReplicator
import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Test
public void testReplicator() throws InterruptedException {
Replicator repl = new Replicator("REPL");
vcoa.getOutput().connect(repl.getInput());
repl.getOutput2().connect(out.getInput());
out.start();
synth.start();
synth.sleepFor(5);
((SynthesisEngine) synth).printConnections();
}
示例7: testWhiteNoise
import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Test
public void testWhiteNoise() throws InterruptedException {
WhiteNoise whiteNoise = new WhiteNoise("WHITE NOISE");
whiteNoise.activate();
out.start();
out.getInput().connect(whiteNoise.getOutput());
synth.start();
synth.sleepFor(10);
((SynthesisEngine) synth).printConnections();
}
示例8: TestVcfa
import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Test
public void TestVcfa() throws InterruptedException {
Vcfa vcfa = new Vcfa("VCFA");
Vcoa vcoa2 = new Vcoa("VCOA2");
//Configuration
vcoa.setOscillatorType(OscillatorType.SINE);
vcoa.setAmplitudeSine(1);
vcoa2.setOscillatorType(OscillatorType.TRIANGLE);
vcoa2.setAmplitudeTriangle(1.0);
vcoa2.setExponentialFrequency(0.2);
vcoa2.setLinearFrequency(0.5);
vcfa.setCutoff(1.0);
//Connection
vcoa.getOutput().connect(vcfa.getInput());
vcoa2.getOutput().connect(vcfa.getFm());
vcfa.getOutput().connect(this.out.getInput());
out.start();
synth.start();
int n = 1000;
while (n >= 0) {
if (n % 50 == 0){
vcfa.setCutoff(((double) n) / 1000);
}
synth.sleepFor(0.01);
n--;
}
((SynthesisEngine)synth).printConnections();
}
示例9: checkConnection
import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
private void checkConnection(PortBlockPart destination) {
SynthesisEngine sourceSynth = unitBlockPort.getSynthesisEngine();
SynthesisEngine destSynth = destination.unitBlockPort.getSynthesisEngine();
if ((sourceSynth != destSynth) && (sourceSynth != null) && (destSynth != null)) {
throw new RuntimeException("Connection between units on different synths.");
}
}
示例10: setSynthesisEngine
import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
/**
* @param synthesisEngine the synthesisEngine to set
*/
public void setSynthesisEngine(SynthesisEngine synthesisEngine) {
if ((this.synthesisEngine != null) && (this.synthesisEngine != synthesisEngine)) {
throw new RuntimeException("Unit synthesisEngine already set.");
}
this.synthesisEngine = synthesisEngine;
}
示例11: setSynthesisEngine
import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Override
public void setSynthesisEngine(SynthesisEngine engine) {
super.setSynthesisEngine(engine);
for (UnitGenerator unit : units) {
unit.setSynthesisEngine(engine);
}
}
示例12: setVolume
import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
public void setVolume(double volume) {
double min = SynthesisEngine.DB96;
double max = 1.0;
double ratio = max / min;
double value = min * Math.pow(ratio, volume);
volumeRamp.input.set(value);
}
示例13: setUp
import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
synthesisEngine = new SynthesisEngine();
synthesisEngine.setRealTime(false);
attackTime = 0.2;
decayTime = 0.4;
}
示例14: setUp
import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
synthesisEngine = new SynthesisEngine();
synthesisEngine.setRealTime(false);
delayTime = 0.1;
attackTime = 0.2;
holdTime = 0.3;
decayTime = 0.4;
sustainLevel = 0.5;
releaseTime = 0.6;
}
示例15: uglyResetSynthesizer
import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
public static void uglyResetSynthesizer() {
for(IComponent c : Register.mappingGenerator.keySet()){
for(UnitGenerator ug : Register.mappingGenerator.get(c)){
synthesizer.remove(ug);
}
}
Register.mappingGenerator.clear();
Register.mappingInput.clear();
Register.mappingOutput.clear();
((SynthesisEngine) synthesizer).printConnections();
}