• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SynthesisEngine类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.jsyn.engine.SynthesisEngine的典型用法代码示例。如果您正苦于以下问题:Java SynthesisEngine类的具体用法?Java SynthesisEngine怎么用?Java SynthesisEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SynthesisEngine类属于com.jsyn.engine包,在下文中一共展示了SynthesisEngine类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:22,代码来源:TestSet.java


示例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();
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:24,代码来源:TestSet.java


示例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();
}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:38,代码来源:MixerGenerate.java


示例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();
}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:28,代码来源:BasicChainTest.java


示例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();
}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:14,代码来源:BasicChainTest.java


示例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();

}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:15,代码来源:BasicChainTest.java


示例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();
}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:12,代码来源:BasicChainTest.java


示例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();
}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:35,代码来源:BasicChainTest.java


示例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.");
    }
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:8,代码来源:PortBlockPart.java


示例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;
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:10,代码来源:UnitGenerator.java


示例11: setSynthesisEngine

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Override
public void setSynthesisEngine(SynthesisEngine engine) {
    super.setSynthesisEngine(engine);
    for (UnitGenerator unit : units) {
        unit.setSynthesisEngine(engine);
    }
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:8,代码来源:Circuit.java


示例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);
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:8,代码来源:MultiChannelSynthesizer.java


示例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;
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:9,代码来源:TestEnvelopeAttackDecay.java


示例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;
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:13,代码来源:TestEnvelopeDAHDSR.java


示例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();


    }
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:17,代码来源:Factory.java


示例16: TestVca

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Test
public void TestVca() throws InterruptedException {
    double amplitude = 0.1;
    Vca vca = new Vca("VCA");
    Vcoa vcoa2 = new Vcoa("VCOA2");

    //Configuration
    vcoa.setOscillatorType(OscillatorType.SINE);
    vcoa.setAmplitudeSine(1);
    vcoa2.setOscillatorType(OscillatorType.SQUARE);
    vcoa2.setAmplitudeSquare(amplitude);
    vcoa2.setExponentialFrequency(0.8);
    vcoa2.setLinearFrequency(0.8);
    vca.getGainModulator().setValue(0.0);

    //Connection
    vcoa.getOutput().connect(vca.getInput());
    vcoa2.getOutput().connect(vca.getAm());
    //vcoa2.getOutputPlug().connect(this.out.getInputPlug());
    vca.getOutput().connect(this.out.getInput());

    out.start();
    synth.start();

    ((SynthesisEngine)synth).printConnections();

    int n = 2000;
    while (n >= 0) {
        if (n % 50 == 0){
            if (out.getAmModulator().getValue() > 0.0){
                out.getAmModulator().setValue(0.0);
            } else {
                out.getAmModulator().setValue(amplitude);
                amplitude = amplitude - 0.025;
            }

        }

        synth.sleepFor(0.01);
        n--;
    }

    ((SynthesisEngine)synth).printConnections();
}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:45,代码来源:BasicChainTest.java


