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


Java SawtoothOscillatorBL类代码示例

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


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

示例1: init

import com.jsyn.unitgen.SawtoothOscillatorBL; //导入依赖的package包/类
public void init()
{
	synth = JSyn.createSynthesizer();
	
	// Add a tone generator. (band limited sawtooth)
	synth.add( osc = new SawtoothOscillatorBL() );
	// Add a lag to smooth out amplitude changes and avoid pops.
	synth.add( lag = new LinearRamp() );
	// Add an output mixer.
	synth.add( lineOut = new LineOut() );
	// Connect the oscillator to both left and right output.
	osc.output.connect( 0, lineOut.input, 0 );
	osc.output.connect( 0, lineOut.input, 1 );
	
	// Set the minimum, current and maximum values for the port.
	lag.output.connect( osc.amplitude );
	lag.input.setup( 0.0, 0.5, 1.0 );
	lag.time.set(  0.2 );

	// Arrange the faders in a stack.
	setLayout( new GridLayout( 0, 1 ) );

	ExponentialRangeModel amplitudeModel = PortModelFactory.createExponentialModel( lag.input );
	RotaryTextController knob = new RotaryTextController( amplitudeModel, 5 );
	JPanel knobPanel = new JPanel();
	knobPanel.add( knob );
	add( knobPanel );

	osc.frequency.setup( 50.0, 300.0, 10000.0 );
	add( PortControllerFactory.createExponentialPortSlider( osc.frequency ) );
	validate();
}
 
开发者ID:WiredProgrammers,项目名称:collegeProjects,代码行数:33,代码来源:SawFaders.java

示例2: start

import com.jsyn.unitgen.SawtoothOscillatorBL; //导入依赖的package包/类
@Override
   public void start()
{
	synth = JSyn.createSynthesizer();
	
	// Add an LFO.
	synth.add( lfo = new SineOscillator() );
	synth.add( adder = new Add() );
	
	// Add an output so we can hear the oscillators.
	synth.add( lineOut = new LineOut() );
	
	lfo.frequency.set( 0.1 );
	lfo.amplitude.set( 200.0 );
	adder.inputB.set( 400.0 );
	lfo.output.connect(  adder.inputA );
	
	oscillators.add( new SawtoothOscillatorBL() );
	oscillators.add( new SineOscillator() );
	oscillators.add( new TriangleOscillator() );
	for( UnitOscillator osc : oscillators)
	{
		synth.add( osc);
		adder.output.connect(  osc.frequency );
		osc.output.connect( 0, lineOut.input, 0 );
		osc.amplitude.set(  0.2  );
	}
	
	// Start synthesizer using default stereo output at 44100 Hz.
	synth.start();
	// Start lineOut so it can pull data from other units.
	lineOut.start();
	setupGUI();
	
	// We only need to start the LineOut. It will pull data from the
	// oscillator.
	lineOut.start();
	
}
 
开发者ID:vocobox,项目名称:vocobox,代码行数:40,代码来源:ShowWaves.java

示例3: init

import com.jsyn.unitgen.SawtoothOscillatorBL; //导入依赖的package包/类
@Override
   public void init()
{
	synth = JSyn.createSynthesizer();
	
	// Add a tone generator. (band limited sawtooth)
	synth.add( osc = new SawtoothOscillatorBL() );
	// Add a lag to smooth out amplitude changes and avoid pops.
	synth.add( lag = new LinearRamp() );
	// Add an output mixer.
	synth.add( lineOut = new LineOut() );
	// Connect the oscillator to both left and right output.
	osc.output.connect( 0, lineOut.input, 0 );
	osc.output.connect( 0, lineOut.input, 1 );
	
	// Set the minimum, current and maximum values for the port.
	lag.output.connect( osc.amplitude );
	lag.input.setup( 0.0, 0.5, 1.0 );
	lag.time.set(  0.2 );

	// Arrange the faders in a stack.
	setLayout( new GridLayout( 0, 1 ) );

	ExponentialRangeModel amplitudeModel = PortModelFactory.createExponentialModel( lag.input );
	RotaryTextController knob = new RotaryTextController( amplitudeModel, 5 );
	JPanel knobPanel = new JPanel();
	knobPanel.add( knob );
	add( knobPanel );

	osc.frequency.setup( 50.0, 300.0, 10000.0 );
	add( PortControllerFactory.createExponentialPortSlider( osc.frequency ) );
	validate();
}
 
