public string Plot() //Default = Chromatic Scale with the last string's 0 fret being a root { Pitch Root = fretboard[(this.NumberOfStrings - 1), 0]; HarmonicSet Set = new HarmonicSet(Root, Scales.Chromatic); Fretboard FretboardPlot = new Fretboard(this.NumberOfFrets, Tuning); //Sets Factor value for every Pitch in Fretboard.Plot.fretboard for (int current_string = 0; current_string < FretboardPlot.NumberOfStrings; current_string++) { for (int current_fret = 0; current_fret < FretboardPlot.fretboard.GetLength(1); current_fret++) { if (FretboardPlot.fretboard[current_string, current_fret].Note == Root.Note) { FretboardPlot.fretboard[current_string, current_fret].Factor = 0; } else { for (int i = 1; i < Set.Components.Length; i++) { if (FretboardPlot.fretboard[current_string, current_fret].Note == Set.Components[i].Note) { FretboardPlot.fretboard[current_string, current_fret].Factor = Set.Steps[i - 1]; } } } } } string outcome = ""; for (int CurrentString = 0; CurrentString < NumberOfStrings; CurrentString++) //StringIteration { outcome += $" {CurrentString + 1}: {FretboardPlot.fretboard[CurrentString, 0].FactorToString()} ||"; for (int CurrentFret = 1; CurrentFret < FretboardPlot.fretboard.GetLength(1); CurrentFret++) //FretIteration { if (FretboardPlot.fretboard[CurrentString, CurrentFret].Factor == null) { outcome += "-------|"; } else if (FretboardPlot.fretboard[CurrentString, CurrentFret].Factor == Interval.Root) { outcome += $"-({FretboardPlot.fretboard[CurrentString, CurrentFret].FactorToString()})--|"; } else { outcome += $"- {FretboardPlot.fretboard[CurrentString, CurrentFret].FactorToString()} --|"; } } outcome += "\n"; } return(outcome); }
public string ShowFretboardMap() { string outcome = ""; for (int CurrentString = 0; CurrentString < NumberOfStrings; CurrentString++) //StringIteration { { Pitch temp = fretboard[CurrentString, 0]; bool tempIsSharp = (temp.Note == Notes.Csharp || temp.Note == Notes.Dsharp || temp.Note == Notes.Fsharp || temp.Note == Notes.Gsharp || temp.Note == Notes.Asharp); if (tempIsSharp) { outcome += $" {CurrentString + 1}: {fretboard[CurrentString, 0]} ||"; } else { outcome += $" {CurrentString + 1}: {fretboard[CurrentString, 0]} ||"; } } //Prints out the 0 fret note. for (int CurrentFret = 1; CurrentFret < fretboard.GetLength(1); CurrentFret++) //FretIteration { Pitch temp = fretboard[CurrentString, CurrentFret]; bool tempIsSharp = (temp.Note == Notes.Csharp || temp.Note == Notes.Dsharp || temp.Note == Notes.Fsharp || temp.Note == Notes.Gsharp || temp.Note == Notes.Asharp); if (tempIsSharp) { outcome += $"-{fretboard[CurrentString, CurrentFret]}-|"; } else { outcome += $"---{fretboard[CurrentString, CurrentFret]}---|"; } } outcome += "\n"; } return(outcome); }
public MainWindow() { InitializeComponent(); DataContext = this; ChordsList = new List <string>(ChordsDictionary.Keys); ScalesList = new List <string>(ScalesDictionary.Keys); RootsList = new List <string>(RootsDictionary.Keys); numberOfStringsToPrint = 14; ScaleOrChord = true; CurrentSet = GetScale("Major (1) Ionian"); CurrentRoot = GetPitch("C"); CurrentTuning = new[] { E, A, D, G, B, E }; ShouldNotExecute = false; ChordSelection.SelectedIndex = -1; RootSelection.SelectedIndex = 0; ScaleSelection.SelectedValue = "Major (1) Ionian"; //TODO: Use delegates to make these more concise FretboardDisplay.Text = (new Fretboard(numberOfStringsToPrint, CurrentTuning)).PlotAsNotes(CurrentRoot, CurrentSet); FretboardDisplay2.Text = (new Fretboard(numberOfStringsToPrint, CurrentTuning)).Plot(CurrentRoot, CurrentSet); //FretboardDisplay2.Text = (new Fretboard(13, A, E, A, D, G, B, E)).Plot(C, Major); }
public string PlotAsNotes(Pitch Root, int[] Factor) { HarmonicSet Set = new HarmonicSet(Root, Factor); Fretboard FretboardPlot = new Fretboard(this.NumberOfFrets, Tuning); //Sets Factor value for every Pitch in Fretboard.Plot.fretboard for (int current_string = 0; current_string < FretboardPlot.NumberOfStrings; current_string++) { for (int current_fret = 0; current_fret < FretboardPlot.fretboard.GetLength(1); current_fret++) { if (FretboardPlot.fretboard[current_string, current_fret].Note == Root.Note) { FretboardPlot.fretboard[current_string, current_fret].Factor = 0; } else { for (int i = 1; i < Set.Components.Length; i++) { if (FretboardPlot.fretboard[current_string, current_fret].Note == Set.Components[i].Note) { FretboardPlot.fretboard[current_string, current_fret].Factor = Set.Steps[i - 1]; } } } } } string outcome = ""; //Responsible for printing out as notes: for (int CurrentString = 0; CurrentString < NumberOfStrings; CurrentString++) //StringIteration { if (FretboardPlot.fretboard[CurrentString, 0].Factor == null) { if (CurrentString + 1 > 9) { outcome += $"{CurrentString + 1}: ||"; } else { outcome += $" {CurrentString + 1}: ||"; } } else { Pitch temp = FretboardPlot.fretboard[CurrentString, 0]; bool tempIsSharp = (temp.Note == Notes.Csharp || temp.Note == Notes.Dsharp || temp.Note == Notes.Fsharp || temp.Note == Notes.Gsharp || temp.Note == Notes.Asharp); if (tempIsSharp) { if (CurrentString + 1 > 9) { outcome += $"{CurrentString + 1}: {FretboardPlot.fretboard[CurrentString, 0]}||"; } else { outcome += $" {CurrentString + 1}: {FretboardPlot.fretboard[CurrentString, 0]}||"; } } else { if (CurrentString + 1 > 9) { outcome += $"{CurrentString + 1}: {FretboardPlot.fretboard[CurrentString, 0]} ||"; } else { outcome += $" {CurrentString + 1}: {FretboardPlot.fretboard[CurrentString, 0]} ||"; } } } for (int CurrentFret = 1; CurrentFret < FretboardPlot.fretboard.GetLength(1); CurrentFret++) //FretIteration { if (FretboardPlot.fretboard[CurrentString, CurrentFret].Factor == null) { outcome += "-------|"; } else { Pitch temp = FretboardPlot.fretboard[CurrentString, CurrentFret]; bool tempIsSharp = (temp.Note == Notes.Csharp || temp.Note == Notes.Dsharp || temp.Note == Notes.Fsharp || temp.Note == Notes.Gsharp || temp.Note == Notes.Asharp); if (tempIsSharp) { outcome += $"-{FretboardPlot.fretboard[CurrentString, CurrentFret]}-|"; } else { outcome += $"---{FretboardPlot.fretboard[CurrentString, CurrentFret]}---|"; } } } outcome += "\n"; } return(outcome); }