Class LibSasaraUtil
ユーティリティ
Namespace: LibSasara
Assembly: LibSasara.dll
Syntax
public static class LibSasaraUtil
Methods
ClockToTimeSpan(SortedDictionary<int, decimal>, int, int)
Declaration
public static TimeSpan ClockToTimeSpan(SortedDictionary<int, decimal> tempoList, int clockTick, int maxClock = 0)
Parameters
Type | Name | Description |
---|---|---|
SortedDictionary<int, decimal> | tempoList | |
int | clockTick | |
int | maxClock |
Returns
Type | Description |
---|---|
TimeSpan |
See Also
ClockToTimeSpan(int, SortedDictionary<int, decimal>)
Clockを時間(TimeSpan)に変換
Declaration
public static TimeSpan ClockToTimeSpan(int clockTick, SortedDictionary<int, decimal> tempoList)
Parameters
Type | Name | Description |
---|---|---|
int | clockTick | 変換したいClock(tick)値 |
SortedDictionary<int, decimal> | tempoList | テンポ変更リスト。"clock, tempo"のリスト。 |
Returns
Type | Description |
---|---|
TimeSpan |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
See Also
ConvertBool(string?, bool)
文字列を bool 型に変換。失敗時は第2引数defaultValue
を返す
Declaration
public static bool ConvertBool(string? value, bool defaultValue = false)
Parameters
Type | Name | Description |
---|---|---|
string | value | 数を表す文字列 |
bool | defaultValue | 失敗時に返す値 |
Returns
Type | Description |
---|---|
bool |
ConvertDecimal(string?, decimal)
文字列を decimal 型に変換。失敗時は第2引数defaultValue
を返す
Declaration
public static decimal ConvertDecimal(string? value, decimal defaultValue = 0.00)
Parameters
Type | Name | Description |
---|---|---|
string | value | 数を表す文字列 |
decimal | defaultValue | 失敗時に返す値 |
Returns
Type | Description |
---|---|
decimal |
ConvertInt(string?, int)
文字列を int 型に変換。失敗時は第2引数defaultValue
を返す
Declaration
public static int ConvertInt(string? value, int defaultValue = 0)
Parameters
Type | Name | Description |
---|---|---|
string | value | 数を表す文字列 |
int | defaultValue | 失敗時に返す値 |
Returns
Type | Description |
---|---|
int |
FreqToNoteNum(double, double)
周波数をMIDIノートナンバーに変換
Declaration
public static int FreqToNoteNum(double freq, double baseFreq = 440)
Parameters
Type | Name | Description |
---|---|---|
double | freq | 周波数 |
double | baseFreq | 基準ド周波数 |
Returns
Type | Description |
---|---|
int |
See Also
FreqToOctaveStep(double)
周波数をNoteの PitchOctave と PitchStep に変換
Declaration
public static (int octave, int step) FreqToOctaveStep(double freq)
Parameters
Type | Name | Description |
---|---|---|
double | freq | 周波数 |
Returns
Type | Description |
---|---|
(int octave, int step) |
See Also
NoteNumToFreq(int, double)
MIDIノートナンバーをノート中央の周波数に変換
Declaration
public static double NoteNumToFreq(int num, double baseFreq = 440)
Parameters
Type | Name | Description |
---|---|---|
int | num | MIDIノートナンバー |
double | baseFreq | 基準ド周波数 |
Returns
Type | Description |
---|---|
double | ノート中央の周波数 |
See Also
NoteNumToOctaveStep(int)
MIDIノートナンバーをNoteの PitchOctave と PitchStep に変換
Declaration
public static (int octave, int step) NoteNumToOctaveStep(int num)
Parameters
Type | Name | Description |
---|---|---|
int | num | MIDIノートナンバー |
Returns
Type | Description |
---|---|
(int octave, int step) |
See Also
OctaveStepToFreq(int, int)
Noteの PitchOctave と PitchStep をノート中央の周波数に変換
Declaration
public static double OctaveStepToFreq(int octave, int step)
Parameters
Type | Name | Description |
---|---|---|
int | octave | |
int | step |
Returns
Type | Description |
---|---|
double |
See Also
OctaveStepToNoteNum(int, int)
Noteの PitchOctave と PitchStepからMidiノートナンバーに変換
Declaration
public static int OctaveStepToNoteNum(int octave, int step)
Parameters
Type | Name | Description |
---|---|---|
int | octave | |
int | step |
Returns
Type | Description |
---|---|
int |