< prev index next >

src/java.desktop/share/classes/javax/sound/midi/VoiceStatus.java

Print this page




  34  * successive single notes, and the process of assigning incoming MIDI notes to
  35  * specific voices is known as voice allocation. However, the voice-allocation
  36  * algorithm and the contents of each voice are normally internal to a MIDI
  37  * synthesizer and hidden from outside view. One can, of course, learn from MIDI
  38  * messages which notes the synthesizer is playing, and one might be able deduce
  39  * something about the assignment of notes to voices. But MIDI itself does not
  40  * provide a means to report which notes a synthesizer has assigned to which
  41  * voice, nor even to report how many voices the synthesizer is capable of
  42  * synthesizing.
  43  * <p>
  44  * In Java Sound, however, a {@code Synthesizer} class can expose the contents
  45  * of its voices through its
  46  * {@link Synthesizer#getVoiceStatus() getVoiceStatus()} method. This behavior
  47  * is recommended but optional; synthesizers that don't expose their voice
  48  * allocation simply return a zero-length array. A {@code Synthesizer} that does
  49  * report its voice status should maintain this information at all times for all
  50  * of its voices, whether they are currently sounding or not. In other words, a
  51  * given type of {@code Synthesizer} always has a fixed number of voices, equal
  52  * to the maximum number of simultaneous notes it is capable of sounding.
  53  * <p>
  54  * <a id="description_of_active"></a> If the voice is not currently processing
  55  * a MIDI note, it is considered inactive. A voice is inactive when it has been
  56  * given no note-on commands, or when every note-on command received has been
  57  * terminated by a corresponding note-off (or by an "all notes off" message).
  58  * For example, this happens when a synthesizer capable of playing 16
  59  * simultaneous notes is told to play a four-note chord; only four voices are
  60  * active in this case (assuming no earlier notes are still playing). Usually, a
  61  * voice whose status is reported as active is producing audible sound, but this
  62  * is not always true; it depends on the details of the instrument (that is, the
  63  * synthesis algorithm) and how long the note has been going on. For example, a
  64  * voice may be synthesizing the sound of a single hand-clap. Because this sound
  65  * dies away so quickly, it may become inaudible before a note-off message is
  66  * received. In such a situation, the voice is still considered active even
  67  * though no sound is currently being produced.
  68  * <p>
  69  * Besides its active or inactive status, the {@code VoiceStatus} class provides
  70  * fields that reveal the voice's current MIDI channel, bank and program number,
  71  * MIDI note number, and MIDI volume. All of these can change during the course
  72  * of a voice. While the voice is inactive, each of these fields has an
  73  * unspecified value, so you should check the active field first.
  74  *
  75  * @author David Rivas




  34  * successive single notes, and the process of assigning incoming MIDI notes to
  35  * specific voices is known as voice allocation. However, the voice-allocation
  36  * algorithm and the contents of each voice are normally internal to a MIDI
  37  * synthesizer and hidden from outside view. One can, of course, learn from MIDI
  38  * messages which notes the synthesizer is playing, and one might be able deduce
  39  * something about the assignment of notes to voices. But MIDI itself does not
  40  * provide a means to report which notes a synthesizer has assigned to which
  41  * voice, nor even to report how many voices the synthesizer is capable of
  42  * synthesizing.
  43  * <p>
  44  * In Java Sound, however, a {@code Synthesizer} class can expose the contents
  45  * of its voices through its
  46  * {@link Synthesizer#getVoiceStatus() getVoiceStatus()} method. This behavior
  47  * is recommended but optional; synthesizers that don't expose their voice
  48  * allocation simply return a zero-length array. A {@code Synthesizer} that does
  49  * report its voice status should maintain this information at all times for all
  50  * of its voices, whether they are currently sounding or not. In other words, a
  51  * given type of {@code Synthesizer} always has a fixed number of voices, equal
  52  * to the maximum number of simultaneous notes it is capable of sounding.
  53  * <p>
  54  * <a id="description_of_active"></a>If the voice is not currently processing a
  55  * MIDI note, it is considered inactive. A voice is inactive when it has been
  56  * given no note-on commands, or when every note-on command received has been
  57  * terminated by a corresponding note-off (or by an "all notes off" message).
  58  * For example, this happens when a synthesizer capable of playing 16
  59  * simultaneous notes is told to play a four-note chord; only four voices are
  60  * active in this case (assuming no earlier notes are still playing). Usually, a
  61  * voice whose status is reported as active is producing audible sound, but this
  62  * is not always true; it depends on the details of the instrument (that is, the
  63  * synthesis algorithm) and how long the note has been going on. For example, a
  64  * voice may be synthesizing the sound of a single hand-clap. Because this sound
  65  * dies away so quickly, it may become inaudible before a note-off message is
  66  * received. In such a situation, the voice is still considered active even
  67  * though no sound is currently being produced.
  68  * <p>
  69  * Besides its active or inactive status, the {@code VoiceStatus} class provides
  70  * fields that reveal the voice's current MIDI channel, bank and program number,
  71  * MIDI note number, and MIDI volume. All of these can change during the course
  72  * of a voice. While the voice is inactive, each of these fields has an
  73  * unspecified value, so you should check the active field first.
  74  *
  75  * @author David Rivas


< prev index next >