import { NoteExample, Timing } from '../../types';

export const basicMelody: NoteExample = {
  patternDescription: 'a basic EDM melody, starting on',
  pitchDescription: 'C4',
  timingQualifier: 'with some timing variety, but mostly on',
  timing: Timing.Quarter,
  holdDescription: 'played legato',
  notes: [
    {
      type: 'Comment',
      comment:
        'Start with a descending line, right on beat, beginning after the first beat to make the rhythm interesting',
    },
    {
      pitch: 48,
      start: 1,
      end: 2,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 46,
      start: 2,
      end: 3,
      velocity: 0.7874015748031497,
      lifted: true,
    },
    {
      pitch: 43,
      start: 3,
      end: 4,
      velocity: 0.7874015748031497,
      lifted: true,
    },
    {
      type: 'Comment',
      comment: 'Now play a faster alternating whole tone melody, just for a few notes.',
    },
    {
      pitch: 41,
      start: 4,
      end: 5.5,
      velocity: 0.7874015748031497,
      lifted: true,
    },
    {
      pitch: 39,
      start: 5.5,
      end: 6,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 41,
      start: 6,
      end: 6.5,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 39,
      start: 6.5,
      end: 7,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 41,
      start: 7,
      end: 7.5,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 43,
      start: 7.5,
      end: 8,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      type: 'Comment',
      comment: `When this loops, we'll return to the descending line here.`,
    },
  ],
};

export const bankAccountMelody: NoteExample = {
  patternDescription: 'a nice catchy EDM-style melody, starting on',
  pitchDescription: 'C5',
  timingQualifier: 'with some timing variety. starting on',
  timing: Timing.Quarter,
  holdDescription: 'played legato',
  notes: [
    {
      type: 'Comment',
      comment: `Start with a little turn around the root note to emphasize it. We'll start after the first beat to keep the rhythm from being too simple.`,
    },
    {
      pitch: 60,
      start: 1,
      end: 1.5,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 58,
      start: 2,
      end: 2.5,
      velocity: 0.7874015748031497,
      lifted: true,
    },
    {
      pitch: 62,
      start: 3,
      end: 3.5,
      velocity: 0.7874015748031497,
      lifted: true,
    },
    {
      pitch: 60,
      start: 4,
      end: 4.5,
      velocity: 0.7874015748031497,
      lifted: true,
    },
    {
      pitch: 60,
      start: 5.5,
      end: 5.75,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      type: 'Comment',
      comment: `After a pause, we go into the eight-sixteenth rhythm. This doesn't line up exactly with quarter notes, so it creates a bit of 3-on-4 intrigue.`,
    },
    {
      pitch: 60,
      start: 6,
      end: 6.25,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 58,
      start: 6.5,
      end: 6.75,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 60,
      start: 6.75,
      end: 7,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 58,
      start: 7.25,
      end: 7.5,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 60,
      start: 7.5,
      end: 7.75,
      lifted: true,
      velocity: 0.7874015748031497,
    },
  ],
};

export const doingTheThingsMelody: NoteExample = {
  patternDescription: 'an EDM melody with a rising motif and staccato notes, with an implied key of',
  pitchDescription: 'C4',
  timingQualifier: 'with interesting rhythm and a mixture of fast and slow runs, with slightly more',
  timing: Timing.Eighth,
  holdDescription: 'played legato',
  notes: [
    {
      type: 'Comment',
      comment: `This clip loops, so the notes at the end will lead to the notes we're playing here - this is really the middle of this part of the melody.`,
    },
    {
      pitch: 55,
      start: 0.5,
      end: 0.75,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 55,
      start: 1,
      end: 1.25,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 53,
      start: 1.5,
      end: 1.75,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 55,
      start: 2,
      end: 2.25,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      type: 'Comment',
      comment: `Repeat the main melody, we'll add a variation at the top.`,
    },
    {
      pitch: 50,
      start: 3,
      end: 3.25,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 53,
      start: 3.25,
      end: 3.5,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 55,
      start: 3.5,
      end: 3.75,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 57,
      start: 3.75,
      end: 4,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 57,
      start: 4.25,
      end: 4.5,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 55,
      start: 4.5,
      end: 4.75,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 55,
      start: 5,
      end: 5.25,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      type: 'Comment',
      comment: `This note is the key variation - going up to the 2nd instead of down to the 7th.`,
    },
    {
      pitch: 57,
      start: 5.5,
      end: 5.75,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 55,
      start: 6,
      end: 6.25,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      type: 'Comment',
      comment: `Now we repeat for the last time, going back to the first variation.`,
    },
    {
      pitch: 50,
      start: 7,
      end: 7.25,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 55,
      start: 7.25,
      end: 7.5,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 57,
      start: 7.5,
      end: 7.75,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 58,
      start: 7.75,
      end: 8.5,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 55,
      start: 8.5,
      end: 8.75,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 55,
      start: 9,
      end: 9.25,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 53,
      start: 9.5,
      end: 9.75,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 55,
      start: 10,
      end: 10.25,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      type: 'Comment',
      comment: `We end the melody with a final flourish over the tonic.`,
    },
    {
      pitch: 55,
      start: 11,
      end: 11.25,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 57,
      start: 11.25,
      end: 12,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 55,
      start: 12,
      end: 12.25,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      type: 'Comment',
      comment: `We're at the end of the loop. These notes are leading back into the start for the next repetition.`,
    },
    {
      pitch: 50,
      start: 15,
      end: 15.25,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 55,
      start: 15.25,
      end: 15.5,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 57,
      start: 15.5,
      end: 15.75,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 58,
      start: 15.75,
      end: 16,
      lifted: true,
      velocity: 0.7874015748031497,
    },
  ],
};

export const edmMelody: NoteExample = {
  patternDescription: 'a driving, bright, uplifting EDM-Style melody, starting on',
  pitchDescription: 'G4',
  timingQualifier: 'built around',
  timing: Timing.Quarter,
  holdDescription: 'played legato',
  notes: [
    {
      type: 'Comment',
      comment:
        'Start with four notes, right on beat. All the same pitch - the tonic - to establish the root note and the driving rhythm.',
    },
    {
      pitch: 55,
      start: 0,
      end: 0.75,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 55,
      start: 1,
      end: 1.75,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 55,
      start: 2,
      end: 2.75,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      type: 'Comment',
      comment:
        'The fourth note starts a short upward run to the minor third, opening up the harmony and revealing the minor key.',
    },
    {
      pitch: 55,
      start: 3,
      end: 3.25,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 57,
      start: 3.5,
      end: 3.75,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      type: 'Comment',
      comment: 'Repeat the minor third twice on-beat to continue the rhythm from the start.',
    },
    {
      pitch: 58,
      start: 4,
      end: 4.75,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 58,
      start: 5,
      end: 5.625,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      type: 'Comment',
      comment:
        "Now we run down to the minor 7th, before we reach the end of the loop. When th clip loops, we'll return to the four tonics.",
    },
    {
      pitch: 57,
      start: 6,
      end: 6.25,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 55,
      start: 6.5,
      end: 6.75,
      lifted: true,
      velocity: 0.7874015748031497,
    },
    {
      pitch: 53,
      start: 7,
      end: 7.625,
      lifted: true,
      velocity: 0.7874015748031497,
    },
  ],
};
