Example #1
0
 public Harmony(MusicTheory theory, Random random, NoteName key, MusicTheory.SCALE_MODE mode)
 {
     this.random = random;
     this.key = key;
     this.mode = mode;
     this.seventhChordProbability = InputParameters.Instance.SeventhChordProbability;
     diatonicScale = createDiatonicScale();
 }
        /// <summary>
        /// Creates a representation for a natural.
        /// </summary>
        /// <param name="naturalNote">Can't be an accidental.</param>
        internal NoteRepresentation(Note naturalNote)
        {
            if (naturalNote.IsAccidental())
                throw new Exception("Only a natural can be passed to this constructor.");

            Note = naturalNote;
            Name = GetNaturalNoteName(naturalNote);
            Accidental = AccidentalType.Natural;
        }
Example #3
0
 public List<Note> GetNotes(NoteName name)
 {
     var notesGammeMajeur = new GammeManager(new GammeMajeur(), new Note(name, 3)).GetNotesTwoOctaves();
     //int[] accord = new int[] { 1, 3, 5 };
     List<Note> notesAccord = new List<Note>();
     for (int i = 0; i < Indexes.Length; i++)
     {
         notesAccord.Add(notesGammeMajeur[Indexes[i] - 1]);
     }
     return notesAccord;
 }
Example #4
0
 public static List<Note> Get_X7(NoteName n)
 {
     return Get(n, 1, 3, 5, 7);
 }
Example #5
0
 //http://johncomino.tripod.com/const.htm
 public static List<Note> Get_X5(NoteName n)
 {
     return Get(n, 1, 5);
 }
Example #6
0
 public static List<Note> Get(NoteName n, params int[] p)
 {
     return new AccordDef(p).GetNotes(n) ;
 }
Example #7
0
 public static MusicalNote JustNote(NoteName tone, int octave)
 {
     return(CreateNote(tone, octave, IntonationMethod.Just));
 }
Example #8
0
 void comboTonalite_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     name = (NoteName)comboTonalite.SelectedValue ;
     RemplirGuitare();
 }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Note"/> with the specified
 /// note name and octave.
 /// </summary>
 /// <param name="noteName">Name of the note.</param>
 /// <param name="octave">Number of the octave in scientific pitch notation.</param>
 /// <remarks>
 /// Octave number is specified in scientific pitch notation which means that 4 must be
 /// passed to <paramref name="octave"/> to get the middle C.
 /// </remarks>
 /// <exception cref="InvalidEnumArgumentException"><paramref name="noteName"/> specified an
 /// invalid value.</exception>
 /// <exception cref="ArgumentException">Note number is out of range for the specified note
 /// name and octave.</exception>
 public Note(NoteName noteName, int octave)
     : this(noteName, octave, 0)
 {
 }
Example #10
0
 /// <summary>
 /// Sets note name and octave for current <see cref="Note"/>.
 /// </summary>
 /// <param name="noteName">Name of the note.</param>
 /// <param name="octave">Number of the octave in scientific pitch notation.</param>
 /// <remarks>
 /// Octave number is specified in scientific pitch notation which means that 4 must be
 /// passed to <paramref name="octave"/> to get the number of the middle C.
 /// </remarks>
 /// <exception cref="InvalidEnumArgumentException"><paramref name="noteName"/> specified an
 /// invalid value.</exception>
 /// <exception cref="ArgumentException">Note number is out of range for the specified note
 /// name and octave.</exception>
 public void SetNoteNameAndOctave(NoteName noteName, int octave)
 {
     _note = MusicTheory.Note.Get(noteName, octave);
 }
Example #11
0
 public StringTuning(NoteName noteName, int octave, PitchValue pitchOffset)
     : this(MusicalNote.CreateNote(noteName, octave, IntonationMethod.EqualTempered), pitchOffset)
 {
 }
Example #12
0
 public StringTuning(NoteName noteName, int octave)
     : this(MusicalNote.CreateNote(noteName, octave, IntonationMethod.EqualTempered))
 {
 }
Example #13
0
 public static int GetHalfStepsDifference(NoteName note1, int octave1, NoteName note2, int octave2)
 {
     return((int)note2 - (int)note1 + (octave2 - octave1) * 12);
 }
Example #14
0
 public static MusicalNote EqualNote(NoteName tone, int octave)
 {
     return(CreateNote(tone, octave, IntonationMethod.EqualTempered));
 }
Example #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Note"/> with the specified
 /// note name, octave and length.
 /// </summary>
 /// <param name="noteName">Name of the note.</param>
 /// <param name="octave">Number of the octave in scientific pitch notation.</param>
 /// <param name="length">Length of the note in units defined by time division of a MIDI file.</param>
 /// <remarks>
 /// Octave number is specified in scientific pitch notation which means that 4 must be
 /// passed to <paramref name="octave"/> to get the middle C.
 /// </remarks>
 /// <exception cref="InvalidEnumArgumentException"><paramref name="noteName"/> specified an
 /// invalid value.</exception>
 /// <exception cref="ArgumentException">Note number is out of range for the specified note
 /// name and octave.</exception>
 public Note(NoteName noteName, int octave, long length)
     : this(noteName, octave, length, 0)
 {
 }
Example #16
0
 bool CompareNoteToName(int number, NoteName name)
 {
     return (number % 12) == (int)name;
 }
Example #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Note"/> with the specified
 /// note name, octave, length and absolute time.
 /// </summary>
 /// <param name="noteName">Name of the note.</param>
 /// <param name="octave">Number of the octave in scientific pitch notation.</param>
 /// <param name="length">Length of the note in units defined by time division of a MIDI file.</param>
 /// <param name="time">Absolute time of the note in units defined by the time division of a MIDI file.</param>
 /// <remarks>
 /// Octave number is specified in scientific pitch notation which means that 4 must be
 /// passed to <paramref name="octave"/> to get the middle C.
 /// </remarks>
 /// <exception cref="InvalidEnumArgumentException"><paramref name="noteName"/> specified an
 /// invalid value.</exception>
 /// <exception cref="ArgumentException">Note number is out of range for the specified note
 /// name and octave.</exception>
 public Note(NoteName noteName, int octave, long length, long time)
     : this(NoteUtilities.GetNoteNumber(noteName, octave))
 {
     Length = length;
     Time   = time;
 }
Example #18
0
        private List<NoteName> createChord(NoteName root, int[] otherNotes)
        {
            List<NoteName> chord = new List<NoteName>();

            //Add root note
            chord.Add(root);

            //Add other notes
            for (int i = 1; i < MusicTheory.OCTAVE_SIZE; i++)
            {
                if (otherNotes.Contains<int>(i))
                {
                    chord.Add(diatonicScale[(diatonicScale.IndexOf(root) + i) % diatonicScale.Count]);
                }
            }
            return chord;
        }
Example #19
0
 static int GetSemiTone(NoteName noteName, int octave)
 {
     return(octave * SemiTonesPerOctave + (int)noteName);
 }
 /// <summary>
 /// Creates a new note representation.
 /// </summary>
 internal NoteRepresentation(Note note, AccidentalType accidental, NoteName name)
 {
     Note = note;
     Accidental = accidental;
     Name = name;
 }
Example #21
0
 /// <summary>
 ///   Constructs a new pitch.
 /// </summary>
 /// <param name="name">The letter-name for the pitch.</param>
 /// <param name="accidental">The accidental for the pitch.</param>
 /// <param name="octave">The octave for the pitch.</param>
 public Pitch(NoteName name, Accidental accidental, int octave)
 {
     this.note   = new Note(name, accidental);
     this.octave = octave;
 }
Example #22
0
 public Note(NoteName note, int octave)
 {
     Name = note;
     Octave = octave;
     DemisTonsOffset = ((int)note - 9) + (octave - 3) * 12; // LA 440 = ocatve 3
 }
Example #23
0
 public static int GetMidiNum(NoteName note, int octave)
 {
     return((int)note + octave * 12);
 }