Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(pitch_class): 📖 add more examples for operator * #396

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions lib/src/note/pitch_class.dart
Original file line number Diff line number Diff line change
Expand Up @@ -221,19 +221,36 @@ final class PitchClass extends Scalable<PitchClass>
/// ```dart
/// PitchClass.cSharp * 7 == PitchClass.g
/// PitchClass.d * 7 == PitchClass.d
/// // observe one semitone upwards results in ascending fifths G -> D.
///
/// PitchClass.cSharp * 5 == PitchClass.f
/// PitchClass.d * 5 == PitchClass.aSharp
/// // observe one semitone upwards results in ascending fourths F -> B-flat.
/// ```
///
/// The multiplication by the two meaningful operations (5 and 7) gives us the
/// circle of fourths and fifths transform, respectively, when operated on a
/// chromatic scale as follows:
///
/// ```dart
/// ScalePattern.chromatic.on(PitchClass.c)
/// .degrees.map((note) => note * 7)
/// == Interval.P5.circleFrom(PitchClass.c, distance: 12)
/// final chromaticScale = ScalePattern.chromatic.on(PitchClass.c);
///
/// // Cycle of fourths transform
/// chromaticScale.degrees.map((note) => note * 5)
/// == Interval.P4.circleFrom(PitchClass.c, distance: 12)
///
/// // Cycle of fifths transform
/// chromaticScale.degrees.map((note) => note * 7)
/// == Interval.P5.circleFrom(PitchClass.c, distance: 12)
///
/// // Inversion
/// chromaticScale.degrees.map((note) => note * 11)
/// .toList() == chromaticScale.descendingDegrees
///
/// // Whole-tone transform
/// final wholeToneScale = ScalePattern.wholeTone.on(PitchClass.c);
/// chromaticScale.degrees.skip(6).map((note) => note * 2)
/// .toList() == wholeToneScale.degrees
/// ```
///
/// See [Pitch-class multiplication modulo 12](https://en.wikipedia.org/wiki/Multiplication_(music)#Pitch-class_multiplication_modulo_12).
Expand Down