private int GetSoundIndex(Semitone semitone, int octave) { int octaveDifference = octave - InitialOctave; int semitoneDifference = (int)semitone - (int)InitialSemitone; return((octaveDifference * 12) + semitoneDifference); }
static void Main(string[] args) { Console.WriteLine("Guitar Alchemist"); var allScales = ScaleDefinition.All; var major = ScaleDefinition.Major; var lydian = major[MajorScaleMode.Lydian]; var a = lydian.Intervals; var keyOfF = Key.Major[MajorKey.F]; var b = keyOfF.GetIntervalFromRoot(Note.B); var key = Key.Major[-6]; var Fb = new Note(DiatonicNote.F, Accidental.Flat); var Eb = new Note(DiatonicNote.E, Accidental.Flat); var d = Fb - Eb; var s = new Semitone(10); var flat = Accidental.Flat; var sharp = Accidental.Sharp; //var a = major.Absolute; //var b = lydian.Absolute; //var colorTones = b.Except(a).ToList(); //var colorQualities = new IntervalsList(colorTones, AccidentalKind.Sharp); }
private void SetupSelectableNote(KMSelectable selectable, Semitone semitone) { selectable.OnInteract += delegate() { ProcessSemitoneHit(semitone); return(false); }; }
public Note( DiatonicNote diatonicNote, Accidental accidental) { DiatonicNote = diatonicNote; Accidental = accidental; DistanceFromC = new Semitone((int)DiatonicNote + Accidental); }
public ModeDefinition( IEnumerable <Semitone> relativeSemitones, ModalScaleDefinition parentScale, Semitone distanceFromParentScale, string modeName, int modeIndex) : base(relativeSemitones) { ParentScale = parentScale; DistanceFromParentScale = distanceFromParentScale; ModeName = modeName; ModeIndex = modeIndex; }
public SettingsRequestEventArgs(Semitone pianorollSemitone, Semitone fretboardSemitone, Semitone circleSemitone, Note[] fretboardStrings, int lastVisibleString) { if (fretboardStrings == null) { throw new ArgumentNullException(nameof(fretboardStrings)); } this.PianorollSemitone = pianorollSemitone; this.FretboardSemitone = fretboardSemitone; this.CircleSemitone = circleSemitone; this.FretboardStrings = fretboardStrings; this.LastVisibleString = lastVisibleString; }
private static Semitone ParseSelector(string s) { s = s?.Trim(); if (Semitone.TryParse(s, out var semitone)) { return(semitone); } if (Interval.TryParse(s, out var quality)) { return(quality); } throw new InvalidOperationException($"Failed parsing '{s}' into {nameof(Semitone)}"); }
public void Play(Semitone semitone, int octave) { if (Sounds == null) { return; } int soundIndex = GetSoundIndex(semitone, octave); if (soundIndex < 0 || soundIndex >= Sounds.Length) { return; } KMAudio.PlaySoundAtTransform(Sounds[soundIndex].name, transform); }
private void ProcessSemitoneHit(Semitone semitone) { PlayNote(semitone); if (IsMelodyComplete) { return; } StringBuilder logString = new StringBuilder(); logString.Append("The current valid sequence is the following: "); logString.AppendFormat("[{0}] ", _correctDecision.SequenceStringHandler(KMBombInfo)); logString.Append(string.Join(", ", DecisionNotes.Select((x) => x.Semitone.GetDescription()).ToArray())); KMBombModule.Log(logString.ToString()); KMBombModule.LogFormat("Input {0} was received; valid input at this stage is {1}", semitone.GetDescription(), CurrentSemitone.GetDescription()); if (IsCorrectSemitone(semitone)) { AdvanceCurrentNote(); if (IsMelodyComplete) { KMBombModule.Log("Input was valid and sequence complete; module defused!"); KMBombModule.HandlePass(); } else { KMBombModule.Log("Input was valid; continuing the sequence..."); } } else { KMBombModule.Log("Input was invalid; module caused a strike and reset!"); ResetCurrentNote(); KMBombModule.HandleStrike(); } }
public bool Contains(Semitone item) { var result = _absoluteSemitonesSet.Contains(item); return(result); }
public static Interval GetSharp(Semitone semitone) { _sharpIntervalByDistance.TryGetValue(semitone, out var result); return(result); }
public static Interval GetFlat(Semitone semitone) { _flatIntervalByDistance.TryGetValue(semitone, out var result); return(result); }
public Note(Semitone semitone, int octave) { Semitone = semitone; Octave = octave; }
public bool Contains(Semitone item) { var result = Absolute.Contains(item); return(result); }
private void PlayNote(Semitone semitone) { PianoPlayer.Play(semitone, CurrentOctave); }
private bool IsCorrectSemitone(Semitone semitone) { return(CurrentSemitone == semitone); }