lib/music/chord.rb
def inversion(amount)
      fail ArgumentError, 'Inversion amount must be greater than or equal to 1' if amount < 1
      fail ArgumentError, 'Not enough notes in chord for inversion' if amount >= @notes.size

      note_array = @notes.to_a.sort
      notes = (0...amount).collect { note_array.shift.adjust_by_semitones(12) }
      Chord.new(notes + note_array)
    end
def inversion(amount)
      fail ArgumentError, 'Inversion amount must be greater than or equal to 1' if amount < 1
      fail ArgumentError, 'Not enough notes in chord for inversion' if amount >= @notes.size

      note_array = @notes.to_a.sort
      notes = (0...amount).collect { note_array.shift.adjust_by_semitones(12) }
      Chord.new(notes + note_array)
    end
def inversion ( amount ) fail ArgumentError , 'Inversion amount must be greater than or equal to 1' if amount < 1 fail ArgumentError , 'Not enough notes in chord for inversion' if amount >= @notes . size note_array = @notes . to_a . sort notes = ( 0 ... amount ) . collect { note_array . shift . adjust_by_semitones ( 12 ) } Chord . new ( notes + note_array ) end
Give the Nth inversion of the chord which simply adjusts the lowest N notes up by one octive

 @returns [Chord] The specified inversion of chord
Give the Nth inversion of the chord which simply adjusts the lowest N notes up by one octive