|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.softsynth.jmsl.InstrumentAdapter
com.softsynth.jmsl.midi.MidiInstrument
public class MidiInstrument
An Instrument that outputs MIDI. The default Interpreter for a MidiInstrument is a NoteInterpreter. The default Mixer classname is "com.softsynth.jmsl.midi.MidiMixer"
NoteInterpreter, MidiMixer| Constructor Summary | |
|---|---|
MidiInstrument()
Default constructor with channel set to 1 |
|
MidiInstrument(int ch)
construct a Midi Instrument that uses specified channel |
|
MidiInstrument(int ch,
int program)
construct a Midi Instrument that uses specified channel and send specified programChange when it is open()'ed |
|
| Method Summary | |
|---|---|
double |
close(double playTime)
|
int |
getChannel()
|
MusicDevice |
getMusicDevice()
Get the MusicDevice associated with this Instrument |
int |
getNumOutputs()
|
java.lang.Object |
getOutput()
get this output (SynthOutput in the case of a JSyn Instrument, for example |
java.lang.Object |
getOutput(int partNum)
|
int |
getProgram()
|
static void |
main(java.lang.String[] args)
play marimba and accordion with MusicShapes with Midi Instruments |
double |
noteOff(double playTime,
double pitch,
double vel)
Turn off a MIDI note. |
double |
noteOn(double playTime,
double pitch,
double vel)
Turn on a MIDI note. |
java.lang.Object |
off(double playTime,
double timeStretch,
double[] dar)
Calls noteOff(playTime, dar[1], dar[2]); |
java.lang.Object |
on(double playTime,
double timeStretch,
double[] dar)
calls noteOn(playTime, dar[1], dar[2]); |
double |
open(double playTime)
|
void |
print()
|
void |
setChannel(int ch)
set the midi channel to be used by this instrument |
void |
setProgram(int p)
When this instrument is open()'ed, a program change will be called on the program value set here. |
| Methods inherited from class com.softsynth.jmsl.InstrumentAdapter |
|---|
getDimensionNameSpace, getInterpreter, getMixerClassName, getName, getTransposition, noteOnFor, play, setDimensionNameSpace, setInterpreter, setMixerClassName, setMusicDevice, setName, setTransposition, toString, update |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.softsynth.jmsl.NoteOnOff |
|---|
noteOnFor |
| Constructor Detail |
|---|
public MidiInstrument()
public MidiInstrument(int ch)
public MidiInstrument(int ch,
int program)
| Method Detail |
|---|
public double open(double playTime)
throws java.lang.InterruptedException
open in interface Instrumentopen in class InstrumentAdapterjava.lang.InterruptedExceptionpublic void setProgram(int p)
public int getProgram()
public double close(double playTime)
throws java.lang.InterruptedException
close in interface Instrumentclose in class InstrumentAdapterjava.lang.InterruptedExceptionpublic java.lang.Object getOutput()
OutputProvider
getOutput in interface OutputProvidergetOutput in class InstrumentAdapterpublic java.lang.Object getOutput(int partNum)
getOutput in interface OutputProvidergetOutput in class InstrumentAdapterpublic int getNumOutputs()
getNumOutputs in interface OutputProvidergetNumOutputs in class InstrumentAdapterpublic MusicDevice getMusicDevice()
Instrument
getMusicDevice in interface InstrumentgetMusicDevice in class InstrumentAdapterpublic int getChannel()
public void setChannel(int ch)
public java.lang.Object on(double playTime,
double timeStretch,
double[] dar)
on in interface Instrumenton in class InstrumentAdapterInstrument.on(double, double, double[])
public java.lang.Object off(double playTime,
double timeStretch,
double[] dar)
off in interface Instrumentoff in class InstrumentAdaptercom.softsynth.jmsl.Instrument#off(double, Object)
public double noteOn(double playTime,
double pitch,
double vel)
noteOn in interface NoteOnOffnoteOn in class InstrumentAdapter
public double noteOff(double playTime,
double pitch,
double vel)
noteOff in interface NoteOnOffnoteOff in class InstrumentAdapterpublic void print()
public static void main(java.lang.String[] args)
public static void main(String args[]) {
System.out.println("Java version: " + System.getProperty("java.version"));
JMSL.setViewFactory(new ViewFactorySwing());
PVFrame f = new PVFrameAdapter("close to exit");
f.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
JMSL.closeMusicDevices();
System.exit(0);
}
});
JMSL.midi = MidiIO_JavaSound.instance();
JMSL.midi.edit((Frame)f.getComponent());
JMSL.midi.open();
MidiInstrument m1 = new MidiInstrument(1, 13); // set up instrument on
// channel 1, program 13
m1.setName("Marimba");
m1.print();
MusicShape s = new MusicShape(4);
s.add(1.0, 84, 64, 1.0);
s.add(1.0, 52, 64, 1.5);
s.add(1.0, 74, 64, 0.8);
s.add(1.0, 46, 80, 0.8);
s.setInstrument(m1);
s.setRepeats(100);
s.setTimeStretch(0.5);
MidiInstrument m2 = new MidiInstrument(2, 22); // set up instrument on
// channel 2, program 22
m2.setName("Accordion");
MusicShape s2 = new MusicShape(4);
s2.add(0.0, 86, 64, 2.0);
s2.add(0.0, 40, 64, 1.5);
s2.add(1.0, 72, 64, 0.8);
s2.add(1.0, 44, 80, 0.8);
s2.setInstrument(m2);
s2.setRepeats(50);
s2.setTimeStretch(2.2);
JMSLMixerContainer mixer = new JMSLMixerContainer();
mixer.start();
mixer.addInstrument(m1, 0, 0.5);
mixer.addInstrument(m2, 1, 0.5);
f.add(mixer.getPanAmpControlPanel());
f.pack();
f.setVisible(true);
ParallelCollection p = new ParallelCollection(s, s2);
double when = JMSL.now() + 1;
p.launch(when);
}
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||