Files
RushMidi.Library/MidiNote.cs
T
2025-05-13 00:34:26 +03:00

36 lines
960 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RushMidiLibrary {
public class MidiNote {
private static string[] _noteNames = new string[] { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" };
private static string[] _octaveNames = new string[] { "Sub Contra", "Contra", "Great", "Small", "1 Line", "2 Line", "3 Line", "4 Line", "5 Line", "6 Line" };
public int NoteId { get; init; }
public MidiNote(int noteId) {
NoteId = noteId;
}
public string Name {
get {
return _noteNames[NoteId % 12];
}
}
public int OctaveIndex {
get {
return NoteId / 12 - 1;
}
}
public string OctaveName {
get {
return _octaveNames[OctaveIndex];
}
}
}
}