本文整理汇总了Java中com.jsyn.Synthesizer类的典型用法代码示例。如果您正苦于以下问题:Java Synthesizer类的具体用法?Java Synthesizer怎么用?Java Synthesizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Synthesizer类属于com.jsyn包,在下文中一共展示了Synthesizer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getSonificationTypeAdapter
import com.jsyn.Synthesizer; //导入依赖的package包/类
public static JsynUnitVoiceAdapterInterface getSonificationTypeAdapter(
Synthesizer synth, String sonification_type) {
if (sonification_type.equals(DEFAULT_SONIFICATION_TYPE)) {
return new DefaultVoice(synth);
} else if (sonification_type.equals(AMPLITUDE_SONIFICATION_TYPE)) {
return new AmplitudeVoice(synth);
} else if (sonification_type.equals(NOTES_SONIFICATION_TYPE)) {
return new NotesVoice(synth);
} else if (sonification_type.equals(SCALE_SONIFICATION_TYPE)) {
return new ScaleVoice(synth);
} else if (sonification_type.equals(CONDUCTOR_SONIFICATION_TYPE)) {
return new ConductorVoice(synth);
} else {
return null;
}
}
开发者ID:google,项目名称:science-journal,代码行数:17,代码来源:SonificationTypeAdapterFactory.java
示例2: generateNextBuffer
import com.jsyn.Synthesizer; //导入依赖的package包/类
public void generateNextBuffer() {
int outIndex = 0;
int inIndex = 0;
for (int i = 0; i < BLOCKS_PER_BUFFER; i++) {
if (inputBuffer != null) {
inIndex = inputBuffer.deinterleave(inIndex);
}
TimeStamp timeStamp = createTimeStamp();
// Try putting this up here so incoming time-stamped events will get
// scheduled later.
processScheduledCommands(timeStamp);
clearBlockBuffers();
synthesizeBuffer();
if (outputBuffer != null) {
outIndex = outputBuffer.interleave(outIndex);
}
frameCount += Synthesizer.FRAMES_PER_BLOCK;
}
}
开发者ID:philburk,项目名称:jsyn,代码行数:22,代码来源:SynthesisEngine.java
示例3: synthesizeBuffer
import com.jsyn.Synthesizer; //导入依赖的package包/类
private void synthesizeBuffer() {
synchronized (runningUnitList) {
ListIterator<UnitGenerator> iterator = runningUnitList.listIterator();
while (iterator.hasNext()) {
UnitGenerator unit = iterator.next();
if (pullDataEnabled) {
unit.pullData(getFrameCount(), 0, Synthesizer.FRAMES_PER_BLOCK);
} else {
unit.generate(0, Synthesizer.FRAMES_PER_BLOCK);
}
}
// Remove any units that got auto stopped.
for (UnitGenerator ugen : stoppingUnitList) {
runningUnitList.remove(ugen);
ugen.flattenOutputs();
}
}
stoppingUnitList.clear();
}
开发者ID:philburk,项目名称:jsyn,代码行数:20,代码来源:SynthesisEngine.java
示例4: 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
示例5: 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
示例6: 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
示例7: testFrequency
import com.jsyn.Synthesizer; //导入依赖的package包/类
@Test
public void testFrequency() throws Exception {
IComponent componentOut = Mockito.mock(Out.class);
sineOscillator.getFrequencyPotentiometer().setValue(320.0);
sineOscillator.getAmplitudePotentiometer().setValue(0.5);
sineOscillator.activate();
ILineOut lineOut = Factory.createLineOut(componentOut, LineType.OUT);
lineOut.getInput().connect(sineOscillator.getOutput());
Synthesizer synth = Factory.createSynthesizer();
lineOut.start();
synth.start();
synth.sleepFor(0.5);
int n = 10;
while (n > 0) {
n--;
assertNotSame(0.0, sineOscillator.getOutput().getUnitOutputPort().getValue());
synth.sleepFor(0.5);
}
sineOscillator.getFrequencyPotentiometer().setValue(0);
while (n > 0) {
n--;
assertSame(0.0, sineOscillator.getOutput().getUnitOutputPort().getValue());
synth.sleepFor(0.5);
}
}
开发者ID:StephaneMangin,项目名称:Synth,代码行数:37,代码来源:SineOscillatorTest.java
示例8: deinterleave
import com.jsyn.Synthesizer; //导入依赖的package包/类
int deinterleave(int inIndex) {
for (int jf = 0; jf < Synthesizer.FRAMES_PER_BLOCK; jf++) {
for (int iob = 0; iob < blockBuffers.length; iob++) {
ChannelBlockBuffer buffer = blockBuffers[iob];
buffer.values[jf] = interleavedBuffer[inIndex++];
}
}
return inIndex;
}
开发者ID:philburk,项目名称:jsyn,代码行数:10,代码来源:SynthesisEngine.java
示例9: interleave
import com.jsyn.Synthesizer; //导入依赖的package包/类
int interleave(int outIndex) {
for (int jf = 0; jf < Synthesizer.FRAMES_PER_BLOCK; jf++) {
for (int iob = 0; iob < blockBuffers.length; iob++) {
ChannelBlockBuffer buffer = blockBuffers[iob];
interleavedBuffer[outIndex++] = buffer.values[jf];
}
}
return outIndex;
}
开发者ID:philburk,项目名称:jsyn,代码行数:10,代码来源:SynthesisEngine.java
示例10: WaveRecorder
import com.jsyn.Synthesizer; //导入依赖的package包/类
/**
* @param synth
* @param outputFile
* @param samplesPerFrame 1 for mono, 2 for stereo
* @param bitsPerSample 16 or 24
* @throws FileNotFoundException
*/
public WaveRecorder(Synthesizer synth, File outputFile, int samplesPerFrame, int bitsPerSample)
throws FileNotFoundException {
this.synth = synth;
reader = new AudioStreamReader(synth, samplesPerFrame);
writer = new WaveFileWriter(outputFile);
writer.setFrameRate(synth.getFrameRate());
writer.setSamplesPerFrame(samplesPerFrame);
writer.setBitsPerSample(bitsPerSample);
}
开发者ID:philburk,项目名称:jsyn,代码行数:18,代码来源:WaveRecorder.java
示例11: 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
示例12: 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
示例13: 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
示例14: NotesVoice
import com.jsyn.Synthesizer; //导入依赖的package包/类
public NotesVoice(Synthesizer synth) {
mVoice = new SineEnvelope();
synth.add(mVoice);
}
开发者ID:google,项目名称:science-journal,代码行数:5,代码来源:NotesVoice.java
示例15: AmplitudeVoice
import com.jsyn.Synthesizer; //导入依赖的package包/类
public AmplitudeVoice(Synthesizer synth) {
mVoice = new SimpleJsynUnitVoice();
synth.add(mVoice);
}
开发者ID:google,项目名称:science-journal,代码行数:5,代码来源:AmplitudeVoice.java
示例16: DefaultVoice
import com.jsyn.Synthesizer; //导入依赖的package包/类
public DefaultVoice(Synthesizer synth) {
mVoice = new SimpleJsynUnitVoice();
synth.add(mVoice);
}
开发者ID:google,项目名称:science-journal,代码行数:5,代码来源:DefaultVoice.java
示例17: ScaleVoice
import com.jsyn.Synthesizer; //导入依赖的package包/类
public ScaleVoice(Synthesizer synth) {
super(synth, scale, PITCH_MIN, PITCH_MAX);
}
开发者ID:google,项目名称:science-journal,代码行数:4,代码来源:ScaleVoice.java
示例18: getSynthesizer
import com.jsyn.Synthesizer; //导入依赖的package包/类
private Synthesizer getSynthesizer(int group, int instrument) {
return voices[group][instrument].getSynthesizer();
}
开发者ID:julianmaster,项目名称:ChiptuneTracker,代码行数:4,代码来源:Chanel.java
示例19: getSynthesizer
import com.jsyn.Synthesizer; //导入依赖的package包/类
@Override
public Synthesizer getSynthesizer() {
return synth;
}
开发者ID:vocobox,项目名称:vocobox,代码行数:5,代码来源:JsynVocoSynthAbstract.java
示例20: setupAudioBuffers
import com.jsyn.Synthesizer; //导入依赖的package包/类
private void setupAudioBuffers(int numInputChannels, int numOutputChannels) {
inputBuffer = new InterleavingBuffer(FRAMES_PER_BUFFER, Synthesizer.FRAMES_PER_BLOCK,
numInputChannels);
outputBuffer = new InterleavingBuffer(FRAMES_PER_BUFFER, Synthesizer.FRAMES_PER_BLOCK,
numOutputChannels);
}
开发者ID:philburk,项目名称:jsyn,代码行数:7,代码来源:SynthesisEngine.java
注:本文中的com.jsyn.Synthesizer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论