Table of Contents

Class MelodyAnalyzer

Namespace
Celeritas.Core.Analysis
Assembly
Celeritas.dll

Melody analysis engine - analyzes contour, intervals, and detects motifs.

public static class MelodyAnalyzer
Inheritance
MelodyAnalyzer
Inherited Members

Fields

IntervalNames

Named intervals for display.

public static readonly FrozenDictionary<int, string> IntervalNames

Field Value

FrozenDictionary<int, string>

Methods

Analyze(NoteBuffer)

Analyze a melody from a NoteBuffer.

public static MelodyAnalysisResult Analyze(NoteBuffer buffer)

Parameters

buffer NoteBuffer

Returns

MelodyAnalysisResult

Exceptions

ArgumentNullException

buffer is null.

Analyze(int[], Rational[]?)

Analyze a melody from pitch array. When times is supplied, each note's onset is used for Occurrences; otherwise occurrences are reported as sequential note positions (index i as i/1), since no timing is known.

public static MelodyAnalysisResult Analyze(int[] pitches, Rational[]? times = null)

Parameters

pitches int[]
times Rational[]

Returns

MelodyAnalysisResult

Exceptions

ArgumentNullException

pitches is null.

ArgumentException

times is non-null and its length differs from pitches.

ClassifyMotion(int)

Classify the type of melodic motion based on interval size.

public static MelodicMotionType ClassifyMotion(int absSemitones)

Parameters

absSemitones int

Returns

MelodicMotionType

GetIntervalName(int)

Get a human-readable name for an interval.

public static string GetIntervalName(int semitones)

Parameters

semitones int

Returns

string