We use the instrument SYNTH_BASS_2 (instrument 39) for the instrumental of Beverly Hills Cop.
The instrument list, with the defined constants for dictionary lookup, is in section 2.4 of The Complete Guide to JFugue 5.0.
The standard instrument numbers 0-127 or 1-128 (for 0-based or 1-based counting) can also be found online. Java, JFugue and most languages use 0-based counting.
package jfugue22;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import org.jfugue.pattern.Pattern;
import org.jfugue.player.Player;
public class JFugue22 extends Application {
public static void main(String[] args) {
launch(args);
}
TextArea text;
Button button;
@Override
public void start(Stage primaryStage) throws Exception {
button = new Button("Play Harold Faltermeyer's\nelectronic "
+ "instrumental\ntheme");
button.setOnAction(e->example());
button.setFont(Font.font("Verdana", 12));
button.setPrefSize(200, 100);
VBox examples = new VBox(10, button);
examples.setPadding(new Insets(10));
text = new TextArea();
text.setPrefRowCount(20);
text.setPrefColumnCount(32);
text.setFont(Font.font("Verdana", 20));
text.setEditable(false);
text.setWrapText(true);
HBox root = new HBox(50,examples,text);
Scene scene = new Scene(root, 900, 600);
primaryStage.setTitle("JFugue 22. Harold Faltermeyer's "
+ " electronic instrumental theme");
primaryStage.setScene(scene);
primaryStage.show();
}
private void example() {
Player player = new Player();
text.appendText("Played Harold Faltermeyer's electronic "
+ "instrumental theme from the film Beverly Hills "
+ "Cop (1984)\n\n");
StringBuilder sb = new StringBuilder();
sb.append(" F5q Rq Ab5q Ri F5q F5i Bb5q F5q E#5q ");
sb.append(" F5q Rq C6q Ri F5q F5i Db6q C6q Ab5q ");
sb.append(" F5q C6q F6q F5i Eb5q Eb5i C5q G5q F5q. ");
Pattern pattern = new Pattern(sb.toString());
pattern.setTempo(220);
pattern.setInstrument("SYNTH_BASS_2");
text.appendText("Pattern:\n" + pattern + "\n\n");
player.play(pattern);
}
}
This is the output after 2 plays:
No comments:
Post a Comment