Her name is Cherry; we've just met

Third cut of a guitar chord shape generator. Given a fretted instrument with a particular tuning (eg. 6 string guitar tuned EADGBE), the generator will produce the frettings necessary to play any specified chord. This is not done from a chord library, but algorithmically (hence should work with whacky tunings). This version doesn't fully respect the limitations of the human hand beyond specifying a maximum 'stretch' of a few frets, so some of the shapes generated would need a friend to help play them! This will be dealt with in a future version. This third version contains improved handling of differing tunings and instruments (eg. DADGAD; banjo) but still doesn't check for unplayable shapes.

Copy Source
Copy Link
Tools:
  1: // How many semitones in Western music:
  2: let SEMITONES_PER_OCTAVE = 12
  3: 
  4: // Flat, Natural or Sharp:
  5: type TAccidental = Flat | Natural | Sharp
  6: // A note name, accidental and chromatic index but without specifying the octave it is in - eg. G#, A, or Bb:
  7: type TNoteLabel = {name : char; accidental : TAccidental; chromaticIndex : int}
  8: // A note including its specific octave - eg. G# in octave 2 (from an arbitrary lowest octave):
  9: type TNote = {label : TNoteLabel; octave : int}
 10: // An array of the chromatic indices of notes forming a chord type:
 11: type TChordIndexes = array<int>
 12: // Whether a chord is major or minor:
 13: type TScaleType = Major | Minor
 14: // A Relative Chord in terms of the chromatic indices of its notes - eg. [|0; 4; 7; 12|]; Major is an ordinary
 15: // major chord:
 16: type TChordType = {chordIndexes : TChordIndexes; scaleType : TScaleType}
 17: // An Absolute Chord - eg. C major:
 18: type TChord = array<TNote>
 19: // When translating an index to a readable note, determines whether to prefer the sharp version
 20: // or the flat version when encountering an enharmonic:
 21: type TEnharmonicPreference = PreferFlat | PreferSharp | PreferNeither
 22: 
 23: // A way of noting which notes have been covered during the generation of a chord:
 24: type TNoteMapping = {mappedNote : TNote; mutable useCount : int}
 25: 
 26: // How an instrument is tuned - eg. conventional guitar tuning is EADGBE', 'dropped D' tuning is DADGBE'.
 27: type TTuning = array<TNote>
 28: 
 29: // A combination of string and fret - the actual location of a fingering on the neck:
 30: type TFretting = {stringIndex : int; fretIndex : int}
 31: // A fretting plus the note that would result from that fretting:
 32: type TFrettedNote = {fretting : TFretting; note : TNote}
 33: 
 34: /// Any fretted instrument:
 35: type TInstrument (fretCount : int, tuning : TTuning) = 
 36:     member this.fretCount = fretCount // Includes nut at 0
 37:     member this.tuning = tuning
 38:     // TODO ensure tuning is the same size as strings
 39: 
 40: /// All human readable note names, including enharmonics (but not bothering with double-flats, double-sharps):
 41: let allNotes =
 42:     [|
 43:         {name = 'A'; accidental = Natural; chromaticIndex = 0}
 44:         {name = 'A'; accidental = Sharp; chromaticIndex = 1}
 45: 
 46:         {name = 'B'; accidental = Flat; chromaticIndex = 1}
 47:         {name = 'B'; accidental = Natural; chromaticIndex = 2}
 48:         {name = 'B'; accidental = Sharp; chromaticIndex = 3}
 49: 
 50:         {name = 'C'; accidental = Flat; chromaticIndex = 2}
 51:         {name = 'C'; accidental = Natural; chromaticIndex = 3}
 52:         {name = 'C'; accidental = Sharp; chromaticIndex = 4}
 53: 
 54:         {name = 'D'; accidental = Flat; chromaticIndex = 4}
 55:         {name = 'D'; accidental = Natural; chromaticIndex = 5}
 56:         {name = 'D'; accidental = Sharp; chromaticIndex = 6}
 57: 
 58:         {name = 'E'; accidental = Flat; chromaticIndex = 6}
 59:         {name = 'E'; accidental = Natural; chromaticIndex = 7}
 60:         {name = 'E'; accidental = Sharp; chromaticIndex = 8}
 61: 
 62:         {name = 'F'; accidental = Flat; chromaticIndex = 7}
 63:         {name = 'F'; accidental = Natural; chromaticIndex = 8}
 64:         {name = 'F'; accidental = Sharp; chromaticIndex = 9}
 65: 
 66:         {name = 'G'; accidental = Flat; chromaticIndex = 9}
 67:         {name = 'G'; accidental = Natural; chromaticIndex = 10}
 68:         {name = 'G'; accidental = Sharp; chromaticIndex = 11}
 69: 
 70:         {name = 'A'; accidental = Flat; chromaticIndex = 11}
 71:     |]
 72: 
 73: /// Some useful constants for notes:
 74: let ANat = {name = 'A'; accidental = Natural; chromaticIndex = 0}
 75: let ASharp = {name = 'A'; accidental = Sharp; chromaticIndex = 1}
 76: 
 77: let BFlat = {name = 'B'; accidental = Flat; chromaticIndex = 1}
 78: let BNat = {name = 'B'; accidental = Natural; chromaticIndex = 2}
 79: let BSharp = {name = 'B'; accidental = Sharp; chromaticIndex = 3}
 80: 
 81: let CFlat = {name = 'C'; accidental = Flat; chromaticIndex = 2}
 82: let CNat = {name = 'C'; accidental = Natural; chromaticIndex = 3}
 83: let CSharp = {name = 'C'; accidental = Sharp; chromaticIndex = 4}
 84: 
 85: let DFlat = {name = 'D'; accidental = Flat; chromaticIndex = 4}
 86: let DNat = {name = 'D'; accidental = Natural; chromaticIndex = 5}
 87: let DSharp = {name = 'D'; accidental = Sharp; chromaticIndex = 6}
 88: 
 89: let EFlat = {name = 'E'; accidental = Flat; chromaticIndex = 6}
 90: let ENat = {name = 'E'; accidental = Natural; chromaticIndex = 7}
 91: let ESharp = {name = 'E'; accidental = Sharp; chromaticIndex = 8}
 92: 
 93: let FFlat = {name = 'F'; accidental = Flat; chromaticIndex = 7}
 94: let FNat = {name = 'F'; accidental = Natural; chromaticIndex = 8}
 95: let FSharp = {name = 'F'; accidental = Sharp; chromaticIndex = 9}
 96: 
 97: let GFlat = {name = 'G'; accidental = Flat; chromaticIndex = 9}
 98: let GNat = {name = 'G'; accidental = Natural; chromaticIndex = 10}
 99: let GSharp = {name = 'G'; accidental = Sharp; chromaticIndex = 11}
100: 
101: let AFlat = {name = 'A'; accidental = Flat; chromaticIndex = 11}
102: 
103: /// An operator to concatenate two arrays:
104: let (@@) a b =
105:     Array.concat [a; b]
106: 
107: // Common Relative Chords, in terms of the chromatic indexes of their constituent tones
108: let major : TChordType = {chordIndexes = [|0; 4; 7; 12|]; scaleType = Major}
109: let minor : TChordType = {chordIndexes = [|0; 3; 7; 12|]; scaleType = Minor}
110: let diminished : TChordType = {chordIndexes = [|0; 3; 6; 12|]; scaleType = Minor}
111: let augmented : TChordType = {chordIndexes = [|0; 5; 8; 12|]; scaleType = Major} // TODO check
112: let seventh : TChordType = {chordIndexes = major.chordIndexes @@ [|10|]; scaleType = Major}
113: let majorSeventh : TChordType = {chordIndexes = major.chordIndexes @@ [|11|]; scaleType = Major}
114: let minorSeventh : TChordType = {chordIndexes = minor.chordIndexes @@ [|10|]; scaleType = Minor}
115: 
116: /// Work out the human-readable note name for a particular chromatic index
117: let indexToName (index : int) (enharmonicPreference : TEnharmonicPreference) =
118:     allNotes
119:     |> Array.sortBy (fun item -> 
120:                             match enharmonicPreference with
121:                             | PreferFlat ->
122:                                             match item.accidental with
123:                                             | Flat -> 0
124:                                             | Natural -> 1
125:                                             | Sharp -> 2
126:                             | PreferSharp ->
127:                                             match item.accidental with
128:                                             | Sharp -> 0
129:                                             | Natural -> 1
130:                                             | Flat -> 2
131:                             | PreferNeither ->
132:                                             match item.accidental with
133:                                             | Natural -> 0
134:                                             | Flat -> 1
135:                                             | Sharp -> 2
136:                     )
137:     |> Array.find (fun item -> item.chromaticIndex = index)
138: 
139: /// Work out the absolute chromatic index of a given note (ie. including the octave)
140: let noteToIndex (note : TNote) =
141:     (note.octave * SEMITONES_PER_OCTAVE) + note.label.chromaticIndex
142: 
143: /// Work out into what octave a particular semitone falls (from an arbitrary lower basis)
144: let indexToOctave (index : int) =
145:     index / SEMITONES_PER_OCTAVE
146: 
147: /// Work out the human-readable note (including octave) for a particular semitone
148: let indexToNote (index : int) (enharmonicPreference : TEnharmonicPreference) =
149:     {label = indexToName (index % SEMITONES_PER_OCTAVE) enharmonicPreference; octave = indexToOctave index}
150: 
151: /// An operator to detect whether one note is the same as or is an enharmonic of another (ignoring octave)
152: let (=~) note1 note2 =
153:     note1.chromaticIndex = note2.chromaticIndex
154: 
155: /// As =~ but the compared notes must also be the same octave
156: let (==~) note1 note2 =
157:     (note1.label =~ note2.label)
158:     && (note1.octave = note2.octave)
159: 
160: /// Return a note which is n semitones higher than the input note
161: let addSemitones note semitones enharmonicPreference =
162:     let newIndex = noteToIndex(note) + semitones
163:     indexToNote newIndex enharmonicPreference 
164: 
165: /// Return the note which results from playing the specified string at the specified fret:
166: let frettingToNote (instrument : TInstrument) (fretting : TFretting) : TNote =
167:     let openNote = instrument.tuning.[fretting.stringIndex]
168:     let frettedNote = addSemitones openNote fretting.fretIndex PreferNeither
169:     frettedNote
170: 
171: /// Given the root note and scale type of a chord, work out whether any sharps/flats in the chord
172: /// should be expressed using the sharp or the flat of an enharmonic pair 
173: let rootNoteToEnharmonicPreference (rootNote : TNote) (scaleType : TScaleType) =
174:     match (rootNote.label.name, rootNote.label.accidental) with
175:         // TODO many of these need checking
176:         | ('A', Natural) -> 
177:             match scaleType with
178:                 | Major -> PreferSharp
179:                 | Minor -> PreferFlat
180:         | ('A', Sharp) -> 
181:             match scaleType with
182:                 | Major -> PreferSharp
183:                 | Minor -> PreferSharp
184:         | ('B', Flat) -> 
185:             match scaleType with
186:                 | Major -> PreferFlat
187:                 | Minor -> PreferFlat
188:         | ('B', Natural) -> 
189:             match scaleType with
190:                 | Major -> PreferSharp
191:                 | Minor -> PreferFlat
192:         | ('C', Natural) -> 
193:             match scaleType with
194:                 | Major -> PreferSharp
195:                 | Minor -> PreferFlat
196:         | ('C', Sharp) -> 
197:             match scaleType with
198:                 | Major -> PreferSharp
199:                 | Minor -> PreferSharp
200:         | ('D', Flat) -> 
201:             match scaleType with
202:                 | Major -> PreferFlat
203:                 | Minor -> PreferFlat
204:         | ('D', Natural) -> 
205:             match scaleType with
206:                 | Major -> PreferSharp
207:                 | Minor -> PreferFlat
208:         | ('D', Sharp) -> 
209:             match scaleType with
210:                 | Major -> PreferSharp
211:                 | Minor -> PreferSharp
212:         | ('E', Flat) -> 
213:             match scaleType with
214:                 | Major -> PreferFlat
215:                 | Minor -> PreferFlat
216:         | ('E', Natural) -> 
217:             match scaleType with
218:                 | Major -> PreferSharp
219:                 | Minor -> PreferFlat
220:         | ('F', Natural) -> 
221:             match scaleType with
222:                 | Major -> PreferFlat
223:                 | Minor -> PreferSharp
224:         | ('F', Sharp) -> 
225:             match scaleType with
226:                 | Major -> PreferSharp
227:                 | Minor -> PreferSharp
228:         | ('G', Flat) -> 
229:             match scaleType with
230:                 | Major -> PreferFlat
231:                 | Minor -> PreferFlat
232:         | ('G', Natural) -> 
233:             match scaleType with
234:                 | Major -> PreferSharp
235:                 | Minor -> PreferSharp
236:         | ('G', Sharp) -> 
237:             match scaleType with
238:                 | Major -> PreferSharp
239:                 | Minor -> PreferSharp
240:         | ('A', Flat) -> 
241:             match scaleType with
242:                 | Major -> PreferFlat
243:                 | Minor -> PreferFlat
244:         | _ -> failwith "rootNoteToEnharmonicPreference: Unexpected root note: %A" rootNote
245: 
246: /// Takes a root note and chord type and returns the actual notes of the chord:
247: let chordOf (rootNote : TNote) (chordType : TChordType) =
248:     chordType.chordIndexes
249:     |> Array.map (fun index -> addSemitones rootNote index (rootNoteToEnharmonicPreference rootNote chordType.scaleType) )
250: 
251: /// List all the notes you could play on a given string between a lowest and highest fret
252: let notesBetween (instrument : TInstrument) (stringIndex : int) (lowestFret : int) (highestFret : int) : seq<TFrettedNote> =
253:     let frettedNotes = 
254:         seq {
255:             for fret in lowestFret..highestFret do 
256:                 let aFretting = {stringIndex = stringIndex; fretIndex = fret}
257:                 let aNote = frettingToNote instrument aFretting
258:                 yield {fretting = aFretting; note = aNote}
259:         } 
260:     frettedNotes
261: 
262: /// As notesBetween but also including the note produced by the same string played open
263: let notesBetweenAndOpen (instrument : TInstrument) (stringIndex : int) (lowestFret : int) (highestFret : int) : seq<TFrettedNote> =
264:     (notesBetween instrument stringIndex 0 0) |> Seq.append <| (notesBetween instrument stringIndex lowestFret highestFret)
265: 
266: /// List all the notes which could be played in a range of frets, including notes available by playing a string open
267: let notesInBox (instrument : TInstrument) (lowestFret : int) (highestFret : int) =
268:     [|(Array.length instrument.tuning)-1..-1..0|] // Reverse order because the lowest pitch string is conventionally numbered highest
269:     |> Array.map (fun stringIndex -> notesBetweenAndOpen instrument stringIndex lowestFret highestFret)
270: 
271: /// Given two sequences and a comparator function, find the pairs of items for which the comparator returns true
272: let findPairs compare seqT seqU =
273:     seq {
274:             for t in seqT do
275:                 for u in seqU do
276:                     if (compare t u) then
277:                         yield (t, u)
278:     }
279: 
280: /// Given a two sequences and a comparator function, find the first pair of items for which the comparator returns true
281: let tryFindFirstPair compare seqT seqU =
282:     let matches = findPairs compare seqT seqU
283:     if not (Seq.isEmpty matches) then
284:         Some(Seq.nth 0 matches)
285:     else
286:         None
287: 
288: /// Print the frettings for a shape
289: let printShape (label : string) (shape : seq<TFrettedNote>) =
290:     printfn "%s" label
291:     shape
292:     |> Seq.iter (fun fretting -> printfn "String %i fret %i" (fretting.fretting.stringIndex+1) (fretting.fretting.fretIndex) )
293:     |> ignore
294: 
295: /// For a given chord, search through the notes which could be played within a given range of frets to try and
296: /// provide a set of frettings which plays the notes for the chord:
297: let findShape (instrument : TInstrument) (lowestFret : int) (highestFret : int) (chord : TChord) =
298:     // Create a map of required notes and how many times they have been found (initially all 0):
299:     let wantedNotes = chord |> Array.map (fun note -> {mappedNote = note; useCount = 0})
300:     // A way to update the map to indicate that this note of the chord has been successfully provided:
301:     let markDone note =
302:         let mapIndex = wantedNotes |> Array.findIndex (fun item -> item.mappedNote = note)
303:         wantedNotes.[mapIndex].useCount <- wantedNotes.[mapIndex].useCount + 1
304:     // Create a list of notes are needed in priority order, where priority is defined as
305:     // first, prioritise notes which haven't been found at all; and second, prioritise notes in low-to-high order:
306:     // (Defined as a function() so that when a note is marked as provided it goes to the back of the queue.)
307:     let notesInPriorityOrder() = 
308:         let result = 
309:             wantedNotes 
310:             |> Array.sortBy (fun item -> (item.useCount*100) + (noteToIndex item.mappedNote))
311:             |> Array.map (fun item -> item.mappedNote)
312:             |> Seq.ofArray
313:         result
314:     // Set up a value and flag to help ensure we find the root note first:
315:     let rootNote = chord.[0]
316:     let rootNoteFound = ref false
317:     // Go through the strings from low to high listing the notes that string could play:
318:     let frettings =
319:         seq {for availableNotesForString in (notesInBox instrument lowestFret highestFret) do
320:                 // Search the available notes and the required notes (the latter in priority order) finding the first
321:                 // instance (if any) on this string where the required note can be played. (Since we use the =~ this might be in
322:                 // any octave.)
323:                 let hit = tryFindFirstPair (fun wantedNote availNote -> availNote.note.label =~ wantedNote.label) 
324:                                                 (notesInPriorityOrder()) availableNotesForString 
325:                 // If we found a note (if we haven't yet found the root note, this needs to be the root note):
326:                 if (hit <> None) && (((snd(hit.Value).note.label) =~ rootNote.label) || !rootNoteFound) then 
327:                     // If we just found the root note, flag the fact:
328:                     if not !rootNoteFound then
329:                         rootNoteFound := true;
330:                     // Flag that this note has been found at least once:
331:                     markDone (fst(hit.Value))
332:                     // Yield the note together with its fretting:
333:                     yield snd(hit.Value) 
334:         }
335:     // Sort the output by string:
336:     frettings
337:     |> Seq.sortBy (fun fretting -> fretting.fretting.stringIndex)
338:     
339: // Examples:
340: 
341: 
342: // Ordinary 6-string with EADGBE tuning:
343: let standardGuitar = new TInstrument(
344:                                 19, // Including nut
345:                                 [|  // Treble side
346:                                     {label=ENat; octave=2}
347:                                     {label=BNat; octave=2}
348:                                     {label=GNat; octave=1}
349:                                     {label=DNat; octave=1}
350:                                     {label=ANat; octave=1}
351:                                     {label=ENat; octave=0}
352:                                     // Bass side
353:                                 |]
354:                               )
355: 
356: let droppedDGuitar = new TInstrument(
357:                                 19, // Including nut
358:                                 [|  // Treble side
359:                                     {label=ENat; octave=2}
360:                                     {label=BNat; octave=2}
361:                                     {label=GNat; octave=1}
362:                                     {label=DNat; octave=1}
363:                                     {label=ANat; octave=1}
364:                                     {label=DNat; octave=0}
365:                                     // Bass side
366:                                 |]
367:                               )
368: 
369: let celticGuitar =  new TInstrument(
370:                                 19, // Including nut
371:                                 [|  // Treble side
372:                                     {label=DNat; octave=2}
373:                                     {label=ANat; octave=2}
374:                                     {label=GNat; octave=1}
375:                                     {label=DNat; octave=1}
376:                                     {label=ANat; octave=1}
377:                                     {label=DNat; octave=0}
378:                                     // Bass side
379:                                 |]
380:                               )
381: 
382: // This is the first and last time I shall have involvement with 'progressive Metal'.
383: // Seven stringed guitar used by 'TesseracT' - no, really: http://en.wikipedia.org/wiki/DADGAD
384: let tesseractGuitar =  new TInstrument(
385:                                 19, // Including nut
386:                                 [|  // Treble side
387:                                     {label=EFlat; octave=2}
388:                                     {label=BFlat; octave=2}
389:                                     {label=GFlat; octave=1}
390:                                     {label=EFlat; octave=1}
391:                                     {label=BFlat; octave=1}
392:                                     {label=FNat; octave=0}
393:                                     {label=BFlat; octave=0}
394:                                     // Bass side
395:                                 |]
396:                               )
397: 
398: let plectrumBanjo =  new TInstrument(
399:                                 23, // Including nut
400:                                 [|  // Treble side
401:                                     {label=DNat; octave=1}
402:                                     {label=BNat; octave=0}
403:                                     {label=GNat; octave=0}
404:                                     {label=CNat; octave=0}
405:                                     // Bass side
406:                                 |]
407:                               )
408: 
409: // Some chords to play:
410: let CMaj = chordOf {label=CNat; octave=1} major
411: let DMaj = chordOf {label=DNat; octave=1} major
412: let DMin = chordOf {label=DNat; octave=1} minor
413: let D7 = chordOf {label=DNat; octave=1} seventh
414: let DMaj7 = chordOf {label=DNat; octave=1} majorSeventh
415: let EMaj = chordOf {label=ENat; octave=0} major
416: let EMin = chordOf {label=ENat; octave=0} minor
417: let AMaj = chordOf {label=ANat; octave=1} major
418: let AMin = chordOf {label=ANat; octave=1} minor
419: let ADim = chordOf {label=ANat; octave=1} diminished
420: 
421: // Generate fingerings for a standard guitar
422: findShape standardGuitar 0 3 CMaj |> printShape "C Major" |> ignore
423: findShape standardGuitar 0 3 EMaj |> printShape "E Major" |> ignore
424: findShape standardGuitar 0 3 EMin |> printShape "E Minor" |> ignore
425: findShape standardGuitar 0 3 AMaj |> printShape "A Major" |> ignore
426: findShape standardGuitar 0 3 AMin |> printShape "A Minor" |> ignore
427: findShape standardGuitar 0 3 ADim |> printShape "A Dim" |> ignore
428: findShape standardGuitar 0 3 DMaj |> printShape "D Major" |> ignore
429: findShape standardGuitar 0 3 DMin |> printShape "D Minor" |> ignore
430: findShape standardGuitar 0 3 D7 |> printShape "D seventh" |> ignore
431: findShape standardGuitar 0 3 DMaj7 |> printShape "D major seventh" |> ignore
432: 
433: // Some lower D-chords for the dropped D guitar and Celtic guitars:
434: let DMajLow = chordOf {label=DNat; octave=0} major
435: let DMinLow = chordOf {label=DNat; octave=0} minor
436: let D7Low = chordOf {label=DNat; octave=0} seventh
437: let DMaj7Low = chordOf {label=DNat; octave=0} majorSeventh
438: 
439: // Generate fingerings for a dropped-D guitar
440: findShape droppedDGuitar 0 3 CMaj |> printShape "C Major" |> ignore
441: findShape droppedDGuitar 0 3 EMaj |> printShape "E Major" |> ignore
442: findShape droppedDGuitar 0 3 EMin |> printShape "E Minor" |> ignore
443: findShape droppedDGuitar 0 3 AMaj |> printShape "A Major" |> ignore
444: findShape droppedDGuitar 0 3 AMin |> printShape "A Minor" |> ignore
445: findShape droppedDGuitar 0 3 ADim |> printShape "A Dim" |> ignore
446: findShape droppedDGuitar 0 3 DMajLow |> printShape "D Major (low)" |> ignore
447: findShape droppedDGuitar 0 3 DMinLow |> printShape "D Minor (low)" |> ignore
448: findShape droppedDGuitar 0 3 D7Low |> printShape "D seventh (low)" |> ignore
449: findShape droppedDGuitar 0 3 DMaj7Low |> printShape "D major seventh (low)" |> ignore
450: 
451: // Generate fingerings for a Celtic guitar
452: findShape celticGuitar 0 3 CMaj |> printShape "C Major" |> ignore
453: findShape celticGuitar 0 3 EMaj |> printShape "E Major" |> ignore
454: findShape celticGuitar 0 3 EMin |> printShape "E Minor" |> ignore
455: findShape celticGuitar 0 3 AMaj |> printShape "A Major" |> ignore
456: findShape celticGuitar 0 3 AMin |> printShape "A Minor" |> ignore
457: findShape celticGuitar 0 3 ADim |> printShape "A Dim" |> ignore
458: // Needs a bit more of a stretch to get an F#
459: findShape celticGuitar 0 4 DMajLow |> printShape "D Major (low)" |> ignore 
460: findShape celticGuitar 0 3 DMinLow |> printShape "D Minor (low)" |> ignore
461: findShape celticGuitar 0 3 D7Low |> printShape "D seventh (low)" |> ignore
462: findShape celticGuitar 0 3 DMaj7Low |> printShape "D major seventh (low)" |> ignore
463: 
464: // Generate fingerings for a TesseracT's guitar
465: findShape tesseractGuitar 0 3 CMaj |> printShape "C Major" |> ignore
466: findShape tesseractGuitar 0 3 EMaj |> printShape "E Major" |> ignore
467: findShape tesseractGuitar 0 3 EMin |> printShape "E Minor" |> ignore
468: findShape tesseractGuitar 0 3 AMaj |> printShape "A Major" |> ignore
469: findShape tesseractGuitar 0 3 AMin |> printShape "A Minor" |> ignore
470: 
471: // We have to go up the neck a bit to find some Ds - and even then these are
472: // probably unplayable at the moment:
473: findShape tesseractGuitar 4 7 ADim |> printShape "A Dim" |> ignore
474: findShape tesseractGuitar 4 7 DMaj |> printShape "D Major" |> ignore
475: findShape tesseractGuitar 4 7 DMin |> printShape "D Minor" |> ignore
476: findShape tesseractGuitar 4 7 D7 |> printShape "D seventh" |> ignore
477: findShape tesseractGuitar 4 7 DMaj7 |> printShape "D major seventh" |> ignore
478: 
479: // Generate fingerings for a plectrum banjo
480: findShape plectrumBanjo 0 3 CMaj |> printShape "C Major" |> ignore
481: 
482: // Up the neck a bit for Es - I don't have a banjo to check these are playable!
483: findShape plectrumBanjo 1 4 EMaj |> printShape "E Major" |> ignore
484: findShape plectrumBanjo 1 4 EMin |> printShape "E Minor" |> ignore
485: 
486: findShape plectrumBanjo 0 3 AMaj |> printShape "A Major" |> ignore
487: findShape plectrumBanjo 0 3 AMin |> printShape "A Minor" |> ignore
488: findShape plectrumBanjo 0 3 ADim |> printShape "A Dim" |> ignore
489: findShape plectrumBanjo 0 3 DMaj |> printShape "D Major" |> ignore
490: findShape plectrumBanjo 0 3 DMin |> printShape "D Minor" |> ignore
491: findShape plectrumBanjo 0 3 D7 |> printShape "D seventh" |> ignore
492: findShape plectrumBanjo 0 3 DMaj7 |> printShape "D major seventh" |> ignore
493: 
494: // Example output for the first standard guitar line:
495: //  C Major
496: //  String 1 fret 0
497: //  String 2 fret 1
498: //  String 3 fret 0
499: //  String 4 fret 2
500: //  String 5 fret 3
501: 
502: // Example output for the final banjo line:
503: //  D major seventh
504: //  String 1 fret 0
505: //  String 2 fret 2
506: //  String 3 fret 2
507: //  String 4 fret 2
508: 
val SEMITONES_PER_OCTAVE : int

Full name: Snippet.SEMITONES_PER_OCTAVE

  type: int
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<int>
  implements: System.IEquatable<int>
  inherits: System.ValueType
type TAccidental =
  | Flat
  | Natural
  | Sharp

Full name: Snippet.TAccidental

  type: TAccidental
  implements: System.IEquatable<TAccidental>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TAccidental>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
union case TAccidental.Flat: TAccidental
union case TAccidental.Natural: TAccidental
union case TAccidental.Sharp: TAccidental
type TNoteLabel =
  {name: char;
   accidental: TAccidental;
   chromaticIndex: int;}

Full name: Snippet.TNoteLabel

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
TNoteLabel.name: char
Multiple items
val char : 'T -> char (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.char

--------------------

type char = System.Char

Full name: Microsoft.FSharp.Core.char

  type: char
  implements: System.IComparable
  implements: System.IConvertible
  implements: System.IComparable<char>
  implements: System.IEquatable<char>
  inherits: System.ValueType
TNoteLabel.accidental: TAccidental
TNoteLabel.chromaticIndex: int
Multiple items
val int : 'T -> int (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.int

--------------------

type int<'Measure> = int

Full name: Microsoft.FSharp.Core.int<_>

  type: int<'Measure>
  implements: System.IComparable
  implements: System.IConvertible
  implements: System.IFormattable
  implements: System.IComparable<int<'Measure>>
  implements: System.IEquatable<int<'Measure>>
  inherits: System.ValueType


--------------------

type int = int32

Full name: Microsoft.FSharp.Core.int

  type: int
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<int>
  implements: System.IEquatable<int>
  inherits: System.ValueType
type TNote =
  {label: TNoteLabel;
   octave: int;}

Full name: Snippet.TNote

  type: TNote
  implements: System.IEquatable<TNote>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNote>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
TNote.label: TNoteLabel
TNote.octave: int
type TChordIndexes = int array

Full name: Snippet.TChordIndexes

  type: TChordIndexes
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<int>
  implements: System.Collections.Generic.ICollection<int>
  implements: seq<int>
  implements: System.Collections.IEnumerable
  inherits: System.Array
type 'T array = 'T []

Full name: Microsoft.FSharp.Core.array<_>

  type: 'T array
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<'T>
  implements: System.Collections.Generic.ICollection<'T>
  implements: seq<'T>
  implements: System.Collections.IEnumerable
  inherits: System.Array
type TScaleType =
  | Major
  | Minor

Full name: Snippet.TScaleType

  type: TScaleType
  implements: System.IEquatable<TScaleType>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TScaleType>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
union case TScaleType.Major: TScaleType
union case TScaleType.Minor: TScaleType
type TChordType =
  {chordIndexes: TChordIndexes;
   scaleType: TScaleType;}

Full name: Snippet.TChordType

  type: TChordType
  implements: System.IEquatable<TChordType>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TChordType>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
TChordType.chordIndexes: TChordIndexes
TChordType.scaleType: TScaleType
type TChord = TNote array

Full name: Snippet.TChord

  type: TChord
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNote>
  implements: System.Collections.Generic.ICollection<TNote>
  implements: seq<TNote>
  implements: System.Collections.IEnumerable
  inherits: System.Array
type TEnharmonicPreference =
  | PreferFlat
  | PreferSharp
  | PreferNeither

Full name: Snippet.TEnharmonicPreference

  type: TEnharmonicPreference
  implements: System.IEquatable<TEnharmonicPreference>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TEnharmonicPreference>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
union case TEnharmonicPreference.PreferFlat: TEnharmonicPreference
union case TEnharmonicPreference.PreferSharp: TEnharmonicPreference
union case TEnharmonicPreference.PreferNeither: TEnharmonicPreference
type TNoteMapping =
  {mappedNote: TNote;
   mutable useCount: int;}

Full name: Snippet.TNoteMapping

  type: TNoteMapping
  implements: System.IEquatable<TNoteMapping>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteMapping>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
TNoteMapping.mappedNote: TNote
TNoteMapping.useCount: int
type TTuning = TNote array

Full name: Snippet.TTuning

  type: TTuning
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNote>
  implements: System.Collections.Generic.ICollection<TNote>
  implements: seq<TNote>
  implements: System.Collections.IEnumerable
  inherits: System.Array
type TFretting =
  {stringIndex: int;
   fretIndex: int;}

Full name: Snippet.TFretting

  type: TFretting
  implements: System.IEquatable<TFretting>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TFretting>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
TFretting.stringIndex: int
TFretting.fretIndex: int
type TFrettedNote =
  {fretting: TFretting;
   note: TNote;}

Full name: Snippet.TFrettedNote

  type: TFrettedNote
  implements: System.IEquatable<TFrettedNote>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TFrettedNote>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
TFrettedNote.fretting: TFretting
TFrettedNote.note: TNote
type TInstrument =
  class
    new : fretCount:int * tuning:TTuning -> TInstrument
    member fretCount : int
    member tuning : TTuning
  end

Full name: Snippet.TInstrument

Any fretted instrument:
val fretCount : int

  type: int
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<int>
  implements: System.IEquatable<int>
  inherits: System.ValueType
val tuning : TTuning

  type: TTuning
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNote>
  implements: System.Collections.Generic.ICollection<TNote>
  implements: seq<TNote>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val this : TInstrument
member TInstrument.fretCount : int

Full name: Snippet.TInstrument.fretCount
member TInstrument.tuning : TTuning

Full name: Snippet.TInstrument.tuning
val allNotes : TNoteLabel []

Full name: Snippet.allNotes

  type: TNoteLabel []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNoteLabel>
  implements: System.Collections.Generic.ICollection<TNoteLabel>
  implements: seq<TNoteLabel>
  implements: System.Collections.IEnumerable
  inherits: System.Array


All human readable note names, including enharmonics (but not bothering with double-flats, double-sharps):
val ANat : TNoteLabel

Full name: Snippet.ANat

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable


Some useful constants for notes:
val ASharp : TNoteLabel

Full name: Snippet.ASharp

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val BFlat : TNoteLabel

Full name: Snippet.BFlat

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val BNat : TNoteLabel

Full name: Snippet.BNat

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val BSharp : TNoteLabel

Full name: Snippet.BSharp

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val CFlat : TNoteLabel

Full name: Snippet.CFlat

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val CNat : TNoteLabel

Full name: Snippet.CNat

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val CSharp : TNoteLabel

Full name: Snippet.CSharp

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val DFlat : TNoteLabel

Full name: Snippet.DFlat

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val DNat : TNoteLabel

Full name: Snippet.DNat

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val DSharp : TNoteLabel

Full name: Snippet.DSharp

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val EFlat : TNoteLabel

Full name: Snippet.EFlat

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val ENat : TNoteLabel

Full name: Snippet.ENat

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val ESharp : TNoteLabel

Full name: Snippet.ESharp

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val FFlat : TNoteLabel

Full name: Snippet.FFlat

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val FNat : TNoteLabel

Full name: Snippet.FNat

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val FSharp : TNoteLabel

Full name: Snippet.FSharp

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val GFlat : TNoteLabel

Full name: Snippet.GFlat

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val GNat : TNoteLabel

Full name: Snippet.GNat

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val GSharp : TNoteLabel

Full name: Snippet.GSharp

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val AFlat : TNoteLabel

Full name: Snippet.AFlat

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val a : 'a []

  type: 'a []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<'a>
  implements: System.Collections.Generic.ICollection<'a>
  implements: seq<'a>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val b : 'a []

  type: 'a []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<'a>
  implements: System.Collections.Generic.ICollection<'a>
  implements: seq<'a>
  implements: System.Collections.IEnumerable
  inherits: System.Array
module Array

from Microsoft.FSharp.Collections
val concat : seq<'T []> -> 'T []

Full name: Microsoft.FSharp.Collections.Array.concat
val major : TChordType

Full name: Snippet.major

  type: TChordType
  implements: System.IEquatable<TChordType>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TChordType>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val minor : TChordType

Full name: Snippet.minor

  type: TChordType
  implements: System.IEquatable<TChordType>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TChordType>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val diminished : TChordType

Full name: Snippet.diminished

  type: TChordType
  implements: System.IEquatable<TChordType>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TChordType>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val augmented : TChordType

Full name: Snippet.augmented

  type: TChordType
  implements: System.IEquatable<TChordType>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TChordType>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val seventh : TChordType

Full name: Snippet.seventh

  type: TChordType
  implements: System.IEquatable<TChordType>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TChordType>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val majorSeventh : TChordType

Full name: Snippet.majorSeventh

  type: TChordType
  implements: System.IEquatable<TChordType>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TChordType>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val minorSeventh : TChordType

Full name: Snippet.minorSeventh

  type: TChordType
  implements: System.IEquatable<TChordType>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TChordType>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val indexToName : int -> TEnharmonicPreference -> TNoteLabel

Full name: Snippet.indexToName

Work out the human-readable note name for a particular chromatic index
val index : int

  type: int
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<int>
  implements: System.IEquatable<int>
  inherits: System.ValueType
val enharmonicPreference : TEnharmonicPreference

  type: TEnharmonicPreference
  implements: System.IEquatable<TEnharmonicPreference>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TEnharmonicPreference>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val sortBy : ('T -> 'Key) -> 'T [] -> 'T [] (requires comparison)

Full name: Microsoft.FSharp.Collections.Array.sortBy
val item : TNoteLabel

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val find : ('T -> bool) -> 'T [] -> 'T

Full name: Microsoft.FSharp.Collections.Array.find
val noteToIndex : TNote -> int

Full name: Snippet.noteToIndex

Work out the absolute chromatic index of a given note (ie. including the octave)
val note : TNote

  type: TNote
  implements: System.IEquatable<TNote>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNote>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val indexToOctave : int -> int

Full name: Snippet.indexToOctave

Work out into what octave a particular semitone falls (from an arbitrary lower basis)
val indexToNote : int -> TEnharmonicPreference -> TNote

Full name: Snippet.indexToNote

Work out the human-readable note (including octave) for a particular semitone
val note1 : TNoteLabel

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val note2 : TNoteLabel

  type: TNoteLabel
  implements: System.IEquatable<TNoteLabel>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteLabel>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val note1 : TNote

  type: TNote
  implements: System.IEquatable<TNote>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNote>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val note2 : TNote

  type: TNote
  implements: System.IEquatable<TNote>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNote>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val addSemitones : TNote -> int -> TEnharmonicPreference -> TNote

Full name: Snippet.addSemitones

Return a note which is n semitones higher than the input note
val semitones : int

  type: int
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<int>
  implements: System.IEquatable<int>
  inherits: System.ValueType
val newIndex : int

  type: int
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<int>
  implements: System.IEquatable<int>
  inherits: System.ValueType
val frettingToNote : TInstrument -> TFretting -> TNote

Full name: Snippet.frettingToNote

Return the note which results from playing the specified string at the specified fret:
val instrument : TInstrument
val fretting : TFretting

  type: TFretting
  implements: System.IEquatable<TFretting>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TFretting>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val openNote : TNote

  type: TNote
  implements: System.IEquatable<TNote>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNote>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
property TInstrument.tuning: TTuning
val frettedNote : TNote

  type: TNote
  implements: System.IEquatable<TNote>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNote>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val rootNoteToEnharmonicPreference : TNote -> TScaleType -> TEnharmonicPreference

Full name: Snippet.rootNoteToEnharmonicPreference

Given the root note and scale type of a chord, work out whether any sharps/flats in the chord
 should be expressed using the sharp or the flat of an enharmonic pair

val rootNote : TNote

  type: TNote
  implements: System.IEquatable<TNote>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNote>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val scaleType : TScaleType

  type: TScaleType
  implements: System.IEquatable<TScaleType>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TScaleType>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val failwith : string -> 'T

Full name: Microsoft.FSharp.Core.Operators.failwith
val chordOf : TNote -> TChordType -> TNote []

Full name: Snippet.chordOf

Takes a root note and chord type and returns the actual notes of the chord:
val chordType : TChordType

  type: TChordType
  implements: System.IEquatable<TChordType>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TChordType>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val map : ('T -> 'U) -> 'T [] -> 'U []

Full name: Microsoft.FSharp.Collections.Array.map
val notesBetween : TInstrument -> int -> int -> int -> seq<TFrettedNote>

Full name: Snippet.notesBetween

List all the notes you could play on a given string between a lowest and highest fret
val stringIndex : int

  type: int
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<int>
  implements: System.IEquatable<int>
  inherits: System.ValueType
val lowestFret : int

  type: int
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<int>
  implements: System.IEquatable<int>
  inherits: System.ValueType
val highestFret : int

  type: int
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<int>
  implements: System.IEquatable<int>
  inherits: System.ValueType
Multiple items
val seq : seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Core.Operators.seq

--------------------

type seq<'T> = System.Collections.Generic.IEnumerable<'T>

Full name: Microsoft.FSharp.Collections.seq<_>

  type: seq<'T>
  inherits: System.Collections.IEnumerable
val frettedNotes : seq<TFrettedNote>

  type: seq<TFrettedNote>
  inherits: System.Collections.IEnumerable
val fret : int

  type: int
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<int>
  implements: System.IEquatable<int>
  inherits: System.ValueType
val aFretting : TFretting

  type: TFretting
  implements: System.IEquatable<TFretting>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TFretting>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val aNote : TNote

  type: TNote
  implements: System.IEquatable<TNote>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNote>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val notesBetweenAndOpen : TInstrument -> int -> int -> int -> seq<TFrettedNote>

Full name: Snippet.notesBetweenAndOpen

As notesBetween but also including the note produced by the same string played open
module Seq

from Microsoft.FSharp.Collections
val append : seq<'T> -> seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Collections.Seq.append
val notesInBox : TInstrument -> int -> int -> seq<TFrettedNote> []

Full name: Snippet.notesInBox

List all the notes which could be played in a range of frets, including notes available by playing a string open
val length : 'T [] -> int

Full name: Microsoft.FSharp.Collections.Array.length
val findPairs : ('a -> 'b -> bool) -> seq<'a> -> seq<'b> -> seq<'a * 'b>

Full name: Snippet.findPairs

Given two sequences and a comparator function, find the pairs of items for which the comparator returns true
val compare : ('a -> 'b -> bool)
val seqT : seq<'a>

  type: seq<'a>
  inherits: System.Collections.IEnumerable
val seqU : seq<'b>

  type: seq<'b>
  inherits: System.Collections.IEnumerable
val t : 'a
val u : 'b
val tryFindFirstPair : ('a -> 'b -> bool) -> seq<'a> -> seq<'b> -> ('a * 'b) option

Full name: Snippet.tryFindFirstPair

Given a two sequences and a comparator function, find the first pair of items for which the comparator returns true
val matches : seq<'a * 'b>

  type: seq<'a * 'b>
  inherits: System.Collections.IEnumerable
val not : bool -> bool

Full name: Microsoft.FSharp.Core.Operators.not
val isEmpty : seq<'T> -> bool

Full name: Microsoft.FSharp.Collections.Seq.isEmpty
union case Option.Some: 'T -> Option<'T>
val nth : int -> seq<'T> -> 'T

Full name: Microsoft.FSharp.Collections.Seq.nth
union case Option.None: Option<'T>
val printShape : string -> seq<TFrettedNote> -> unit

Full name: Snippet.printShape

Print the frettings for a shape
val label : string

  type: string
  implements: System.IComparable
  implements: System.ICloneable
  implements: System.IConvertible
  implements: System.IComparable<string>
  implements: seq<char>
  implements: System.Collections.IEnumerable
  implements: System.IEquatable<string>
Multiple items
val string : 'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------

type string = System.String

Full name: Microsoft.FSharp.Core.string

  type: string
  implements: System.IComparable
  implements: System.ICloneable
  implements: System.IConvertible
  implements: System.IComparable<string>
  implements: seq<char>
  implements: System.Collections.IEnumerable
  implements: System.IEquatable<string>
val shape : seq<TFrettedNote>

  type: seq<TFrettedNote>
  inherits: System.Collections.IEnumerable
val printfn : Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
val iter : ('T -> unit) -> seq<'T> -> unit

Full name: Microsoft.FSharp.Collections.Seq.iter
val fretting : TFrettedNote

  type: TFrettedNote
  implements: System.IEquatable<TFrettedNote>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TFrettedNote>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val ignore : 'T -> unit

Full name: Microsoft.FSharp.Core.Operators.ignore
val findShape : TInstrument -> int -> int -> TChord -> seq<TFrettedNote>

Full name: Snippet.findShape

For a given chord, search through the notes which could be played within a given range of frets to try and
 provide a set of frettings which plays the notes for the chord:

val chord : TChord

  type: TChord
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNote>
  implements: System.Collections.Generic.ICollection<TNote>
  implements: seq<TNote>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val wantedNotes : TNoteMapping []

  type: TNoteMapping []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNoteMapping>
  implements: System.Collections.Generic.ICollection<TNoteMapping>
  implements: seq<TNoteMapping>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val markDone : (TNote -> unit)
val mapIndex : int

  type: int
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<int>
  implements: System.IEquatable<int>
  inherits: System.ValueType
val findIndex : ('T -> bool) -> 'T [] -> int

Full name: Microsoft.FSharp.Collections.Array.findIndex
val item : TNoteMapping

  type: TNoteMapping
  implements: System.IEquatable<TNoteMapping>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNoteMapping>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val notesInPriorityOrder : (unit -> seq<TNote>)
val result : seq<TNote>

  type: seq<TNote>
  inherits: System.Collections.IEnumerable
val ofArray : 'T array -> seq<'T>

Full name: Microsoft.FSharp.Collections.Seq.ofArray
val rootNoteFound : bool ref

  type: bool ref
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<Ref<bool>>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
Multiple items
val ref : 'T -> 'T ref

Full name: Microsoft.FSharp.Core.Operators.ref

--------------------

type 'T ref = Ref<'T>

Full name: Microsoft.FSharp.Core.ref<_>

  type: 'T ref
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<Ref<'T>>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val frettings : seq<TFrettedNote>

  type: seq<TFrettedNote>
  inherits: System.Collections.IEnumerable
val availableNotesForString : seq<TFrettedNote>

  type: seq<TFrettedNote>
  inherits: System.Collections.IEnumerable
val hit : (TNote * TFrettedNote) option

  type: (TNote * TFrettedNote) option
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<Option<TNote * TFrettedNote>>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val wantedNote : TNote

  type: TNote
  implements: System.IEquatable<TNote>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TNote>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val availNote : TFrettedNote

  type: TFrettedNote
  implements: System.IEquatable<TFrettedNote>
  implements: System.Collections.IStructuralEquatable
  implements: System.IComparable<TFrettedNote>
  implements: System.IComparable
  implements: System.Collections.IStructuralComparable
val snd : ('T1 * 'T2) -> 'T2

Full name: Microsoft.FSharp.Core.Operators.snd
property Option.Value: TNote * TFrettedNote
val fst : ('T1 * 'T2) -> 'T1

Full name: Microsoft.FSharp.Core.Operators.fst
val sortBy : ('T -> 'Key) -> seq<'T> -> seq<'T> (requires comparison)

Full name: Microsoft.FSharp.Collections.Seq.sortBy
val standardGuitar : TInstrument

Full name: Snippet.standardGuitar
val droppedDGuitar : TInstrument

Full name: Snippet.droppedDGuitar
val celticGuitar : TInstrument

Full name: Snippet.celticGuitar
val tesseractGuitar : TInstrument

Full name: Snippet.tesseractGuitar
val plectrumBanjo : TInstrument

Full name: Snippet.plectrumBanjo
val CMaj : TNote []

Full name: Snippet.CMaj

  type: TNote []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNote>
  implements: System.Collections.Generic.ICollection<TNote>
  implements: seq<TNote>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val DMaj : TNote []

Full name: Snippet.DMaj

  type: TNote []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNote>
  implements: System.Collections.Generic.ICollection<TNote>
  implements: seq<TNote>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val DMin : TNote []

Full name: Snippet.DMin

  type: TNote []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNote>
  implements: System.Collections.Generic.ICollection<TNote>
  implements: seq<TNote>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val D7 : TNote []

Full name: Snippet.D7

  type: TNote []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNote>
  implements: System.Collections.Generic.ICollection<TNote>
  implements: seq<TNote>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val DMaj7 : TNote []

Full name: Snippet.DMaj7

  type: TNote []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNote>
  implements: System.Collections.Generic.ICollection<TNote>
  implements: seq<TNote>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val EMaj : TNote []

Full name: Snippet.EMaj

  type: TNote []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNote>
  implements: System.Collections.Generic.ICollection<TNote>
  implements: seq<TNote>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val EMin : TNote []

Full name: Snippet.EMin

  type: TNote []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNote>
  implements: System.Collections.Generic.ICollection<TNote>
  implements: seq<TNote>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val AMaj : TNote []

Full name: Snippet.AMaj

  type: TNote []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNote>
  implements: System.Collections.Generic.ICollection<TNote>
  implements: seq<TNote>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val AMin : TNote []

Full name: Snippet.AMin

  type: TNote []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNote>
  implements: System.Collections.Generic.ICollection<TNote>
  implements: seq<TNote>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val ADim : TNote []

Full name: Snippet.ADim

  type: TNote []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNote>
  implements: System.Collections.Generic.ICollection<TNote>
  implements: seq<TNote>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val DMajLow : TNote []

Full name: Snippet.DMajLow

  type: TNote []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNote>
  implements: System.Collections.Generic.ICollection<TNote>
  implements: seq<TNote>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val DMinLow : TNote []

Full name: Snippet.DMinLow

  type: TNote []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNote>
  implements: System.Collections.Generic.ICollection<TNote>
  implements: seq<TNote>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val D7Low : TNote []

Full name: Snippet.D7Low

  type: TNote []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNote>
  implements: System.Collections.Generic.ICollection<TNote>
  implements: seq<TNote>
  implements: System.Collections.IEnumerable
  inherits: System.Array
val DMaj7Low : TNote []

Full name: Snippet.DMaj7Low

  type: TNote []
  implements: System.ICloneable
  implements: System.Collections.IList
  implements: System.Collections.ICollection
  implements: System.Collections.IStructuralComparable
  implements: System.Collections.IStructuralEquatable
  implements: System.Collections.Generic.IList<TNote>
  implements: System.Collections.Generic.ICollection<TNote>
  implements: seq<TNote>
  implements: System.Collections.IEnumerable
  inherits: System.Array

More information

Link: http://fssnip.net/76
Posted: 2 years ago
Author: Kit Eason (website)
Tags: guitar, chord, music