当前位置: 首页>>代码示例>>Java>>正文


Java Synthesizer.add方法代码示例

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


在下文中一共展示了Synthesizer.add方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AudioStreamReader

import com.jsyn.Synthesizer; //导入方法依赖的package包/类
public AudioStreamReader(Synthesizer synth, int samplesPerFrame) {
    if (samplesPerFrame == 1) {
        streamWriter = new MonoStreamWriter();
    } else if (samplesPerFrame == 2) {
        streamWriter = new StereoStreamWriter();
    } else {
        throw new IllegalArgumentException("Only 1 or 2 samplesPerFrame supported.");
    }
    synth.add(streamWriter);

    fifo = new AudioFifo();
    fifo.setWriteWaitEnabled(!synth.isRealTime());
    fifo.setReadWaitEnabled(true);
    fifo.allocate(32 * 1024);
    streamWriter.setOutputStream(fifo);
    streamWriter.start();
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:18,代码来源:AudioStreamReader.java

示例2: ConductorVoice

import com.jsyn.Synthesizer; //导入方法依赖的package包/类
public ConductorVoice(Synthesizer synth) {
    mPitches = PitchGenerator.generatePitches(scale, PITCH_MIN, PITCH_MAX);
    mVoice = new SineEnvelope();
    synth.add(mVoice);
    EnvelopeDAHDSR DAHDSR = ((SineEnvelope)getVoice()).getDAHDSR();
    DAHDSR.hold.set(1000);
    DAHDSR.sustain.set(1000);
}
 
开发者ID:google,项目名称:science-journal,代码行数:9,代码来源:ConductorVoice.java

示例3: testGatePort

import com.jsyn.Synthesizer; //导入方法依赖的package包/类
@Test
public void testGatePort() throws InterruptedException {
    TriangleOscillator oscillator = new TriangleOscillator();
    oscillator.frequency.set(440.0);
    oscillator.amplitude.set(0.9);
    Synthesizer synthesis = Factory.createSynthesizer();
    LineOut lineOut = new LineOut();

    synthesis.add(lineOut);
    synthesis.add(oscillator);

    MyGate gate = new MyGate();

    synthesis.add(gate);

    gate.signal.connect(oscillator.output);
    lineOut.input.connect(gate.output);

    gate.start();
    lineOut.start();
    synthesis.start();
    synthesis.sleepFor(3);
    gate.input.on();
    synthesis.sleepFor(3);
    gate.input.off();
    synthesis.sleepFor(3);
}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:28,代码来源:GatePrototype.java

示例4: setup

import com.jsyn.Synthesizer; //导入方法依赖的package包/类
/**
 * Specify a VoiceDescription to use with multiple channels.
 *
 * @param synth
 * @param startChannel channel index is zero based
 * @param numChannels
 * @param voicesPerChannel
 * @param voiceDescription
 */
public void setup(Synthesizer synth, int startChannel, int numChannels, int voicesPerChannel,
        VoiceDescription voiceDescription) {
    this.synth = synth;
    if (outputUnit == null) {
        synth.add(outputUnit = new TwoInDualOut());
    }
    ChannelGroupContext groupContext = new ChannelGroupContext(voicesPerChannel,
            voiceDescription);
    for (int i = 0; i < numChannels; i++) {
        channels[startChannel + i].setup(groupContext);
    }
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:22,代码来源:MultiChannelSynthesizer.java

示例5: testPassThrough

import com.jsyn.Synthesizer; //导入方法依赖的package包/类
public void testPassThrough() {
    Synthesizer synth;
    LineIn lineIn;
    LineOut lineOut;
    // Create a context for the synthesizer.
    synth = JSyn.createSynthesizer(AudioDeviceFactory.createAudioDeviceManager(true));
    // Add an audio input.
    synth.add(lineIn = new LineIn());
    // Add an audio output.
    synth.add(lineOut = new LineOut());
    // Connect the input to the output.
    lineIn.output.connect(0, lineOut.input, 0);
    lineIn.output.connect(1, lineOut.input, 1);

    // Both stereo.
    int numInputChannels = 2;
    int numOutputChannels = 2;
    synth.start(44100, AudioDeviceManager.USE_DEFAULT_DEVICE, numInputChannels,
            AudioDeviceManager.USE_DEFAULT_DEVICE, numOutputChannels);

    // We only need to start the LineOut. It will pull data from the LineIn.
    lineOut.start();
    System.out.println("Audio passthrough started.");
    // Sleep a while.
    double sleepTime = 2.0;
    try {
        double time = synth.getCurrentTime();
        // Sleep for a few seconds.
        synth.sleepUntil(time + sleepTime);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    double synthTime = synth.getCurrentTime();
    assertEquals("Time has advanced. " + synthTime, sleepTime, synthTime, 0.2);
    // Stop everything.
    synth.stop();
    System.out.println("All done.");

}
 
开发者ID:philburk,项目名称:jsyn,代码行数:40,代码来源:TestDevices.java

示例6: DataToScalePitchSimpleJsynUnitVoiceAdapter

import com.jsyn.Synthesizer; //导入方法依赖的package包/类
public DataToScalePitchSimpleJsynUnitVoiceAdapter(Synthesizer synth, int[] scale,
                                                          int pitchMin, int pitchMax) {
    mPitches = PitchGenerator.generatePitches(scale, pitchMin, pitchMax);
    mVoice = new SimpleJsynUnitVoice();
    synth.add(mVoice);
}
 
开发者ID:google,项目名称:science-journal,代码行数:7,代码来源:DataToScalePitchSimpleJsynUnitVoiceAdapter.java

示例7: NotesVoice

import com.jsyn.Synthesizer; //导入方法依赖的package包/类
public NotesVoice(Synthesizer synth) {
    mVoice = new SineEnvelope();
    synth.add(mVoice);
}
 
开发者ID:google,项目名称:science-journal,代码行数:5,代码来源:NotesVoice.java

示例8: AmplitudeVoice

import com.jsyn.Synthesizer; //导入方法依赖的package包/类
public AmplitudeVoice(Synthesizer synth) {
    mVoice = new SimpleJsynUnitVoice();
    synth.add(mVoice);
}
 
开发者ID:google,项目名称:science-journal,代码行数:5,代码来源:AmplitudeVoice.java

示例9: DefaultVoice

import com.jsyn.Synthesizer; //导入方法依赖的package包/类
public DefaultVoice(Synthesizer synth) {
    mVoice = new SimpleJsynUnitVoice();
    synth.add(mVoice);
}
 
开发者ID:google,项目名称:science-journal,代码行数:5,代码来源:DefaultVoice.java


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