Class NoteHelper
Inheritance
System.Object
NoteHelper
Namespace: InsaneScatterbrain.RetroKit.Editor
Syntax
public static class NoteHelper
Methods
Play(ISampleProvider, Note, Int32, Single)
Generates the samples for the given note and plays them.
Declaration
public static void Play(ISampleProvider sampleProvider, Note note, int durationMs, float volume = 1F)
Parameters
Type | Name | Description |
---|---|---|
ISampleProvider | sampleProvider | The sample provider used for generating the samples. |
Note | note | The note to play. |
System.Int32 | durationMs | The duration to play the note. |
System.Single | volume | The volume at which to play the note. |
ToFrequency(Note, Single)
Converts the given note to the frequency that is associated with.
Declaration
public static float ToFrequency(Note note, float a4 = 440F)
Parameters
Type | Name | Description |
---|---|---|
Note | note | The note. |
System.Single | a4 | The frequency that is used for A of the fourth octave. The returned frequencies will be related to this pitch. |
Returns
Type | Description |
---|---|
System.Single |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
ToNote(Int32)
Returns a note object based on the given note number. E.g. 0 returns C0, 1 returns C#0, 12 returns C1, etc.
Declaration
public static Note ToNote(int noteNumber)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | noteNumber | The note number |
Returns
Type | Description |
---|---|
Note | The note object. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
ToNumber(Note)
Converts the given note into a note number. E.g. C0 returns 0, C#0 returns 1, C1 returns 12, etc.
Declaration
public static int ToNumber(Note note)
Parameters
Type | Name | Description |
---|---|---|
Note | note | The note. |
Returns
Type | Description |
---|---|
System.Int32 | The note number. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |