Package org.jfugue

Examples of org.jfugue.Pattern


            outFilename = args[2];
        }

        // Create a player, and play the music!
        try {
            Pattern pattern = Pattern.loadPattern(new File(inFilename));
            Player player = new Player();
            player.saveMidi(pattern, new File(outFilename));
            player.play(pattern);
            player.close();
        } catch (IOException e)
View Full Code Here


            printUsage();
            System.exit(0);
        }
       
        Player player = new Player();
        Pattern pattern = null;
        try {
            pattern = player.loadMidi(new File(args[1]));
            pattern.savePattern(new File(args[2]));
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InvalidMidiDataException e) {
            e.printStackTrace();
        }
View Full Code Here

        reset();
    }
   
    public void reset()
    {
        pattern = new Pattern();
        activeVoice = 0;
    }
View Full Code Here

 
  public void testPlay(final int times){
    Thread hilo = new Thread() {
      @Override
      public void run() {
        Pattern pattern = getRhythmPattern();
        pattern.repeat(times);
        Player player = new Player();
        player.play(pattern);       
      }
    };
    hilo.start();
View Full Code Here

  private static Player player = new Player();
  public boolean parar;
  private static YMLSong instance; 

  public YMLSong(int tempo) {
    song = new Pattern("T" + tempo);
    layer = 1;   
    instance = this;
  }
View Full Code Here

  public void addTrack(String instrument, String sounds) {
    String instrumentID = YMLInstrument.getInstrumentRealName(instrument);
    String s = "V" + layer + " I[" + instrumentID + "] " + sounds;
    // System.out.println(s);
    Pattern aux = new Pattern(s);
    // Pattern round = new Pattern("V" + layer);
    // round.add(aux);
    song.add(aux);
    layer++;
  }
View Full Code Here

      }.start();
   
  }

  public void addRhythm(YMLRhythm rhythm, int times) {
    Pattern p = rhythm.getRhythmPattern();
    p.repeat(times);
    song.add(p);
  }
View Full Code Here

    };
    hilo.start();
  }

  public static void test(){
    Pattern doubleMeasureRest = new Pattern("Rw Rw");

    // "Frere Jacques"
    Pattern pattern1 = new Pattern("C5q D5q E5q C5q");

    // "Dormez-vous?"
    Pattern pattern2 = new Pattern("E5q F5q G5h");

    // "Sonnez les matines"
    Pattern pattern3 = new Pattern("G5i A5i G5i F5i E5q C5q");

    // "Ding ding dong"
    Pattern pattern4 = new Pattern("C5q G4q C5h");

    // Put all of the patters together to form the song
    Pattern song = new Pattern();
    song.add(pattern1, 2); // Adds 'pattern1' to 'song' twice
    song.add(pattern2, 2); // Adds 'pattern2' to 'song' twice
    song.add(pattern3, 2); // Adds 'pattern3' to 'song' twice
    song.add(pattern4, 2); // Adds 'pattern4' to 'song' twice

    // Create the first voice
    Pattern round1 = new Pattern("V0");
    round1.add(song);

    // Create the second voice
    Pattern round2 = new Pattern("V1");
    round2.add(doubleMeasureRest);
    round2.add(song);

    // Create the third voice
    Pattern round3 = new Pattern("V2");
    round3.add(doubleMeasureRest, 2);
    round3.add(song);

    // Put the voices together
    Pattern roundSong = new Pattern();
    roundSong.add(round1);
    roundSong.add(round2);
    roundSong.add(round3);

    // Play the song!
    player.play(roundSong);
  }
View Full Code Here

    player.play(roundSong);
  }
 
  public static void playTracks(final String[] instruments,
      final String[] sounds, final int[] tempos) {
    Pattern finalSong = new Pattern();
   
    for (int i = 0; i < instruments.length && i < sounds.length && i < tempos.length; i++) {
      final String instrumentID = getInstrumentRealName(instruments[i]);
      final int tempo = tempos[i];
      Pattern song = new Pattern("T" + tempo + " I[" + instrumentID + "] " + sounds[i]);
      Pattern round = new Pattern("V" + i);
      round.add(song);
      //Pattern song = new Pattern("G5i A5i G5i F5i E5q C5q");
      finalSong.add(round);
    }
   
    //finalSong.add(rhythm);   
View Full Code Here

    }
    final Rhythm final_rhythm = rhythm;
    Thread bateria = new Thread() {
      @Override
      public void run() {
        Pattern pattern = final_rhythm.getPattern();
        pattern.repeat(3);
        Player player = new Player();
        player.play(pattern);
        System.out.println("Fin de reproducción de ritmo");
      }
    };
View Full Code Here

TOP

Related Classes of org.jfugue.Pattern

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.