       for n in frets for right in following_finger_positions)...)
 
   generate_fingerings = ->
-    (new Fingering {positions, chord} for positions in collect_fingering_positions(frets_per_string))
+    _.flatten(new Fingering {positions, chord, barres} \
+      for barres in find_barre_sets(positions) \
+      for positions in collect_fingering_positions(frets_per_string))
 
   chord_note_count = chord.pitch_classes.length
 

    return fingering.fretstring.match(/x$/)

  finger_count = (fingering) ->
    fingering.barres ||= find_barres(fingering.positions)
    n = (pos for pos in fingering.positions when pos.fret).length
    n -= barre.subsumption_count for barre in fingering.barres
    n

  few_fingers = (fingering) ->
    return finger_count(fingering) <= 4

  cmp = (fn) -> (x...) -> !fn(x...)

  filters = [
    {name: 'has all chord notes', filter: has_all_notes},
    {name: 'no muted medial strings', filter: cmp(muted_medial_strings)},
    {name: 'no muted treble strings', filter: cmp(muted_treble_strings)},
    {name: 'no more than four fingers', filter: few_fingers}
  ]

  unless options.filter
    filters = [{name: 'has all chord notes', filter: has_all_notes}]

  filter_fingerings = (fingerings) ->
    for {name, filter} in filters
      filtered = (fingering for fingering in fingerings when filter(fingering))
      unless filtered.length
        console.error "#{chord_name}: no fingerings pass filter \"#{name}\"" if warn
        filtered = fingerings
      fingerings = filtered
    return fingerings

      subsumption_count: m[1].match(/x/g).length
  barres

find_barre_sets = (positions) ->
  powerset = (xs) ->
    return [[]] unless xs.length
    [x, xs...] = xs
    tail = powerset xs
    tail.concat([x].concat(ys) for ys in tail)
  barres = find_barres positions
  return powerset barres

finger_positions_on_chord = (chord) ->
  positions = []
  fretboard_positions_each (pos) ->