示例17: TestVolume

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Test
    public void TestVolume() throws InterruptedException {
        vcoa.setOscillatorType(OscillatorType.SINE);
        vcoa.setAmplitudeSine(1);
        vcoa.setLinearFrequency(320.0);

        vcoa.getInputByPass().activate();

        vcoa.getOutput().connect(out.getInput());

        out.start();
        synth.start();

        Assert.assertNotEquals(Register.retrieve(out.getInput()), Register.retrieve(out.getLineOut().getInput()));

        int n = 200;
        while (n >= 0) {

            if (n % 20 == 0){

                if (out.getAmModulator().getValue() > 0.0){
                    out.getAmModulator().setValue(0.0);
                } else {
                    out.getAmModulator().setValue(1.0);
                }

/*                if (out.getLineOut().getInputPlug().getUnitInputPort() > 0.0){
                    out.getLineOut().setVolume(0.0);
                } else {
                    out.getLineOut().setVolume(1.0);
                }*/

/*                if (vcoa.getAmplitudeSine() > 0.0){
                    vcoa.setAmplitudeSine(0.0);
                } else {
                    vcoa.setAmplitudeSine(1.0);
                }*/

            }

            System.out.println("Vcoa.getOutputPlug().getValue() : " + vcoa.getOutput().getUnitOutputPort().getValue());
            //System.out.println("out.getLineOut().getInputPlug().getValue() : " + out.getLineOut().getInputPlug().getUnitInputPort().getValue());
            //System.out.println("AmplitudeModulator : " + out.getAmModulator().getValue());
            System.out.println("out.getAmModulator().getValue() : " + out.getAmModulator().getValue());
            System.out.println("out.getAmModulator().getInputPlug().getUnitInputPort().getValue() : " + out.getAmModulator().getInput().getUnitInputPort().getValue());
            System.out.println("out.getAmModulator().getOutputPlug().getUnitOutputPort().getValue() : " + out.getAmModulator().getOutput().getUnitOutputPort().getValue());
            System.out.println("out.getLineOut().getInputPlug().getUnitInputPort().getValue() : " + out.getLineOut().getInput().getUnitInputPort().getValue());
            //out.getLineOut().getVolume();

            synth.sleepFor(0.1);
            n--;
        }

        ((SynthesisEngine)synth).printConnections();
    }
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:56,代码来源:BasicChainTest.java


示例18: testEg

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Test
public void testEg() throws InterruptedException {

    Vcoa Vcoa = new Vcoa("VCOA");
    Eg envelope = new Eg("ENVELOPE");
    Out myOut = new Out("OUT1");
    myOut.getAmModulator().setValue(1.0);

    envelope.getAttackPotentiometer().setValue(0.2);
    envelope.getDecayPotentiometer().setValue(0.2);
    envelope.getReleasePotentiometer().setValue(1);
    envelope.getSustainPotentiometer().setValue(0.1);
    envelope.activate();

    // we create the first sine  oscillator that will be connected to the input gate of EG
    SineOscillator sineOscillator = (SineOscillator) Factory.createOscillator(Vcoa, OscillatorType.SINE);
    sineOscillator.getFrequencyPotentiometer().setValue(0.5);
    sineOscillator.getAmplitudePotentiometer().setValue(1.0);
    sineOscillator.activate();
    sineOscillator.getOutput().connect(envelope.getInput());

    // we create the oscillator whose amplitude is controlled by the envelope
    SineOscillator sineOscillator2 = (SineOscillator) Factory.createOscillator(Vcoa, OscillatorType.SINE);
    sineOscillator2.getFrequencyPotentiometer().setValue(440);

    envelope.getInput().getUnitInputPort().set(1.0);
    envelope.getOutput().connect(sineOscillator2.getAm());
    sineOscillator2.getOutput().connect(myOut.getInput());
    sineOscillator2.activate();

    myOut.start();
    synth.start();
    synth.sleepFor(5);
    ((SynthesisEngine) synth).printConnections();

    // For the display of curves
    AudioScope scope = new AudioScope(synth);
    scope.addProbe(sineOscillator2.getOutput().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);

    //System.out.println("\n Testing EG Module with different parameter");

    //System.out.println("\nAttack = 1s, Decay = 1s, Sustain = 1dB, Release = 0.5s");
    synth.sleepFor(5);

    //System.out.println("\nAttack = 0.5s, Decay = 1s, Sustain = 1dB, Release = 0.5s");
    envelope.getAttackPotentiometer().setValue(0.5);
    synth.sleepFor(5);

    //System.out.println("\nAttack = 0.2s, Decay = 1s, Sustain = 1dB, Release = 0.5s");
    envelope.getAttackPotentiometer().setValue(0.2);
    envelope.getDecayPotentiometer().setValue(1);
    synth.sleepFor(5);
}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:64,代码来源:BasicChainTest.java


