Beispiel #1
0
  /**
   * Writes a simple bass line to the track
   *
   * @param chord chord, which notes are using to write a bass line
   * @param track track on which we write a bass line
   * @throws TWDataException
   */
  public static void WriteSimpleBassLine(TWChord chord, TWInstrumentTrack track)
      throws TWDataException {
    TWSimpleNote Note;
    int[] frets;

    // One measure contains only eighth notes
    for (int i = 0; i < 8; i++) {
      // Use first, main note from given chord
      Note = chord.getNote(0);
      frets = track.getFretsByNoteAndString(Note, 4);

      // Writes it on fourth string
      track.addNoteNew(frets[0], 4, 8);
    }
  }
Beispiel #2
0
  /**
   * Writes a bass line with pauses to the track
   *
   * @param chord chord, which notes are using to write a bass line
   * @param track track on which we write a bass line
   * @throws TWDataException
   */
  public static void WritePauseBassLine(TWChord chord, TWInstrumentTrack track)
      throws TWDataException {
    Random rn = new Random();

    TWSimpleNote Note;
    int[] frets;

    // One measure contains only eighth notes
    for (int i = 0; i < 8; i++) {
      int randPause = rn.nextInt(3);

      // Writes eighth rest. Probability 1/3
      if (randPause == 0) track.addRest(8);
      else {
        // Use first, main note from given chord
        Note = chord.getNote(0);
        frets = track.getFretsByNoteAndString(Note, 4);

        // Writes it on fourth string
        track.addNoteNew(frets[0], 4, 8);
      }
    }
  }
Beispiel #3
0
 /**
  * Writes a bass line note to the track
  *
  * @param Note note that we write to the track
  * @param randNoteOnFret random integer, that chooses note from guitar fret
  * @throws TWDataException
  */
 private static void BassLineNote(TWSimpleNote Note, int randNoteOnFret, TWInstrumentTrack track) {
   int[] Frets = track.getFretsByNoteAndString(Note, 4);
   track.addNoteNew(Frets[randNoteOnFret], 4, 8);
 }