开发者ID:vocobox,项目名称:vocobox,代码行数:34,代码来源:SawFaders.java

示例4: SubtractiveSynthVoice

import com.jsyn.unitgen.SawtoothOscillatorBL; //导入依赖的package包/类
public SubtractiveSynthVoice() {
    add(frequencyScaler = new Multiply());
    // Add a tone generator.
    add(osc = new SawtoothOscillatorBL());

    // Use an envelope to control the amplitude.
    add(ampEnv = new EnvelopeDAHDSR());

    // Use an envelope to control the filter cutoff.
    add(filterEnv = new EnvelopeDAHDSR());
    add(filter = new FilterLowPass());
    add(cutoffAdder = new Add());

    filterEnv.output.connect(cutoffAdder.inputA);
    cutoffAdder.output.connect(filter.frequency);
    frequencyScaler.output.connect(osc.frequency);
    osc.output.connect(filter.input);
    filter.output.connect(ampEnv.amplitude);

    addPort(amplitude = osc.amplitude, "Amplitude");
    addPort(frequency = frequencyScaler.inputA, "Frequency");
    addPort(pitchModulation = frequencyScaler.inputB, "PitchMod");
    addPort(cutoff = cutoffAdder.inputB, "Cutoff");
    addPort(cutoffRange = filterEnv.amplitude, "CutoffRange");
    addPort(Q = filter.Q);

    ampEnv.export(this, "Amp");
    filterEnv.export(this, "Filter");

    frequency.setup(osc.frequency);
    pitchModulation.setup(0.2, 1.0, 4.0);
    cutoff.setup(filter.frequency);
    cutoffRange.setup(filter.frequency);

    // Make the circuit turn off when the envelope finishes to reduce CPU load.
    ampEnv.setupAutoDisable(this);

    usePreset(0);
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:40,代码来源:SubtractiveSynthVoice.java

示例5: start

import com.jsyn.unitgen.SawtoothOscillatorBL; //导入依赖的package包/类
@Override
public void start() {
    synth = JSyn.createSynthesizer();

    // Add an LFO.
    synth.add(lfo = new SineOscillator());
    synth.add(adder = new Add());

    // Add an output so we can hear the oscillators.
    synth.add(lineOut = new LineOut());

    lfo.frequency.set(0.1);
    lfo.amplitude.set(200.0);
    adder.inputB.set(400.0);
    lfo.output.connect(adder.inputA);

    oscillators.add(new SawtoothOscillatorBL());
    oscillators.add(new SineOscillator());
    oscillators.add(new TriangleOscillator());
    for (UnitOscillator osc : oscillators) {
        synth.add(osc);
        adder.output.connect(osc.frequency);
        osc.output.connect(0, lineOut.input, 0);
        osc.amplitude.set(0.2);
    }

    // Start synthesizer using default stereo output at 44100 Hz.
    synth.start();
    // Start lineOut so it can pull data from other units.
    lineOut.start();
    setupGUI();

    // We only need to start the LineOut. It will pull data from the
    // oscillator.
    lineOut.start();

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

示例6: init

import com.jsyn.unitgen.SawtoothOscillatorBL; //导入依赖的package包/类
@Override
public void init() {
    synth = JSyn.createSynthesizer();
    synth.add(oscillator = new SawtoothOscillatorBL());
    synth.add(rampCutoff = new LinearRamp());
    synth.add(tieQ = new PassThrough());
    synth.add(tieCutoff = new PassThrough());
    synth.add(filterMoog = new FilterFourPoles());
    synth.add(filterBiquad = new FilterLowPass());
    synth.add(mixer = new PassThrough());
    synth.add(lineOut = new LineOut());

    oscillator.output.connect(filterMoog.input);
    oscillator.output.connect(filterBiquad.input);
    if (useCutoffRamp) {
        rampCutoff.output.connect(filterMoog.frequency);
        rampCutoff.output.connect(filterBiquad.frequency);
        rampCutoff.time.set(0.000);
    } else {
        tieCutoff.output.connect(filterMoog.frequency);
        tieCutoff.output.connect(filterBiquad.frequency);
    }
    tieQ.output.connect(filterMoog.Q);
    tieQ.output.connect(filterBiquad.Q);
    filterMoog.output.connect(mixer.input);
    mixer.output.connect(0, lineOut.input, 0);
    mixer.output.connect(0, lineOut.input, 1);

    filterBiquad.amplitude.set(0.1);
    oscillator.frequency.setup(50.0, 130.0, 3000.0);
    oscillator.amplitude.setup(0.0, 0.336, 1.0);
    rampCutoff.input.setup(filterMoog.frequency);
    tieCutoff.input.setup(filterMoog.frequency);
    tieQ.input.setup(0.1, 0.7, 10.0);
    setupGUI();
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:37,代码来源:HearMoogFilter.java

示例7: init

import com.jsyn.unitgen.SawtoothOscillatorBL; //导入依赖的package包/类
@Override
public void init() {
    synth = JSyn.createSynthesizer();

    // Add a tone generator. (band limited sawtooth)
    synth.add(osc = new SawtoothOscillatorBL());
    // Add a lag to smooth out amplitude changes and avoid pops.
    synth.add(lag = new LinearRamp());
    // Add an output mixer.
    synth.add(lineOut = new LineOut());
    // Connect the oscillator to both left and right output.
    osc.output.connect(0, lineOut.input, 0);
    osc.output.connect(0, lineOut.input, 1);

    // Set the minimum, current and maximum values for the port.
    lag.output.connect(osc.amplitude);
    lag.input.setup(0.0, 0.5, 1.0);
    lag.time.set(0.2);

    // Arrange the faders in a stack.
    setLayout(new GridLayout(0, 1));

    ExponentialRangeModel amplitudeModel = PortModelFactory.createExponentialModel(lag.input);
    RotaryTextController knob = new RotaryTextController(amplitudeModel, 5);
    JPanel knobPanel = new JPanel();
    knobPanel.add(knob);
    add(knobPanel);

    osc.frequency.setup(50.0, 300.0, 10000.0);
    add(PortControllerFactory.createExponentialPortSlider(osc.frequency));
    validate();
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:33,代码来源:SawFaders.java

示例8: start

import com.jsyn.unitgen.SawtoothOscillatorBL; //导入依赖的package包/类
@Override
   public void start()
{
	synth = JSyn.createSynthesizer();

	// Use a multiplier for gain control and so we can hook up to the scope
	// from a single unit.
	synth.add( oscGain = new Multiply() );
	oscGain.inputB.setup( 0.02, 0.5, 1.0 );
	oscGain.inputB.setName( "Amplitude" );

	synth.add( freqRamp = new LinearRamp() );
	freqRamp.input.setup( 50.0, 300.0, 20000.0 );
	freqRamp.input.setName( "Frequency" );
	freqRamp.time.set( 0.1 );

	// Add an output so we can hear the oscillators.
	synth.add( lineOut = new LineOut() );

	oscGain.output.connect( lineOut.input );

	setupGUI();

	buttonGroup = new ButtonGroup();

	addOscillator( new SineOscillator(), "Sine" );
	addOscillator( new TriangleOscillator(), "Triangle" );
	addOscillator( new SawtoothOscillator(), "Sawtooth" );
	addOscillator( new SawtoothOscillatorBL(), "SawBL" );
	addOscillator( new SawtoothOscillatorDPW(), "SawDPW" );
	addOscillator( new RedNoise(), "RedNoise" );
	
	addOscillator( new SquareOscillator(), "Square" );
	addOscillator( new SquareOscillatorBL(), "SquareBL" );
	addOscillator( new PulseOscillator(), "Pulse" );
	addOscillator( new PulseOscillatorBL(), "PulseBL" );
	addOscillator( new ImpulseOscillator(), "Impulse" );
	addOscillator( new ImpulseOscillatorBL(), "ImpulseBL" );

	// Start synthesizer using default stereo output at 44100 Hz.
	synth.start();
	// Start lineOut so it can pull data from other units.
	lineOut.start();

	// We only need to start the LineOut. It will pull data from the
	// oscillator.
	lineOut.start();

}
 
开发者ID:vocobox,项目名称:vocobox,代码行数:50,代码来源:SeeOscillators.java

示例9: test

import com.jsyn.unitgen.SawtoothOscillatorBL; //导入依赖的package包/类
private void test()
{
	// Create a context for the synthesizer.
	synth = JSyn.createSynthesizer();
	
	// Add a tone generator.
	synth.add( osc = new SawtoothOscillatorBL() );
	// Add an output mixer.
	synth.add( lineOut = new LineOut() );
	
	// Connect the oscillator to the left and right audio output.
	osc.output.connect( 0, lineOut.input, 0 );
	osc.output.connect( 0, lineOut.input, 1 );
	
	// Start synthesizer using default stereo output at 44100 Hz.
	synth.start();
	// We only need to start the LineOut. It will pull data from the
	// oscillator.
	lineOut.start();

	// Get synthesizer time in seconds.
	double timeNow = synth.getCurrentTime();

	// Advance to a near future time so we have a clean start.
	double time = timeNow + 0.5;
	double freq = 400.0; // hertz
	osc.frequency.set( freq, time );

	// Schedule this to happen a bit later.
	time += 0.5;
	freq *= 1.5; // up a perfect fifth
	osc.frequency.set( freq, time );

	time += 0.5;
	freq *= 4.0 / 5.0; // down a major third
	osc.frequency.set( freq, time );

	// Sleep while the sound is being generated in the background thread.
	try
	{
		synth.sleepUntil( time + 0.5 );
	} catch( InterruptedException e )
	{
		e.printStackTrace();
	}

	// Stop everything.
	synth.stop();
}
 
开发者ID:vocobox,项目名称:vocobox,代码行数:50,代码来源:PlaySequence.java

示例10: test

import com.jsyn.unitgen.SawtoothOscillatorBL; //导入依赖的package包/类
private void test()
{
	// Create a context for the synthesizer.
	synth = JSyn.createSynthesizer();
	// Add a tone generator.
	synth.add( osc = new SawtoothOscillatorBL() );
	// Add an envelope player.
	synth.add( envelopePlayer = new VariableRateMonoReader() );

	// Create an envelope consisting of (duration,value) pairs.
	double[] pairs = { 0.1, 1.0, 0.2, 0.5, 0.6, 0.0 };
	envelope = new SegmentedEnvelope( pairs );

	// Add an output mixer.
	synth.add( lineOut = new LineOut() );
	envelopePlayer.output.connect( osc.amplitude );
	// Connect the oscillator to the output.
	osc.output.connect( 0, lineOut.input, 0 );
	osc.output.connect( 0, lineOut.input, 1 );

	// Start synthesizer using default stereo output at 44100 Hz.
	synth.start();
	// We only need to start the LineOut. It will pull data from the other
	// units.
	lineOut.start();

	try
	{
		// Queue an envelope with callbacks.
		QueueDataCommand command = envelopePlayer.dataQueue.createQueueDataCommand( envelope, 0,
				envelope.getNumFrames() );
		// Create an object to be called when the queued data is done.
		TestQueueCallback callback = new TestQueueCallback();
		command.setCallback( callback );
		command.setNumLoops( 2 );
		envelopePlayer.rate.set( 0.2 );
		synth.queueCommand( command );
		synth.sleepFor( 20.0 );

	} catch( InterruptedException e )
	{
		e.printStackTrace();
	}
	// Stop everything.
	synth.stop();
}
 
开发者ID:vocobox,项目名称:vocobox,代码行数:47,代码来源:PlaySegmentedEnvelopeCallback.java

示例11: start

import com.jsyn.unitgen.SawtoothOscillatorBL; //导入依赖的package包/类
@Override
public void start() {
    synth = JSyn.createSynthesizer();

    // Use a multiplier for gain control and so we can hook up to the scope
    // from a single unit.
    synth.add(oscGain = new Multiply());
    oscGain.inputB.setup(0.02, 0.5, 1.0);
    oscGain.inputB.setName("Amplitude");

    synth.add(freqRamp = new LinearRamp());
    freqRamp.input.setup(50.0, 300.0, 20000.0);
    freqRamp.input.setName("Frequency");
    freqRamp.time.set(0.1);

    synth.add(widthRamp = new LinearRamp());
    widthRamp.input.setup(-1.0, 0.0, 1.0);
    widthRamp.input.setName("Width");
    widthRamp.time.set(0.1);

    synth.add(shapeRamp = new LinearRamp());
    shapeRamp.input.setup(-1.0, 0.0, 1.0);
    shapeRamp.input.setName("Shape");
    shapeRamp.time.set(0.1);

    // Add an output so we can hear the oscillators.
    synth.add(lineOut = new LineOut());

    oscGain.output.connect(0, lineOut.input, 0);
    oscGain.output.connect(0, lineOut.input, 1);

    setupGUI();

    buttonGroup = new ButtonGroup();

    addOscillator(new SineOscillator(), "Sine");
    addOscillator(new TriangleOscillator(), "Triangle");
    addOscillator(new SawtoothOscillator(), "Sawtooth");
    addOscillator(new SawtoothOscillatorBL(), "SawBL");
    addOscillator(new SawtoothOscillatorDPW(), "SawDPW");
    addOscillator(new RedNoise(), "RedNoise");

    addOscillator(new SquareOscillator(), "Square");
    addOscillator(new SquareOscillatorBL(), "SquareBL");
    addOscillator(new PulseOscillator(), "Pulse");
    addOscillator(new PulseOscillatorBL(), "PulseBL");
    addOscillator(new MorphingOscillatorBL(), "MorphBL");
    addOscillator(new ImpulseOscillator(), "Impulse");
    addOscillator(new ImpulseOscillatorBL(), "ImpulseBL");

    // Start synthesizer using default stereo output at 44100 Hz.
    synth.start();
    // Start lineOut so it can pull data from other units.
    lineOut.start();

    // We only need to start the LineOut. It will pull data from the
    // oscillator.
    lineOut.start();

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

示例12: test

import com.jsyn.unitgen.SawtoothOscillatorBL; //导入依赖的package包/类
private void test() {
    // Create a context for the synthesizer.
    synth = JSyn.createSynthesizer();

    // Add a tone generator.
    synth.add(osc = new SawtoothOscillatorBL());
    // Add an output mixer.
    synth.add(lineOut = new LineOut());

    // Connect the oscillator to the left and right audio output.
    osc.output.connect(0, lineOut.input, 0);
    osc.output.connect(0, lineOut.input, 1);

    // Start synthesizer using default stereo output at 44100 Hz.
    synth.start();
    // We only need to start the LineOut. It will pull data from the
    // oscillator.
    lineOut.start();

    // Get synthesizer time in seconds.
    double timeNow = synth.getCurrentTime();

    // Advance to a near future time so we have a clean start.
    double time = timeNow + 0.5;
    double freq = 400.0; // hertz
    osc.frequency.set(freq, time);

    // Schedule this to happen a bit later.
    time += 0.5;
    freq *= 1.5; // up a perfect fifth
    osc.frequency.set(freq, time);

    time += 0.5;
    freq *= 4.0 / 5.0; // down a major third
    osc.frequency.set(freq, time);

    // Sleep while the sound is being generated in the background thread.
    try {
        synth.sleepUntil(time + 0.5);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    // Stop everything.
    synth.stop();
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:47,代码来源:PlaySequence.java

示例13: test

import com.jsyn.unitgen.SawtoothOscillatorBL; //导入依赖的package包/类
private void test() {
    // Create a context for the synthesizer.
    synth = JSyn.createSynthesizer();
    // Add a tone generator.
    synth.add(osc = new SawtoothOscillatorBL());
    // Add an envelope player.
    synth.add(envelopePlayer = new VariableRateMonoReader());

    // Create an envelope consisting of (duration,value) pairs.
    double[] pairs = {
            0.1, 1.0, 0.2, 0.5, 0.6, 0.0
    };
    envelope = new SegmentedEnvelope(pairs);

    // Add an output mixer.
    synth.add(lineOut = new LineOut());
    envelopePlayer.output.connect(osc.amplitude);
    // Connect the oscillator to the output.
    osc.output.connect(0, lineOut.input, 0);
    osc.output.connect(0, lineOut.input, 1);

    // Start synthesizer using default stereo output at 44100 Hz.
    synth.start();
    // We only need to start the LineOut. It will pull data from the other
    // units.
    lineOut.start();

    try {
        // Queue an envelope with callbacks.
        QueueDataCommand command = envelopePlayer.dataQueue.createQueueDataCommand(envelope, 0,
                envelope.getNumFrames());
        // Create an object to be called when the queued data is done.
        TestQueueCallback callback = new TestQueueCallback();
        command.setCallback(callback);
        command.setNumLoops(2);
        envelopePlayer.rate.set(0.2);
        synth.queueCommand(command);
        synth.sleepFor(20.0);

    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    // Stop everything.
    synth.stop();
}
 
开发者ID:philburk,项目名称:jsyn,代码行数:46,代码来源:PlaySegmentedEnvelopeCallback.java


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