JMSL Tutorial: JScore
Building your own JScore instrument, part 7


Sample Playing Instruments

JMSL supports three flavors of sample playing instruments:
  1. SimpleSamplePlayingInstrument maps pitches to sound files. No sustaining, no transposition. Examples include a drum machine instrument, where a snare is mapped to one note, a kick is mapped to another, a floor tom to another, etc. Transposing the pitch does not change the pitch of the sample, rather it triggers a different sample.
  2. TransposingSamplePlayingInstrument also maps pitches to sound files, transposing nearest sample to unmapped pitches. Simple sustain: loops a portion of the smple found between two markers.
  3. TransposingSampleSustainingInstrument also transposes nearest sample to unmapped pitches, but uses a crossfading sustain design for smoother sustain.
IMPORTANT: These can be used without JMSL Score just like any other JMSL Instrument!!!

IMPORTANT: For Applets, the root sample directory passed to the constructor is ignored and CODEBASE is used instead! So your samples should be in your applet's CODEBASE. The use of subfolders is ok, just make everything relative to CODEBASE. So for example, if locally you have a root sample directory called F:/JMSLScoreWork/JMSLScoreSamples/ relative to which all your samples are located, and inside it is hr16_stereo/AlesisKick.aif, then your applet's CODEBASE, which might be a folder called "classes", should contain hr16_stereo/AlesisKick.aif

Source for custom examples follow. Copy, edit, compile, and run. They output an XML file which you can load into JMSL Score.
  • SimpleSamplePlayingInstrument subclass maps voice samples to pitchs
  • TransposingSamplePlayingInstrument subclass plays 'cello sample.
  • TransposingSampleSustainingInstrument subclass plays 'cello sample, smoother sustain.

    Study the source, and use it as a template to design your own sample playing subclasses.

    Compile and run your new class. Running it saves your new instrument as an XML file which can be loaded into JScore later.

    Note that ScoreFrame has an graphic user interface where you can load and assign samples interactively, as the image shows below. Here, a the user loaded TransposingSampleSustainingInstrument.xml from the JMSL instruments_xml folder (ships with JMSL), and selected Orchestra -> Instrument -> Edit Instrument from the ScoreFrame menu. A panel like the one shown below opens where sound files can be assigned to pitches.
    Sample Instrument Editor
    Previous Tutorial Index Tutorial Contents Next


      (C) 2000 Nick Didkovsky and Phil Burk, All Rights Reserved
      JMSL is based upon HMSL (C) Phil Burk, Larry Polansky and David Rosenboom.