Sunday, July 24, 2016

JFugue19. Bruce Hornsby's The Way It Is (1986)

These are the beginning notes from Bruce Hornsby's The Way It Is.


It is possible to write dotted eighth as i. or is for eighth and sixteenth, or as /0.1875.


package jfugue19;

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.realtime.RealtimePlayer;

public class JFugue19 extends Application {
    
    public static void main(String[] args) {
        launch(args);
    }
    
    TextArea text;
    Button button;
    RealtimePlayer rp;
    
    @Override
    public void stop() {
        rp.close();
    }
    
    @Override
    public void start(Stage primaryStage) throws Exception {
        
        
        rp = new RealtimePlayer();
        
        button = new Button("Play \nBruce Hornsby's"
                + "\nThe Way It Is");
                
        button.setOnAction(e->example());
        button.setFont(Font.font("Verdana", 16));
        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 19. Bruce Hornsby's "
                + "\"The Way It Is” (1986)");
        
        primaryStage.setScene(scene);
        primaryStage.show();
    }
    
    private void example() {
        
        String patt1 = " A5s B5s A4+E5+G5+C6i. A4+E5+G5+C6i. ";
        String patt2 = " E4+D5+G5+B5h D5+A5s G5s D4+D5+F#5+A5i. ";
        String patt3 = " D4+D5+G5+B5i. C4+C5+D5+G5q. C4+E5i D5s ";
        String patt4 = " C5s G3+B5+D5q. G3+D5+G5+B5i D4+E5+A5+C6i. ";
        String patt5 = " D4+D5+G5+B5i A5s G5i C4+C5+D5+G5i. ";
        String patt6 = " C4+C5+D5+G5i. G4+B4+D5+G5h ";
        
        String patt = patt1 +  patt2 + patt3 
                + patt4 + patt5 + patt6;
        Pattern pattern = new Pattern(patt);
        pattern.setTempo(105);
        text.appendText("Playing pattern:\n" + pattern + "\n\n");
        rp.play(pattern);
    }
}

This is the output after 3 plays:


No comments:

Post a Comment