Note Class |
public class Note : IEquatable<Note>, IComparable<Note>, IComparable
The Note type exposes the following members.
Name | Description | |
---|---|---|
Damping | Gets or sets the individual damping function used to lower the sound volume for this note over time. If this damping function is not defined, the damping algorithm of the song will be used for the note. | |
Dots | Gets or sets the total dotted note length extensions that apply to this note. | |
Dynamic | Gets or sets the dynamic (i.e., volume) expressed as percentage in the range of 0 to 1 for this note. If the dynamic is set to -1, the dynamic of the song will be used. | |
EndTimeIndex | Gets or sets end time index for this note. | |
Frequency | Gets or sets frequency of this note. | |
ID | Gets or sets note ID of the note. | |
NamedDynamic | Gets or sets the named dynamic (i.e., volume) for this note. If the dynamic is undefined, the dynamic of the song will be used. | |
NamedValue | Get or sets the note value, expressed in American form, representing the length of the note. | |
NamedValueBritish | Get or sets the note value, expressed in British form, representing the length of the note. | |
SamplePeriod | Gets or sets the sample period for this note. | |
StartTimeIndex | Gets or sets start time index for this note. | |
Timbre | Gets or sets the individual tibre function used to synthesize the sounds for this note (i.e., the instrument). If this timbre function is not defined, the timbre of the song will be used for the note. | |
Value | Get or sets the relative note value representing the length of the note. | |
ValueTime | Gets the cached note value time, in seconds, calculated from a call to CalculateValueTime(Tempo). |
Name | Description | |
---|---|---|
CalculateValueTime | Calculates the actual time duration, in seconds, for the specified tempo that the note value will last. For example, if tempo is M.M. 120 quarter-notes per minte, then each quarter-note would last a half-second. | |
CompareTo(Note) | Notes are compared by frequency, then by value (i.e., duration). | |
CompareTo(Object) | Notes are compared by frequency, then by value (i.e., duration). | |
Equals(Note) | Returns True if the frequency and value of this note equals the frequency and value of the specified other note. | |
Equals(Object) | Returns True if the frequency and value of this note equals the frequency and value of the specified other note. (Overrides ObjectEquals(Object)) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) | |
GetFrequency(String) | Gets the specified note frequency. | |
GetFrequency(Char, Int32, Boolean) | Gets the specified note frequency. | |
GetHashCode |
Serves as a hash function for the current Note.
(Overrides ObjectGetHashCode) | |
GetNextID | Gets the next note ID in sequence after the specified note ID. | |
GetPreviousID | Gets the previous note ID in sequence before the specified note ID. | |
GetType | Gets the Type of the current instance. (Inherited from Object) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object) | |
NamedValueIndex | Returns closest note value index (for NoteValue or NoteValueBritish) given the relative duration of a note. | |
ToString |
Returns a string representation for the note.
(Overrides ObjectToString) |
Name | Description | |
---|---|---|
Equality(Note, Note) | Compares two Note frequencies and values for equality. | |
GreaterThan(Note, Note) | Returns true if left Note timestamp is greater than right Note. | |
GreaterThanOrEqual(Note, Note) | Returns true if left Note timestamp is greater than or equal to right Note. | |
Inequality(Note, Note) | Compares two Note frequencies and values for inequality. | |
LessThan(Note, Note) | Returns true if left Note timestamp is less than right Note. | |
LessThanOrEqual(Note, Note) | Returns true if left Note timestamp is less than or equal to right Note. |
Name | Description | |
---|---|---|
A0 | Fundamental frequency for note A0. | |
A0S | Fundamental frequency for note A0#. | |
A1 | Fundamental frequency for note A1. | |
A1S | Fundamental frequency for note A1#. | |
A2 | Fundamental frequency for note A2. | |
A2S | Fundamental frequency for note A2#. | |
A3 | Fundamental frequency for note A3. | |
A3S | Fundamental frequency for note A3#. | |
A4 | Fundamental frequency for note A4. | |
A4S | Fundamental frequency for note A4#. | |
A5 | Fundamental frequency for note A5. | |
A5S | Fundamental frequency for note A5#. | |
A6 | Fundamental frequency for note A6. | |
A6S | Fundamental frequency for note A6#. | |
A7 | Fundamental frequency for note A7. | |
A7S | Fundamental frequency for note A7#. | |
B0 | Fundamental frequency for note B0. | |
B1 | Fundamental frequency for note B1. | |
B2 | Fundamental frequency for note B2. | |
B3 | Fundamental frequency for note B3. | |
B4 | Fundamental frequency for note B4. | |
B5 | Fundamental frequency for note B5. | |
B6 | Fundamental frequency for note B6. | |
B7 | Fundamental frequency for note B7. | |
C0 | Fundamental frequency for note C0. | |
C0S | Fundamental frequency for note C0#. | |
C1 | Fundamental frequency for note C1. | |
C1S | Fundamental frequency for note C1#. | |
C2 | Fundamental frequency for note C2. | |
C2S | Fundamental frequency for note C2#. | |
C3 | Fundamental frequency for note C3. | |
C3S | Fundamental frequency for note C3#. | |
C4 | Fundamental frequency for note C4 - Middle C. | |
C4S | Fundamental frequency for note C4#. | |
C5 | Fundamental frequency for note C5. | |
C5S | Fundamental frequency for note C5#. | |
C6 | Fundamental frequency for note C6. | |
C6S | Fundamental frequency for note C6#. | |
C7 | Fundamental frequency for note C7. | |
C7S | Fundamental frequency for note C7#. | |
C8 | Fundamental frequency for note C8. | |
C8S | Fundamental frequency for note C8#. | |
D0 | Fundamental frequency for note D0. | |
D0S | Fundamental frequency for note D0#. | |
D1 | Fundamental frequency for note D1. | |
D1S | Fundamental frequency for note D1#. | |
D2 | Fundamental frequency for note D2. | |
D2S | Fundamental frequency for note D2#. | |
D3 | Fundamental frequency for note D3. | |
D3S | Fundamental frequency for note D3#. | |
D4 | Fundamental frequency for note D4. | |
D4S | Fundamental frequency for note D4#. | |
D5 | Fundamental frequency for note D5. | |
D5S | Fundamental frequency for note D5#. | |
D6 | Fundamental frequency for note D6. | |
D6S | Fundamental frequency for note D6#. | |
D7 | Fundamental frequency for note D7. | |
D7S | Fundamental frequency for note D7#. | |
D8 | Fundamental frequency for note D8. | |
D8S | Fundamental frequency for note D8#. | |
E0 | Fundamental frequency for note E0. | |
E1 | Fundamental frequency for note E1. | |
E2 | Fundamental frequency for note E2. | |
E3 | Fundamental frequency for note E3. | |
E4 | Fundamental frequency for note E4. | |
E5 | Fundamental frequency for note E5. | |
E6 | Fundamental frequency for note E6. | |
E7 | Fundamental frequency for note E7. | |
F0 | Fundamental frequency for note F0. | |
F0S | Fundamental frequency for note F0#. | |
F1 | Fundamental frequency for note F1. | |
F1S | Fundamental frequency for note F1#. | |
F2 | Fundamental frequency for note F2. | |
F2S | Fundamental frequency for note F2#. | |
F3 | Fundamental frequency for note F3. | |
F3S | Fundamental frequency for note F3#. | |
F4 | Fundamental frequency for note F4. | |
F4S | Fundamental frequency for note F4#. | |
F5 | Fundamental frequency for note F5. | |
F5S | Fundamental frequency for note F5#. | |
F6 | Fundamental frequency for note F6. | |
F6S | Fundamental frequency for note F6#. | |
F7 | Fundamental frequency for note F7. | |
F7S | Fundamental frequency for note F7#. | |
G0 | Fundamental frequency for note G0. | |
G0S | Fundamental frequency for note G0#. | |
G1 | Fundamental frequency for note G1. | |
G1S | Fundamental frequency for note G1#. | |
G2 | Fundamental frequency for note G2. | |
G2S | Fundamental frequency for note G2#. | |
G3 | Fundamental frequency for note G3. | |
G3S | Fundamental frequency for note G3#. | |
G4 | Fundamental frequency for note G4. | |
G4S | Fundamental frequency for note G4#. | |
G5 | Fundamental frequency for note G5. | |
G5S | Fundamental frequency for note G5#. | |
G6 | Fundamental frequency for note G6. | |
G6S | Fundamental frequency for note G6#. | |
G7 | Fundamental frequency for note G7. | |
G7S | Fundamental frequency for note G7#. | |
MiddleC | Note ID for "Middle C" |
Name | Description | |
---|---|---|
GetEnumValueOrDefault |
Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions) | |
GetEnumValueOrDefaultT |
Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions) |
using System; using GSF.Media; using GSF.Media.Music; static class Program { static void Main() { WaveFile waveFile = new WaveFile(); long samplePeriod = 6 * waveFile.SampleRate; // Compute total sample period int totalNotes = 15; // Total notes to traverse string noteID = Note.MiddleC; // Start note at middle C double frequency = Note.GetFrequency(noteID); // Get frequency for middle C bool reverse = false; // Traverse notes in reverse order for (int sample = 0; sample < samplePeriod; sample++) { // Change notes at even intervals within the sample period if (sample > 0 && (sample % (samplePeriod / totalNotes)) == 0) { if (reverse) { noteID = Note.GetPreviousID(noteID, false); frequency = Note.GetFrequency(noteID); } else { noteID = Note.GetNextID(noteID, false); frequency = Note.GetFrequency(noteID); } // Go back down the scale after C5 if (noteID == "C5") reverse = true; } waveFile.AddSample(Timbre.BasicNote(frequency, sample, samplePeriod, waveFile.SampleRate) * 4500); } waveFile.Play(); Console.ReadKey(); } }