示例19: testMixer

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Test
public void testMixer() throws InterruptedException {
    Mixer mixer = new Mixer("MIX");
    Vcoa v1 = new Vcoa("v1");
    Vcoa v2 = new Vcoa("v2");
    Vcoa v3 = new Vcoa("v3");
    Vcoa v4 = new Vcoa("v4");

    v1.setAmplitudeOscillator(0.5);
    v1.setExponentialFrequency(0.80);
    v1.setLinearFrequency(0.5);
    v1.setOscillatorType(OscillatorType.SQUARE);

    v2.setAmplitudeOscillator(1.0);
    v2.setExponentialFrequency(0.80);
    v2.setLinearFrequency(0.55);
    v2.setOscillatorType(OscillatorType.SINE);

    v3.setAmplitudeOscillator(1.0);
    v3.setExponentialFrequency(0.60);
    v3.setLinearFrequency(0.8);
    v3.setOscillatorType(OscillatorType.SQUARE);

    v4.setAmplitudeOscillator(0.6);
    v4.setExponentialFrequency(0.5);
    v4.setLinearFrequency(0.7);
    v4.setOscillatorType(OscillatorType.SAWTOOTH);

    v1.getOutput().connect(mixer.getInput1());
    v2.getOutput().connect(mixer.getInput2());
    v3.getOutput().connect(mixer.getInput3());
    v4.getOutput().connect(mixer.getInput4());
    mixer.getOutput().connect(out.getInput());

    out.start();
    synth.start();
    synth.sleepFor(5);
    mixer.setGainValueInput2(0.000001);
    mixer.setGainValueInput3(0.000001);
    mixer.setGainValueInput4(0.000001);
    v2.setOscillatorType(OscillatorType.TRIANGLE);
    v3.setOscillatorType(OscillatorType.TRIANGLE);
    v4.setOscillatorType(OscillatorType.TRIANGLE);
    synth.sleepFor(5);

    ((SynthesisEngine) synth).printConnections();
}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:48,代码来源:BasicChainTest.java


示例20: TestKeyboard

import com.jsyn.engine.SynthesisEngine; //导入依赖的package包/类
@Test
public void TestKeyboard() throws InterruptedException {
    Keyboard keyboard = new Keyboard("Nord Electro");

    //Configuration
    vcoa.setOscillatorType(OscillatorType.SINE);
    vcoa.setAmplitudeSine(1);
    vcoa.setExponentialFrequency(0.4);
    vcoa.setLinearFrequency(0.5);

    //Connection
    keyboard.getOutputCv().connect(vcoa.getFm());
    vcoa.getOutput().connect(this.out.getInput());

    out.start();
    synth.start();

    synth.sleepFor(1);
    keyboard.playNote(Note.RE);
    synth.sleepFor(1);
    keyboard.playNote(Note.MI);
    synth.sleepFor(1);
    keyboard.playNote(Note.FA);
    synth.sleepFor(1);
    keyboard.playNote(Note.SOL);
    synth.sleepFor(1);
    keyboard.playNote(Note.LA);
    synth.sleepFor(1);
    keyboard.playNote(Note.SI);
    synth.sleepFor(1);
    keyboard.playNote(Note.DOs);
    synth.sleepFor(1);
    keyboard.releaseNote();
    synth.sleepFor(1);
    keyboard.playNote(Note.DO);
    keyboard.playNote(Note.X);
    synth.sleepFor(1);
    keyboard.playNote(Note.RE);
    synth.sleepFor(1);
    keyboard.playNote(Note.MI);
    synth.sleepFor(1);
    keyboard.playNote(Note.FA);
    synth.sleepFor(1);
    keyboard.playNote(Note.SOL);
    synth.sleepFor(1);
    keyboard.playNote(Note.LA);
    synth.sleepFor(1);
    keyboard.playNote(Note.SI);
    synth.sleepFor(1);
    keyboard.playNote(Note.DOs);
    synth.sleepFor(1);

    ((SynthesisEngine)synth).printConnections();
}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:55,代码来源:BasicChainTest.java



注:本文中的com.jsyn.engine.SynthesisEngine类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IExpression类代码示例发布时间:2022-05-16
下一篇:
Java Command类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap