1

How do I a produce an infinite loop using a JFugue pattern. I tried the following

  • while loop
  • for loop with a high counter

In both cases, weird sounds get produced which are overlapped. When I run with a small counter like 10 in a for loop, it works fine.

I need a pattern to run infinitely until the player is stopped by calling player.close() by an user action (say from UI).

1 Answers1

1

There's not a specific way to make a pattern run forever. This is partly because JFugue compiles music strings into MIDI code, so a pattern that ran forever would just be a infinitely-long MIDI file. Of course, if you use a specific number of times to repeat a pattern, the pattern could be too long or too short for your needs. The best option might be to look into JFugue's RealtimePlayer class, and create a separate thread that keeps playing sections of the metronome pattern while the thread is still active.

Let me know if that helps you get on the right path!

David Koelle
  • 20,726
  • 23
  • 93
  • 130