import org.jfugue.player.Player;
public class MusicPlayer {
public static void main(String[] args) {
TwelveBarBlues twelveBarBlues = new TwelveBarBlues();
System.out.println("Twelve Bar blues Playing: ");
Player player = new Player();
player.play(twelveBarBlues.getPattern());
}
}
import java.io.IOException;
import org.jfugue.pattern.Pattern;
import org.jfugue.player.Player;
import org.jfugue.theory.ChordProgression;
public class TwelveBarBlues {
private String pattern;
public static void main(String[] args) throws IOException {
Pattern pattern = new ChordProgression("I IV V")
.distribute("7%6")
.allChordsAs("$0 $0 $0 $0 $1 $1 $0 $0 $2 $1 $0 $0")
.eachChordAs("$0ia100 $1ia80 $2ia80 $3ia80 $4ia100 $3ia80 $2ia80 $1ia80")
.getPattern()
.setInstrument("Acoustic_Bass")
.setTempo(100);
new Player().play(pattern);
}
public String getPattern() {
this.pattern = pattern;
return pattern;
}
}
我想在 MusicPlayer 播放十二条蓝音乐代码。但我得到错误代码无法调用“java.lang.CharSequence.length()”,因为当我运行 MusicPlayer MusicPlayer 错误代码时“this.text”为空