Last active
December 10, 2025 14:16
-
-
Save BaksiLi/5afb4a9d6550994400d8b1b0e794907f to your computer and use it in GitHub Desktop.
Diatonic Arpeggio and Pitch Ear‑Training
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (*Diatonic seventh arpeggios using SoundNote syntax*) | |
| arpeggios = {{"C4", "E4", "G4", "B4"}, {"D4", "F4", "A4", | |
| "C5"}, {"E4", "G4", "B4", "D5"}, {"F4", "A4", "C5", "E5"}, {"G4", | |
| "B4", "D5", "F5"}, {"A4", "C5", "E5", "G5"}, {"B4", "D5", "F5", | |
| "A5"}}; | |
| playNoteWithName[n_String] := | |
| Module[{audioName},(*1. Play the musical pitch*) | |
| EmitSound[SoundNote[n, 0.3]];(*middle C is \"C4\" by default[web: | |
| 1]*)Pause[0.4]; | |
| (*2. Speak the name at natural voice pitch*) | |
| audioName = SpeechSynthesize[n];(*text-to-speech audio[web:46]*) | |
| EmitSound[audioName]; | |
| Pause[0.2];]; | |
| playArpeggios[] := | |
| Do[Print["Arpeggio ", i, ": ", StringRiffle[arpeggios[[i]], " "]]; | |
| Scan[playNoteWithName, arpeggios[[i]]]; | |
| Pause[1.0], {i, Length[arpeggios]}]; | |
| playArpeggios[]; | |
| randomNote[] := RandomChoice[Flatten[arpeggios]]; | |
| quizOnce[] := | |
| Module[{n = randomNote[], audioName}, EmitSound[SoundNote[n, 0.8]]; | |
| Pause[1.5];(*time to guess*)audioName = SpeechSynthesize[n]; | |
| EmitSound[audioName];(*reveal correct name*)Pause[0.5];]; | |
| Do[quizOnce[], 2]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment