JMSL tutorial “ShapeToot03 @doctornerve
JMSL tutorial “ShapeToot03  @doctornerve
Uploaded December 2024 | Updated December 2026, 3 hours ago
This video shows JMSL tutorial “ShapeToot03” running. This video is a part of the Java Music Specification Tutorial series. algomusic.com

Every element of the MusicShape holds parameters used to build a chord at run time. The MusicShape’s Instrument reads those values and creates and sounds a chord.

private void defineMyMusicShape() {
myMusicShape = new MusicShape(5);
myMusicShape.setRepeats(Integer.MAX_VALUE); // play forever

myMusicShape.setDimensionName(0, "Duration”);
myMusicShape.setLimits(0, 0.0, 4.0); // dim, low, high
myMusicShape.setDefault(0, 1.0); // default 1

myMusicShape.setDimensionName(1, "Chord Root”);
myMusicShape.setLimits(1, 20.0, 80.0);
myMusicShape.setDefault(1, 60.0);

myMusicShape.setDimensionName(2, "Number of Intervals”);
myMusicShape.setLimits(2, 0.0, 8.0);
myMusicShape.setDefault(2, 1.0);

myMusicShape.setDimensionName(3, "Harmonic Complexity”);
myMusicShape.setLimits(3, 0.0, 11.0);
myMusicShape.setDefault(3, 1.0);

myMusicShape.setDimensionName(4, "Time Window”);
myMusicShape.setLimits(4, 0.0, 1.0);
myMusicShape.setDefault(4, 0.0);
}

private void buildAndSetInstrument() {
Instrument chordMakingInstrument = new InstrumentAdapter() {
public double play(double playTime, double timeStretch, double[] data) {
double duration = data[0];
int root = (int) data[1];
int intervals = (int) data[2];
int harmonicComplexity = (int) data[3];
double timeWindow = data[4];
double offtime = playTime + JMSLRandom.choose(0.5, 1.5) * duration;
JMSL.midi.noteOn(playTime, 1, root, JMSLRandom.choose(20, 80));
JMSL.midi.noteOff(offtime, 1, root, 0);
String msg = "New chord playing at " + playTime + ", root = " + root;
if (intervals gt 0) {
msg += ", intervals: “;
}
for (int i = 0; i lt intervals; i++) {
int newInterval = root + HarmonicComplexity.gimmeRandomHarmonicComplexity(harmonicComplexity);
newInterval += 12 * JMSLRandom.choose(3); // transpose 8va’s
double timeStampOfInterval = playTime + JMSLRandom.choose(timeWindow);
offtime = timeStampOfInterval + JMSLRandom.choose(0.5, 1.5) * duration;
JMSL.midi.noteOn(timeStampOfInterval, 1, newInterval, JMSLRandom.choose(20, 80));
JMSL.midi.noteOff(offtime, 1, newInterval, 0);
msg += newInterval + “ “;
}
JMSL.out.println(msg);
return playTime + duration * timeStretch;
}
};
myMusicShape.setInstrument(chordMakingInstrument);
}
JMSL tutorial “ShapeToot03100 Duets for Piano and Electric Guitar, No 72 “Good Girl Gone BadJMSL tutorial: simple MusicJobBC Rich Warlock fits in Fender FBSS-610 Short-scale Bass Gig BagGuitar Solo 02, by Nick DidkovskyPoon Tickler at Gored in the Heart of Texas 2022100 Duets for Piano and Electric Guitar,  No 48 (banger)100 Duets for Piano and Electric Guitar, No 54100 Duets for Piano and Electric Guitar, No 31CHORD III - new music for electric guitarNick Didkovsky guitar play-through: I thought we were going for silly... by Frank PahlCHORD at Spectrum 2022-02-27
doctornerve |

JMSL tutorial “ShapeToot03"

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER