C++ Course — 00 · Setup, Compiler, and Hello World
C++ is the language that trades safety for control. You manage memory directly. You touch hardware closer. You pay for speed by accepting that one wrong pointer can crash everything. In exchange, your code can outrun every garbage-collected language by 10–100×, run on the smallest microcontroller, and live inside browsers, game engines, databases, operating systems, and trading systems. This post is the first step of a step-by-step C++ course. Future posts extend into templates, concurrency, modules, and modern (C++17/20/23) features.
> Series map: 00 Setup (this post) → 01 Syntax & Types → 02 Pointers & Memory → 03 Classes & OOP → 04 Templates & STL → 05 Modern C++ → (future) concurrency · modules · ranges · coroutines.
Learning Outcome
- Install a modern C++ compiler on Windows / macOS / Linux.- Understand the compile + link model and the role of headers.- Write, compile, and run "Hello, World" using , , or MSVC.- Use a basic build flow (single file → multi-file → CMake glimpse).- Pick a sensible editor / IDE.
Chapter 1 — What C++ is (and isn't)
Terminology
- Compiler — translates source into machine code (object files).- Linker — combines object files + libraries into a runnable executable.- Standard library (STL/) — the language's built-in collections, algorithms, I/O.- Header file ( / ) — declarations imported by other files via .- Source file () — implementations + the function.- Standard — the language version: C++11, C++14, C++17, C++20, C++23. Newer = more features.
C++ vs Python (one paragraph)
Python is interpreted, dynamically typed, garbage-collected, and slow. C++ is compiled, statically typed, manually memory-managed (with smart-pointer helpers), and fast. Python code reads cleanly with little ceremony; C++ code can be more verbose but exposes what's happening at the machine level. Use C++ when you need raw speed, low memory footprint, hardware access, or you're building infrastructure that other languages will call into.
> Trick: don't pick a language; pick a problem. Most real engineers use both — Python for orchestration and analysis, C++ (or Rust) for the hot inner loop.
Chapter 2 — Compiler installation
You need one of: g++ (GCC), clang++ (LLVM), or MSVC (Microsoft Visual C++). Each can compile standards-conforming code.
Windows
Option A — MSYS2 / MinGW (gives you ):
1. Install MSYS2 from msys2.org.2. In the MSYS2 terminal: .3. Add to PATH.4. New terminal: should show GCC 13+.
Option B — Visual Studio (gives you MSVC):
1. Download Visual Studio Community (free) from visualstudio.microsoft.com.2. During install, tick "Desktop development with C++".3. Open x64 Native Tools Command Prompt for VS; is the compiler.
Option C — clang-cl + LLVM: similar to MSVC but using clang.
macOS
That's it. macOS ships with a recent clang.
Linux (Debian/Ubuntu)
Fedora: .Arch: .
Chapter 3 — Your first program
Create :
Compile + run
Expected output:
What's happening
| Line | Meaning ||------|---------|| | Preprocessor pulls in standard I/O declarations. || | The program entry point. || | Standard output stream object. || | Stream insertion operator — sends right operand to left stream. || | String literal (). || | Newline + flush the buffer. (Tip: is faster — no forced flush.) || | Exit code 0 = success. |
Chapter 4 — A slightly bigger program
New pieces:- — pulls in .- — reads a whole line from standard input.- Stream operator chains naturally.
Compile flags worth knowing
| Flag | Meaning ||------|---------|| | Use C++20 standard (use if your compiler supports it). || | Most warnings on. || | Extra warnings (off by default but recommended). || | Optimisation level 2 (release builds). For debugging use . || | Embed debug info for / . |
> Trick: always compile with from day 1. Warnings catch 80% of beginner bugs before they crash at runtime.
Chapter 5 — Two-file build
Bigger projects split declarations into headers () and implementations into source files ().
Compile both files:
The compiler builds each into an object file, then the linker combines them into one executable.
A modern shorthand for include guards. It tells the compiler to include this header at most once per translation unit. Older style:
Use — it's universally supported by g++, clang++, and MSVC.
Chapter 6 — CMake (one minute glimpse)
For more than 3–4 files, hand-running becomes painful. CMake generates the build for you.
in your project root:
Then:
We'll return to CMake in a future post. For now: know it exists.
Chapter 7 — Editor / IDE choice
| Tool | Notes ||------|-------|| VS Code + C/C++ extension + CMake Tools | Free, fast, works everywhere. Recommended starting point. || CLion | JetBrains. Best refactoring; paid but free for students. || Visual Studio (Windows) | The MSVC-native IDE. Best Windows integration. || Qt Creator | Slick if you're doing Qt UI work. || Neovim + clangd + LSP | Terminal-native; powerful once configured. || Sublime Text + LSP | Fast, light. |
Use VS Code if undecided. The C/C++ extension (Microsoft) gives you completion, jump-to-definition, and integrated debugging.
Practice Exercises
Exercise 1 — Echo
Write that reads a line of input and prints it back uppercased.
Hint: and .
<details><summary>Solution</summary>
</details>
Exercise 2 — Sum two numbers
Read two integers from input, print their sum.
<details><summary>Solution</summary>
</details>
Exercise 3 — Multi-file project
Split your "echo" exercise into:- declaring- implementing it- reading + calling
Build with .
Exercise 4 — CMake build
Convert Exercise 3 to a CMake project. Verify produces a working binary.
Cheat-sheet
| What | How ||------|-----|| Compile single file | || Compile multi-file | || MSVC compile | || Print | || Read line | || Read whitespace-separated | || Include standard header | || Include local header | || One-include guard | || Comment | or || Useful flags | || CMake build | |
What's next
Post 01 covers syntax, types, references, and control flow: int/double/bool, variable declarations, references vs pointers (first taste), , , , , and an intro to functions.
References
- cppreference.com — the indispensable C++ reference. Bookmark it.- isocpp.org/get-started- A Tour of C++ by Bjarne Stroustrup — the language designer's 200-page walk-through. Best modern intro.- Programming: Principles and Practice Using C++ by Stroustrup — fuller textbook.
> Note: this post is in progress. Planned additions: Windows path setup screenshots, clangd LSP setup guide, debugger first-steps.
Piano Notes — 04 · Grade 4 Theory & Repertoire
Grade 4 is the bridge between "can read music" and "understands music". The syllabus expands keys to ±4 sharps/flats, finalises melodic minor, introduces all interval qualities including augmented and diminished, formalises cadences, and asks you to write primary triads in any key from the syllabus. Repertoire jumps too — full Bach inventions, longer sonatina movements, intermediate Romantic miniatures.
> Series map: 00 → 01 → 02 → 03 → 04 Grade 4 (this post). Grades 5–8 to follow.
Learning Outcome
- All simple and compound time signatures up to 12/8, with duplets and triplets in compound time.- All major and minor keys up to ±4 sharps/flats.- Full melodic minor (ascending raised 6 + 7, descending revert).- Identify and write all interval qualities including augmented and diminished (not only the tritone).- Identify and write primary triads (I, IV, V/i, iv, V) in root position in any key from the syllabus.- Write a perfect, plagal, imperfect, or interrupted cadence in any of those keys.- Transpose a short passage up or down an octave, possibly with a clef change.- Recognise broader Italian, French, and German musical terms.- Play 3–5 Grade 4 pieces hands together at fair tempo.
Chapter 1 — Keys Up to ±4 Sharps/Flats
Adding E major (4 sharps) and A♭ major (4 flats) to the Grade 3 list.
| Key | Sharps/Flats | Relative minor ||-----|--------------|----------------|| C | — | A m || G | F♯ | E m || D | F♯ C♯ | B m || A | F♯ C♯ G♯ | F♯ m || E | F♯ C♯ G♯ D♯ | C♯ m || F | B♭ | D m || B♭ | B♭ E♭ | G m || E♭ | B♭ E♭ A♭ | C m || A♭ | B♭ E♭ A♭ D♭ | F m |
That's 9 major keys + 9 minor keys = 18 to know fluently by Grade 4.
> Trick: the circle of fifths is your best friend. Memorise the order clockwise from C: G D A E (each adds a sharp), counter-clockwise: F B♭ E♭ A♭ (each adds a flat). The relative minor lives 3 semitones below — so the same circle holds the minors too, offset by a third.
A small mental tool: "key family"
Group the Grade 4 keys into three families by sharps/flats. When you can derive any scale within a family fluently, the family acts as a single unit:
- Sharp family: G, D, A, E.- Flat family: F, B♭, E♭, A♭.- Neutral: C.
Each family has the same major-key triad pattern (M m m M M m d°). Practise one family per week; rotate; by month four you own all 9 keys.
Chapter 2 — Melodic Minor Finalised
Reminder from Grade 3: three minor flavours sharing the same key signature.
Melodic minor is the one Grade 4 wants from you in writing and playing.
Ascending raises the 6 and 7. Descending reverts to natural (lowers the 6 and 7 back). It's the only scale in Western theory that's deliberately asymmetric between up and down.
> Where I got stuck: I kept playing the ascending shape on the way down too. Fix: in slow practice, name the sharps aloud as you ascend ("F-sharp, G-sharp"), and name the naturals aloud as you descend ("G-natural, F-natural"). The voice catches the descent change before the fingers do.
Writing a melodic minor in any key
1. Write the natural minor (the key signature's normal scale).2. Mark the 6th and 7th degrees.3. Ascending: raise both with an accidental (♯ or ♮ depending on whether the natural is flat).4. Descending: revert — write naturals/flats explicitly to cancel the ascending raises.
Example — C melodic minor (3 flats: B♭, E♭, A♭):
Chapter 3 — All Interval Qualities
Grade 4 expands beyond the tritone to every augmented and diminished interval.
The full table (above C, ascending)
| Interval | Quality + Number | Semitones ||----------|-------------------|-----------|| C–C | Perfect unison (P1) | 0 || C–D♭ | Minor 2nd (m2) | 1 || C–D | Major 2nd (M2) | 2 || C–D♯ | Augmented 2nd (A2) | 3 || C–E♭ | Minor 3rd (m3) | 3 || C–E | Major 3rd (M3) | 4 || C–F♭ | Diminished 4th (d4) | 4 || C–F | Perfect 4th (P4) | 5 || C–F♯ | Augmented 4th (A4) | 6 || C–G♭ | Diminished 5th (d5) | 6 || C–G | Perfect 5th (P5) | 7 || C–G♯ | Augmented 5th (A5) | 8 || C–A♭ | Minor 6th (m6) | 8 || C–A | Major 6th (M6) | 9 || C–A♯ | Augmented 6th (A6) | 10 || C–B♭ | Minor 7th (m7) | 10 || C–B | Major 7th (M7) | 11 || C–C (oct) | Perfect 8th (P8) | 12 |
Augmented vs Diminished — the rule
- Augmented = one semitone larger than the major or perfect.- Diminished = one semitone smaller than the minor or perfect.
| Direction | From major | From minor | From perfect ||-----------|------------|------------|--------------|| Larger | Augmented | Major | Augmented || Smaller | Minor | Diminished | Diminished |
> Trick: the qualities form a ladder:>>>> One step "up" the ladder = one semitone bigger. One step "down" = one semitone smaller. The 2-3-6-7 group has 4 rungs (because they have a major-minor distinction); the 1-4-5-8 group has 3 rungs (only perfect at the centre).
Counting strategy
1. Count staff positions including both endpoints → number (e.g. 4th, 5th).2. Count semitones on the keyboard → cross-reference the table → quality.
> Where I got stuck: I kept calling C–D♯ a minor 3rd. They sound identical (both 3 semitones), and on the piano they're the same key. But the staff number is different (C–D = 2nd, C–E♭ = 3rd). Always read the letter names first, count positions, then count semitones. Two questions, two answers, two checks.
Chapter 4 — Primary Triads, Reinforced
Now in all 9 major + 9 minor keys, written out:
Major-key triads pattern (always the same)
| Degree | I | ii | iii | IV | V | vi | vii° ||--------|---|----|-----|----|----|----|------|| Quality | M | m | m | M | M | m | dim |
Minor-key triads (harmonic minor)
| Degree | i | ii° | III+ | iv | V | VI | vii° ||--------|---|-----|------|----|----|----|------|| Quality | m | dim | Aug | m | M | M | dim |
(III+ = augmented; only applies in harmonic minor because the raised 7 alters that triad.)
> Trick: memorise the major pattern first (M m m M M m d°). Then commit just this fact about minor: the V in harmonic minor is major (because of the raised 7th). For Grade 4 written work, primary triads (i, iv, V) are what you'll be asked. i and iv are minor (because they include the natural 3rd and 5th). V is major.
Worked example: write i, iv, V in F♯ minor
F♯ minor's relative major is A (3 sharps: F♯ C♯ G♯). Harmonic minor raises the 7th of natural F♯ minor → raises E to E♯.
Notice E♯ (not F natural). The spelling matters — F♯ minor uses the letters F-G-A-B-C-D-E in order, so the raised 7 is E♯ (not F natural), even though they're the same key on the piano.
Chapter 5 — Cadences
A cadence (終止式) is a two-chord progression that ends a musical phrase. The four Grade-4 cadences:
| Cadence | Roman | Sound | Where ||---------|-------|-------|-------|| Perfect (Authentic) | V → I | Full closure | End of major sections || Plagal | IV → I | "Amen" / gentler close | End of hymns, gospel || Imperfect (Half) | ? → V | Pause; more to come | Mid-phrase question || Interrupted (Deceptive) | V → vi | Surprise — expected V→I doesn't arrive | Romantic music loves this |
Writing a cadence
For Grade 4, you'll typically be asked to write two block-chord triads in root position in a given key. Voicings are open here — the syllabus doesn't yet require correct four-part voice leading.
Example — plagal cadence in G major:
> Trick: perfect cadences are the period at the end of a sentence. Plagal cadences are the "and we're done" exhale. Imperfect is the question mark mid-phrase. Interrupted is the comma-where-you-expected-a-period — the listener feels the rug pulled. Naming the emotional function makes them memorable.
Detection by ear
- Perfect ends on the tonic with a strong "thud" of finality.- Plagal ends on tonic but softer, "Amen"-shaped.- Imperfect doesn't end on tonic — it leaves you hanging on V.- Interrupted sets you up for tonic, then jolts to vi.
> Where I got stuck: I confused plagal and perfect by ear because both end on the tonic. The fix: listen to the chord before the tonic. If it's a bright, leading chord with a sharpened 7th → V → perfect. If it's a softer subdominant (IV) → plagal. The lead-in chord is the give-away.
Chapter 6 — Transposition at the Octave (with clef change)
Grade 4 asks: rewrite a short passage one octave higher or lower, possibly changing clef.
Procedure
1. Identify the target clef (if changing). Treble ↔ bass change requires repositioning every note.2. Shift every note by 7 staff positions (one octave) in the chosen direction.3. Key signature unchanged — transposing at the octave doesn't change key.4. Preserve all accidentals, dynamics, articulation, fingering.
Common confusion: clef change ≠ key change
Moving a treble passage into the bass clef changes how the same notes look, not what they sound like. Middle C is one ledger below the treble staff; the same note is one ledger above the bass staff. The actual pitch is identical; the notation rearranges.
> Where I got stuck: I miscounted octaves on bass clef constantly. The fix that stuck: sketch the grand staff at the top of every transposition exercise during practice, with Middle C clearly marked on both sides. After two weeks the eye snaps to the right ledger without thinking.
Worked mini-example
Original (treble, C major):
Transposed one octave down, in bass clef:
Same letters, same key signature, just one octave lower in pitch and on the other clef.
Chapter 7 — Italian / French / German Terms (Grade 4 expansion)
ABRSM Grade 4 explicitly adds French and German terms. Italian remains the spine; the others are repertoire-language vocabulary.
French (Grade 4 set)
| Term | Meaning ||------|---------|| Lent | Slow || Modéré | Moderate || Vif | Lively || Doux | Sweet, soft || Cédez | Yield, slow down || Pressez | Hurry, push forward || Mais | But || Sans | Without || Très | Very |
German (Grade 4 set)
| Term | Meaning ||------|---------|| Langsam | Slow || Mäßig | Moderate || Schnell | Fast || Lebhaft | Lively || Süß | Sweet || Bewegt | Moving, agitated || Mit Ausdruck | With expression || Sehr | Very || Aber | But |
> Trick: cluster by meaning across all three languages:>> - Slow: Adagio / Lent / Langsam> - Fast: Allegro / Vif / Schnell> - Sweet: Dolce / Doux / Süß> - Very: Molto / Très / Sehr> - But: Ma / Mais / Aber>> Cross-language quizzes become trivial because you anchor on the concept, not the foreign word.
Chapter 8 — Suggested Practice Pieces
Grade 4 mainstream
| Piece | Composer | Why ||-------|----------|-----|| Two-Part Invention No. 4 in D minor, BWV 775 | Bach | The most popular Grade 4 Bach. Two-voice writing in minor; learn it well, you'll keep it forever || Two-Part Invention No. 8 in F, BWV 779 | Bach | More cheerful sister to No. 4. Fast triplets, joyful || Sonatina in G, Op. 36 No. 2 (I) | Clementi | Wider hand position, Alberti bass, longer phrases than Grade 3 sonatinas || Burgmüller, Op. 100 No. 18 ('Inquiétude') | Burgmüller | Restless RH, agile LH — a piece that sounds harder than it is || Album for the Young, Op. 68 No. 16 ('First Loss') | Schumann | Lyrical, expressive — a real test of voicing and rubato || Children's Album, Op. 39 No. 8 ('Mazurka') | Tchaikovsky | Polish dance feel; cross-rhythms; great for compound-time practice || Heller, Op. 47 No. 1 ('Avalanche') | Heller | A "study with personality"; relentless triplets but musical |
Stretching toward Grade 5
| Piece | Composer | Why ||-------|----------|-----|| Two-Part Invention No. 1 in C, BWV 772 | Bach | Yes the most-played. Master it — Grade 5 examiners will assume you have || Sonata in F, K. 280 (II) | Mozart | Slow movement; expressive, beautiful, manageable hands || Mazurka, Op. 17 No. 4 | Chopin | Romantic mazurka feel; demanding voicing but within reach || Doctor Gradus ad Parnassum | Debussy | The aspirational target — start sight-reading it once a month, learn it for real at Grade 6 |
How to build a Grade 4 programme
Pick:- 1 Baroque (Bach invention)- 1 Classical (sonatina or Mozart minuet)- 1 Romantic (Schumann, Burgmüller, or Tchaikovsky)- 1 20th-century or wild card (Bartók, Heller, contemporary)
This mix is exactly what the exam syllabus expects, and it's a real musical diet — period variety is what makes a pianist, not just a key-pusher.
Chapter 9 — Voicing (the new technique)
By Grade 4 you're playing pieces where one voice (usually the soprano line, top of the RH) carries the melody while the other voices accompany. You need to make the melody louder than the inner voices, with the same hand.
Mechanics
- The melody-bearing finger uses slightly more weight and arm support.- The accompanying fingers play softer — about 1 dynamic level below.- Wrist relaxes between melodic strikes; the inner voices ride along.
Practice drill
1. Play the chord with full RH voicing at one steady volume.2. Replay, this time bringing out the top note (finger 5, usually) — exaggerate.3. Replay, this time bringing out an inner voice (finger 2 or 3).4. Replay, this time bringing out the bottom note (finger 1).5. Now play the actual piece with the top voice highlighted naturally.
The first four steps are "isolated voicing"; the fifth is "musical voicing".
> Where I got stuck: my finger 5 was too weak to project. The fix: finger 5 isolation exercises — Hanon-style 5-finger patterns where I deliberately over-strike with the pinky. Two weeks of this gave finger 5 the strength I needed. Don't skip this — finger 5 carries 80% of upper-register melodies in classical repertoire.
Chapter 10 — Aural at Grade 4
Grade 4 aural adds:
- Identify which note of a 4-note phrase has been changed in a played comparison.- Identify cadence type: perfect, imperfect, or plagal (interrupted is Grade 5).- Identify a stronger set of features: dynamics, articulation, rhythm change, key change (to relative minor only).
> Trick: for cadence ID, the question is "did it end on the tonic, and how did it get there?">> - Tonic, with a leading-7 chord before → perfect (V → I)> - Tonic, with a softer subdominant before → plagal (IV → I)> - Not tonic, hanging on the dominant → imperfect (something → V)>> Two binary tests in sequence: (a) tonic or not, (b) which chord before. Three answers cover all three cadences.
Chapter 11 — Common Grade 4 Pitfalls
| Pitfall | Fix ||---------|-----|| Calling A2 a m3 | Always read staff position first, then count semitones || Forgetting V is major in minor | Write the raised 7 with a coloured pencil. After 4 weeks, internalised || Spelling triads wrong (e.g. F natural instead of E♯) | Stay in letter-name order — F♯ minor uses F-G-A-B-C-D-E; raised 7 is E♯, not F || Practising all pieces at the same tempo | Pick the slowest one. Practise everything at that tempo for one full session || Skipping aural | 5 min daily of clap-back and sing-back. Doubles your speed at recognising rhythm and pitch || Reading only the notes, not the markings | Highlight every Italian, French, German term before you play. Translate each |
Useful Shortcut
Cheat-sheet
| What | How ||------|-----|| Sharp keys | C → G → D → A → E (each +1 sharp) || Flat keys | C → F → B♭ → E♭ → A♭ (each +1 flat) || Relative minor | 3 semitones below major tonic || Melodic minor up | Raise 6 + 7 || Melodic minor down | Revert to natural || Interval quality | Position number + semitone count, cross-check table || V in minor | Major (raised leading tone) || Cadences | V→I perfect, IV→I plagal, ?→V imperfect, V→vi interrupted || Major-key triad pattern | M m m M M m d° |
Daily routine (45 min)
| Block | Time | Content ||-------|------|---------|| Five-finger warm-up | 3 min | In today's key, all four touch types (legato, staccato, portato, accent-top) || Scales | 12 min | Today's major + three minor flavours, hands separate then together, 2 octaves || Arpeggios | 5 min | I, IV, V root-position chords broken into arpeggios || Sight-read | 5 min | One new short piece per day || Repertoire | 15 min | One piece, difficult-bar loops || Aural | 3 min | Cadence ID from recorded fragments || Theory | 2 min | One past-paper question, written |
Suggested listening
| Piece | Composer | Why ||-------|----------|-----|| Two-Part Inventions (full set, BWV 772–786) | Bach | Listen to all 15 if you haven't already. Each is a Grade 4-5 piece in miniature || Goldberg Variations, BWV 988 | Bach | Aspirational. Listen and dream || Songs Without Words, Op. 19 | Mendelssohn | Lyrical Romantic style. Voicing and singing line mastery || Children's Album, Op. 39 (full) | Tchaikovsky | Many pieces sit at Grade 4-5; immerse in the entire album || Nocturnes, Op. 9 No. 2 | Chopin | THE Nocturne. Aim for Grade 6-7 but get the sound in your head now || Préludes, Book 1, La fille aux cheveux de lin | Debussy | Modern impressionism; a future "favourite piece" candidate || Sonata in A, K. 331 (I) — Andante grazioso | Mozart | The famous variation theme; Grade 4-5 difficulty in the theme alone |
References
- ABRSM (current). Music Theory in Practice — Grade 4.- ABRSM (current). Piano Exam Pieces — Grade 4.- Eric Taylor, The AB Guide to Music Theory — Parts I & II.- IMSLP — Bach Two-Part Inventions, Clementi Op. 36, Schumann Op. 68, Tchaikovsky Op. 39, Burgmüller Op. 100 + Op. 109, Heller Op. 45 + Op. 47.- Walter Piston, Harmony (5th ed.) — for deeper triad / cadence understanding beyond syllabus.- Heinrich Schenker, Five Graphic Music Analyses — for advanced curious readers.- Czerny, Op. 599 + Op. 849 — daily technical etudes.
> Note: this post is in progress. Planned additions: audio reference for each piece, a worked Roman-numeral analysis of a Mozart sonatina movement, sample exam-paper question with full written workings.
AI Prompting (Foundations & Practice)
Prompting is the practice of writing inputs that steer a Large Language Model (LLM) toward useful outputs. It is part interface design, part rhetoric, and part empirical science. This note covers the foundations and the techniques that have been validated by published research, with worked examples you can copy.
Learning Outcome
- Explain what a prompt is and why model behaviour is sensitive to its phrasing.- Decompose a prompt into its functional parts (instruction, context, examples, format spec).- Apply core techniques: zero-shot, few-shot, chain-of-thought, role conditioning, decomposition, and self-consistency.- Recognise common anti-patterns and explain why they fail.- Design an evaluation harness with a golden set + rubric + A/B framework.- Read a research paper on prompting and judge whether its claims will transfer to your task.
Chapter 1 - Foundations
Terminology
- Prompt — the full token sequence the model conditions on before generating the next token.- Completion — the model's generated response.- Token — sub-word unit (4 characters of English on average). All limits (context window, throughput, billing) are measured in tokens.- Context window — maximum prompt+completion length the model can attend to.- In-context learning (ICL) — model adapts its behaviour from examples in the prompt without weight updates. Reported in Language Models are Few-Shot Learners, Brown et al. (2020).- Temperature — sampling parameter; $0$ is greedy, higher values increase diversity.- Top-p / Top-k — nucleus / top-k sampling, alternatives to temperature.- System / developer message — privileged prompt segment used to set persistent behaviour. Mechanism formalised by The Instruction Hierarchy, Wallace et al. (2024).
Why prompts matter
An LLM is a next-token predictor over a learned distribution $P(tn \mid t1, \dots, t{n-1})$. The prompt is the conditional sequence $t1, \dots, t{n-1}$. Two prompts that read as semantically equivalent to a human can produce very different distributions because the model is sensitive to token-level cues it has learned to associate with answer quality (formality, code-block fences, "Let's think step by step", etc.).
This sensitivity has been measured empirically. Lu et al. (2022) showed that simply reordering few-shot examples can swing accuracy on classification benchmarks by tens of percentage points. Sclar et al. (2024) showed that benign formatting changes (newline vs. colon as separator) shift task accuracy by a comparable margin.
The practical consequence: prompts are programs. They deserve version control, testing, and review.
How the model "reads" a prompt
A typical chat-tuned model receives a structured sequence — for instance OpenAI's ChatML or Anthropic's / turn markers — where each turn is tagged with a role. The model has been fine-tuned (instruction-tuned + RLHF or DPO) to:
1. Treat the system / developer message as a high-priority constraint.2. Treat user messages as questions or requests.3. Treat its own prior responses as commitments to maintain consistency with.
The training procedure was first detailed in InstructGPT, Ouyang et al. (2022) and the Anthropic RLHF paper, Bai et al. (2022). The hierarchy of trust between roles was later sharpened in The Instruction Hierarchy, Wallace et al. (2024).
Chapter 2 - Anatomy of a Prompt
A well-formed prompt contains, in some combination, six functional parts. Naming them helps you debug what is missing.
| Part | Purpose | Example || --- | --- | --- || Role / persona | Set a frame the model uses to choose vocabulary, depth, formality | "You are a senior database administrator." || Instruction | The actual verb of the request | "Explain why this query is slow." || Context | Domain facts, retrieved documents, prior turns | The SQL query + output || Examples (shots) | Demonstrations of input → output | A prior worked optimisation || Format spec | Constraint on output shape | "Return JSON matching schema X" || Stop / guardrails | Negative constraints, refusal triggers | "If the query is fine, say only." |
A minimal template
The order matters less than the presence of each part. The OpenAI prompt-engineering guide (OpenAI 2024) and Anthropic's prompt library both converge on the same six-part skeleton.
A worked rewrite
Before (typical first draft, 15% accuracy on internal eval):
After (78% accuracy on the same eval):
What changed: a role, an explicit delimiter for the article, a numbered constraint set, a falsifiable failure marker (), and a machine-parseable output shape.
Chapter 3 - Core Techniques
Zero-shot
Ask the question directly with no examples. Works when the task is well-represented in the training distribution (translation, summarisation, common QA).
Few-shot (in-context learning)
Provide $k$ input/output pairs, then the new input. Brown et al. (2020) showed few-shot prompting closes a large fraction of the gap to fine-tuning on many tasks without any gradient updates.
Tips:
- Order examples easy → hard (Lu et al., 2022).- Make examples cover the failure modes you observe in zero-shot, not the easy cases.- Keep formatting identical across shots; a stray newline can degrade accuracy (Sclar et al., 2024).
Chain-of-Thought (CoT) prompting
Ask the model to show its work before committing to an answer. Reported in Chain-of-Thought Prompting Elicits Reasoning in Large Language Models, Wei et al. (2022). Improves arithmetic, symbolic, and commonsense reasoning on large models.
Two variants worth knowing:
- Zero-shot CoT: append "Let's think step by step." Kojima et al. (2022). Cheap and surprisingly effective.- Self-consistency: sample $n$ chains at temperature $>0$, take the majority vote on the final answer. Wang et al. (2022). Improves arithmetic accuracy further at $n \times$ cost.
Role / persona conditioning
Setting an expert persona biases vocabulary, depth, and inferred audience. The effect is real but smaller than CoT or few-shot; treat it as fine-tuning of style, not capability.
Decomposition
Break a hard problem into ordered sub-problems and prompt each separately, chaining outputs. Equivalent to Khot et al. (2023) "Decomposed Prompting" or least-to-most prompting by Zhou et al. (2023).
The chain is easier to debug than a single monolithic prompt; you can swap or rerun any step.
ReAct (Reasoning + Acting)
Interleave reasoning steps with tool calls. Yao et al. (2023). The model alternates between (a reasoning step), (a tool call), and (tool result), until ready to emit an .
ReAct is the foundation pattern under most "agent" frameworks (LangChain, LlamaIndex, modern function-calling SDKs).
Chapter 4 - Structural Patterns
Delimiters
Use unambiguous markers around user-supplied or retrieved content. Three formats all work, in roughly equal measure:
...
XML tags have the advantage of being self-documenting and survive whitespace normalisation. Anthropic explicitly recommends XML in their prompt-engineering documentation.
Markdown structure
Models trained on heavy Markdown corpora respond well to headings (), lists, and tables. Use the same conventions in your prompt that you want to see in the output.
Numbered constraints
Numbered constraints are easier for the model to enumerate against than a paragraph of "and also, make sure to..."
Format specifications
Three escalating strengths:
| Strength | Mechanism | Reliability || --- | --- | --- || Soft | Natural-language description ("return JSON") | 60-80% || Schema | Provide explicit schema (TypeScript / JSON Schema / Pydantic) | 90% || Hard | Use the provider's structured-output / JSON-mode API | 100% (provider-enforced) |
If you need a guaranteed shape, use the provider's structured output. Soft format is convenient but will fail on tail cases.
Chapter 5 - Reasoning Boosters
Self-consistency
Already mentioned. Formally: sample $n$ chains $c1, \dots, cn$ at $T > 0$, extract the final answer $ai$ from each, return $\arg\maxa \sumi \mathbb{1}[ai = a]$. The probability that the majority answer is correct converges to the per-sample accuracy raised to a Condorcet-style power as $n$ grows, when individual samples are conditionally independent given the question.
Tree of Thoughts (ToT)
Yao et al. (2023). Generalises CoT from a chain to a search tree. The model proposes multiple next-thoughts at each step, a value model scores each, and a search algorithm (BFS/DFS) explores. Helps on combinatorial problems (Game of 24, crosswords) where a single chain commits too early.
Reflexion
Shinn et al. (2023). After a wrong attempt, the model writes a critique of its own trace; that critique is appended to context for the next attempt. The agent improves across attempts within a single session.
Step-Back prompting
Zheng et al. (2024). Before answering a specific question, ask the model to first derive the general principle that governs the question. The principle then conditions the specific answer. Improves abstract / multi-step reasoning.
Chapter 6 - Common Anti-patterns
Vague verbs
, , , are unmeasurable. The model has to guess a direction. Replace with a measurable verb: , , .
Conflicting constraints
The model resolves contradictions arbitrarily. Pick one side of each axis and state it.
Leading questions
The framing forces the model to defend a premise instead of evaluating it. Prefer:
Long irrelevant context
Liu et al. (2023) Lost in the Middle showed models degrade on retrieval tasks when relevant information sits in the middle of a long context. Prune aggressively. If you must include long retrieved documents, put the most relevant snippets at the start or the end.
Negation-only instructions
is weaker than Models follow positive constraints more reliably than negative ones.
"Polite filler"
adds tokens without affecting behaviour. Strip it.
Chapter 7 - Evaluation
A prompt is a piece of software, so evaluate it like software.
Golden set
A small, curated set of representative inputs with hand-graded expected outputs. 30–100 items is enough to detect a 5pp accuracy shift.
Rubric
Decompose "is the output good?" into yes/no axes. For a summarisation task you might score:
- Factual (no hallucinated entities)- Complete (all named main points present)- Concise (within length limit)- Format (parses as JSON)- Refusal (correctly refused when no claim present)
Each axis scored 0/1 by a human grader or a separate "judge" model.
LLM-as-judge
Zheng et al. (2023). A stronger model grades a weaker model's output against a rubric. Cheap, scales, but biased toward outputs that look like the judge's style. Use a different family of model as the judge where possible, and spot-check 10% with a human.
A/B framework
Track $\Delta$ per axis, not just overall. A change that improves factuality but hurts conciseness is still a regression on the conciseness axis.
Statistical sanity
With $n=100$ binary outcomes, the 95% confidence interval on accuracy is roughly $\pm 10$pp around the observed rate. Differences smaller than that are noise. Increase $n$ or repeat the run to tighten.
Chapter 8 - Tool Use and Structured Output
Modern model providers expose two APIs that should replace most prompt-engineering hacks:
Function calling / tool use
You declare a JSON schema for one or more tools; the model picks one and emits arguments matching the schema. The runtime executes the tool and returns the result, which you append to the conversation and prompt again.
The model is fine-tuned to know when to call a tool versus answer directly. This is more reliable than ReAct in raw text because the model emits parsed JSON via the API.
Structured output (JSON / Pydantic mode)
You supply the full output schema; the provider's decoder constrains generation so the response is guaranteed valid against the schema. Eliminates "the model added a friendly preamble that broke my parser" failures.
When NOT to use tools
If the task is pure transformation of text the model already has the knowledge for (summarise, translate, classify), tools add latency and cost. Use tools when you need fresh data, deterministic computation, or side effects.
Chapter 9 - Putting It Together
A production prompt for "extract action items from a meeting transcript" — combining roles, delimiters, few-shot, format, and a guardrail:
This prompt is testable (you have a golden set), debuggable (each rule is a single axis you can score), and safe (the negative examples teach refusal on vague language).
Useful Shortcut
Cheat-sheet
| Goal | First thing to try || --- | --- || Wrong answer on math | Append "Let's think step by step." || Output not parseable | Switch to provider's structured-output API || Hallucinated facts | Add retrieved context with XML delimiters || Inconsistent answers across runs | Self-consistency, $n=5$, majority vote || Too verbose | Add "Output ≤ N words. No preamble." || Refuses too much | Add an explicit allow-list of permitted topics || Drifts off topic mid-conversation | Re-state the system message every $k$ turns || Slow / expensive | Decompose; use a smaller model for the easy steps |
Quick sanity checks before shipping
1. Does the prompt have all six anatomy parts (role, instruction, context, examples, format, stop)?2. Is there a golden set of ≥ 30 items with rubric scores?3. Have you tested the failure modes, not just the happy path?4. Are you using structured output for any machine-parsed response?5. Have you token-counted the prompt under realistic context lengths?6. Have you versioned the prompt in git with a short rationale per change?
References
- Brown, T. et al. (2020). Language Models are Few-Shot Learners. NeurIPS. arXiv:2005.14165.- Ouyang, L. et al. (2022). Training Language Models to Follow Instructions with Human Feedback (InstructGPT). NeurIPS. arXiv:2203.02155.- Bai, Y. et al. (2022). Training a Helpful and Harmless Assistant with RLHF. arXiv:2204.05862.- Wei, J. et al. (2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. NeurIPS. arXiv:2201.11903.- Kojima, T. et al. (2022). Large Language Models are Zero-Shot Reasoners. NeurIPS. arXiv:2205.11916.- Wang, X. et al. (2022). Self-Consistency Improves Chain of Thought Reasoning. ICLR. arXiv:2203.11171.- Lu, Y. et al. (2022). Fantastically Ordered Prompts and Where to Find Them. ACL. arXiv:2104.08786.- Khot, T. et al. (2023). Decomposed Prompting. ICLR. arXiv:2210.02406.- Zhou, D. et al. (2023). Least-to-Most Prompting Enables Complex Reasoning in LLMs. ICLR. arXiv:2205.10625.- Yao, S. et al. (2023). ReAct: Synergising Reasoning and Acting. ICLR. arXiv:2210.03629.- Yao, S. et al. (2023). Tree of Thoughts: Deliberate Problem Solving with LLMs. NeurIPS. arXiv:2305.10601.- Shinn, N. et al. (2023). Reflexion: Language Agents with Verbal Reinforcement Learning. NeurIPS. arXiv:2303.11366.- Liu, N. et al. (2023). Lost in the Middle: How Language Models Use Long Contexts. TACL. arXiv:2307.03172.- Zheng, L. et al. (2023). Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena. NeurIPS. arXiv:2306.05685.- Zheng, H. et al. (2024). Take a Step Back: Evoking Reasoning via Abstraction in LLMs. ICLR. arXiv:2310.06117.- Sclar, M. et al. (2024). Quantifying Language Models' Sensitivity to Spurious Features in Prompt Design. ICLR. arXiv:2310.11324.- Wallace, E. et al. (2024). The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructions. arXiv:2404.13208.- OpenAI (2024). Prompt engineering guide. https://platform.openai.com/docs/guides/prompt-engineering.- Anthropic (2024). Prompt engineering documentation. https://docs.anthropic.com/.
Piano Notes — 03 · Grade 3 Theory & Repertoire
Grade 3 is where the syllabus starts feeling like real music theory: triplets, minor scales in three flavours, three more keys, primary triads (I, IV, V), and your first written chord symbols. The repertoire jumps too — Bach two-part inventions, Burgmüller's middle studies, Schumann children's pieces, simple Tchaikovsky.
> Series map: 00 → 01 → 02 → 03 Grade 3 (this post) → 04 Grade 4.
Learning Outcome
- Use simple time (2/4, 3/4, 4/4) and compound time (6/8, 9/8, 12/8).- Read triplets in simple time.- Build natural and harmonic minor scales for relative minors of all keys covered.- Use major keys C, G, D, A, F, B♭, E♭ and their relative minors (A m, E m, B m, F♯ m, D m, G m, C m).- Identify intervals by quality including augmented and diminished (only A4 / d5 — the tritone — at Grade 3).- Identify and write primary triads (I, IV, V) in root position in all the above keys.- Recognise standard Italian terms for tempo, dynamics, and articulation.
Chapter 1 — Three More Keys: A, E♭, and Their Minors
| Major | Sharps/Flats | Relative minor ||-------|--------------|----------------|| C | none | A m || G | F♯ | E m || D | F♯ C♯ | B m || A | F♯ C♯ G♯ | F♯ m || F | B♭ | D m || B♭ | B♭ E♭ | G m || E♭ | B♭ E♭ A♭ | C m |
A major (3 sharps) and E♭ major (3 flats) extend the symmetric pair around C.
> Trick: visualise the circle of fifths as a clock. C is at 12. Each step clockwise adds a sharp (G, D, A, E, B…). Each step counter-clockwise adds a flat (F, B♭, E♭, A♭, D♭…). Grade 3 covers ±3 steps from C: clockwise to A, counter-clockwise to E♭.
Reading a fast key signature
When you see three sharps in the order F♯ C♯ G♯, the last is G♯ → up one semitone → A major (or its relative F♯ minor).
When you see three flats in the order B♭ E♭ A♭, the second-to-last is E♭ → E♭ major (or its relative C minor).
Chapter 2 — Minor Scales: Three Flavours
A minor key has one key signature (the natural minor) but musicians use three common scale shapes built from that signature.
Natural minor (自然小調)
Use the relative-minor key signature, start from the minor tonic. Pattern in semitones:
$$\textnormal{W H W W H W W} \quad = \quad 2,1,2,2,1,2,2$$
Harmonic minor (和聲小調)
Raise the 7th degree of the natural minor. The interval between 6 and 7 becomes an augmented 2nd (3 semitones) — gives the unmistakable "exotic" sound.
Melodic minor (旋律小調)
Ascending: raise the 6th and 7th. Descending: revert to natural minor.
> Where I got stuck: I kept mixing harmonic and melodic.> - Harmonic minor exists to fix harmony — it gives the V chord its major-3rd leading tone (G♯ in A minor) so the V → i cadence sounds strong. Raise the 7 only.> - Melodic minor exists to smooth melody — the harmonic minor's augmented 2nd (F → G♯) is awkward to sing, so going up you also raise the 6 (F → F♯) to "smooth" the gap. Coming down you don't need the lift, so revert.>> Framing them by purpose (harmony-fixing vs melody-smoothing) made them stop blurring.
All three on one diagram
Chapter 3 — Triplets
A triplet is three notes played in the time of two of the same value. Notated with a "3" above or below a group:
In 4/4, a beat that would normally hold two quavers (♪♪) is squeezed to fit three (♪♪♪). The three notes are equal, faster than quavers, slower than triplet semiquavers.
Counting triplets
Subdivide each affected beat into three syllables: "tri-pa-let" or "1-trip-let, 2-trip-let". Pick one and stick with it.
> Trick: when first practising triplets, tap the beat with your foot while saying "1-trip-let, 2-trip-let, 3-trip-let, 4-trip-let" out loud. Foot is the beat (4 taps per bar), voice is the subdivision (12 syllables per bar). Once you can do this without the piano, the piano part is mechanical.
Duplet — the inverse
In compound time (where each beat naturally divides into 3), a duplet is two notes played in the time of three. Marked "2". Less common at Grade 3 but worth knowing.
Chapter 4 — 9/8 and 12/8 (More Compound Time)
| Metre | Beats per bar | Beat unit | Feel ||-------|---------------|-----------|------|| 6/8 | 2 | dotted crotchet | Gallop || 9/8 | 3 | dotted crotchet | Slow waltz, lilting || 12/8 | 4 | dotted crotchet | Blues shuffle, slow ballad |
In 9/8, count three macro-beats per bar, each dotted-crotchet long, each subdividing into 3 quavers. "1-and-a, 2-and-a, 3-and-a."
In 12/8, count four macro-beats: "1-and-a, 2-and-a, 3-and-a, 4-and-a."
> Analogy: if 6/8 is a gallop, 9/8 is a canter in three (less symmetric), and 12/8 is a rolling blues shuffle — most "12-bar blues" songs are written in 12/8 even when the notation says 4/4 swung.
Chapter 5 — Augmented and Diminished Intervals (just the tritone)
Grade 3 expands the interval qualities to include augmented and diminished — but only for the augmented 4th (A4) and diminished 5th (d5), which are the same six-semitone gap (the tritone, 三全音).
These two are enharmonic: same sound, different spelling. Whether you call it A4 or d5 depends on note names — count the staff positions:
- C → F♯: positions = 4 (C–D–E–F) → 4th → "augmented" (one semitone larger than P4).- C → G♭: positions = 5 (C–D–E–F–G) → 5th → "diminished" (one semitone smaller than P5).
> Trick: a tritone divides the octave exactly in half ($12 / 2 = 6$ semitones). It's the most dissonant interval in tonal music — historically called diabolus in musica ("the devil in music") because medieval theorists found it so unstable they avoided writing it. Today it's the engine of jazz and blues. Knowing the history hooks the memory.
Chapter 6 — Primary Triads (I, IV, V)
A triad (三和弦) = three notes stacked in thirds. Root, third, fifth.
The primary triads of any key are built on degrees 1, 4, 5 — the tonic, subdominant, dominant. They handle the bulk of harmonic motion in tonal music.
In a major key
> Trick: in a major key, the primary triads (I, IV, V) are all major chords. Roman numerals are uppercase to show this. The supportive triads (ii, iii, vi) are minor — lowercase. The vii° is diminished — lowercase + degree mark.
In a minor key (harmonic)
Because harmonic minor raises the 7th, the V chord becomes major (it has the raised leading tone) — even though the key is minor.
> Where I got stuck: V in minor is major. This seems like a contradiction — until you realise it's deliberate: the major V supplies the leading tone that pulls back to the tonic. Without that, the V → i cadence would sound weak. Once you internalise this purpose, the rule is obvious.
Writing triads — Grade 3 expectations
Root position only. Bass note = root. Stack a 3rd and 5th above. No inversions yet (Grade 4-5 territory).
In 4-part writing (Grade 5+) you also need to know how to double notes, but Grade 3 only asks for the three-note triad spelled out.
Chapter 7 — Roman Numeral Analysis (gentle introduction)
Grade 3 starts using Roman numerals to label chords. They tell you the function without specifying the key — a Roman-numeral analysis transposes for free.
| Numeral | Function | Quality in major | Quality in minor (natural) ||---------|----------|-------------------|-----------------------------|| I | Tonic | Major | minor || ii | Supertonic | minor | diminished || iii | Mediant | minor | Major || IV | Subdominant | Major | minor || V | Dominant | Major | minor (or Major if harmonic) || vi | Submediant | minor | Major || vii° | Leading tone | diminished | Major (subtonic, ♭VII) |
> Trick: in major, the qualities pattern is M m m M M m d° ("Major, minor, minor, Major, Major, minor, diminished"). Memorise this once; apply to any major scale. The pattern never changes — only the starting key.
Chapter 8 — Italian Terms (Grade 3 set)
Same as Grade 2, plus:
Tempo
| Term | Meaning ||------|---------|| Grave | Very slow, solemn || Lento | Slow || Allegretto | Slightly slower than allegro || Andantino | Slightly faster than andante (or sometimes slightly slower — context!) || Più mosso | More motion (faster) || Meno mosso | Less motion (slower) || L'istesso tempo | The same speed (when metre changes) |
Dynamics + expression
| Term | Meaning ||------|---------|| Crescendo / diminuendo | Already known; reinforced || Sotto voce | In a whispered voice || Con brio | With brilliance, fire || Con moto | With motion || Grazioso | Gracefully || Maestoso | Majestically || Tranquillo | Calmly |
> Trick: group terms by mood rather than alphabet. "Calm cluster": tranquillo, dolce, sotto voce, cantabile. "Fast/bright cluster": vivace, brillante, con brio, con moto, agitato. When you can't remember the literal translation, your gut feel for the cluster usually gets you the right answer in an exam.
Chapter 9 — Suggested Practice Pieces
Grade 3 mainstream
| Piece | Composer | Why ||-------|----------|-----|| Minuet in G (BWV Anh. 116) | Bach (attr. C. Petzold) | A more chromatic cousin of the famous Anh. 114. Real two-voice writing || Sonatina in C, Op. 36 No. 1 (II, III) | Clementi | Movements II (Andante) and III (Vivace) — slower and faster sides of sonatina form || Burgmüller, Op. 100 No. 14 ('La Styrienne') | Burgmüller | Compound 3/8 feel, lyrical RH over walking LH || Album for the Young, Op. 68 No. 8 ('Wild Rider') | Schumann | The student favourite — feels showy without being beyond reach. Hands together at a fair clip || Children's Album, Op. 39 No. 1 ('Morning Prayer') | Tchaikovsky | Slow, hymn-like; teaches voice-leading and chord control || Sicilienne, Op. 78 (arr.) | Fauré | Lyrical, 6/8 compound, romantic harmony |
Stretching toward Grade 4
| Piece | Composer | Why ||-------|----------|-----|| Two-Part Invention No. 1 in C, BWV 772 | Bach | Independence of hands — the canonical first step into Bach || Heller, Op. 45 No. 1 | Heller | Studies designed for exactly this transition || Sonatina in F, Op. 168 No. 1 (I) | Diabelli | Larger-scale form, more notes than Op. 36 |
Choosing repertoire intelligently
By Grade 3 you should be playing three pieces simultaneously at different stages:
1. Mastery piece — old favourite, polished, played at performance tempo. Maintains confidence.2. Working piece — current focus, hands-together at slow tempo, gets the most minutes.3. Sight-read piece — new, untouched, played once per week as a "see how far I get".
The mix prevents staleness on any one and reinforces transferable skills.
> Trick: keep a small notebook of "pieces I never want to forget" — the mastery list. Every two weeks, revisit one of them for ten minutes. Without this, the pieces you spent six weeks learning will quietly evaporate from memory.
Chapter 10 — Practice Patterns: Voice Independence
Grade 3 introduces real two-voice writing (Bach inventions). The hands aren't just playing chords against melody — both hands have independent musical lines.
How to practise two voices
1. Sing one line while playing the other. Sing the RH; play only the LH. Then swap. This forces your brain to "hear" each part separately.2. Practise the LH at twice the volume, RH softly. Then reverse. Trains dynamic independence.3. Slow loops on the join points. Two-voice writing has constant "overlapping" moments where one hand crosses or sustains while the other moves. Mark those bars and isolate them.
> Where I got stuck: in Bach's first invention I could play either hand alone — but together my brain treated it as one stream and the LH always reverted to chord accompaniment. Fix: I spent a week singing the LH while playing the RH. The shift in mental model is exactly what's required — both lines are melodies, not "melody + accompaniment". Once the brain reframes it, the fingers follow.
Chapter 11 — Aural at Grade 3
ABRSM Grade 3 aural adds:
- Identify whether a piece is in major or minor key.- Identify whether a cadence is perfect (V → I) or imperfect (?? → V).- Sing back a slightly longer phrase (5–6 notes).- Identify two features of a played excerpt: dynamics, articulation, tempo change, tonality.
Practising major-vs-minor by ear
- Listen to one octave of a major scale (just C D E F G A B C). Hum it.- Now one octave of A minor (A B C D E F G A). Hum it.- The third note is the give-away. Major sounds "open / bright". Minor sounds "narrow / sad".
> Trick: the first three notes — do-re-mi vs la-ti-do — are the cleanest test. If the third note is a major third above the first, the key is major. If it's a minor third (one semitone less), the key is minor. Sing the test phrase silently in your head while listening; it'll often beat conscious analysis.
Chapter 12 — Common Grade 3 Pitfalls
| Pitfall | Fix ||---------|-----|| Memorising scales without the pattern | Always re-derive from W-H pattern. Memory + derivation = robust || Stumbling on triplets | Foot taps the macro-beat. Voice taps the subdivision || Forgetting V is major even in minor | Mark the raised leading tone with a coloured pencil for a month || Treating Bach two-voice as melody + accompaniment | Sing one voice while playing the other || Ignoring expression markings | Highlight all Italian terms before you play. Translate each. Then play || Practising scales mechanically | Vary touch: legato, staccato, accented top note, alternating dynamics. Boring scales become useful scales |
Useful Shortcut
Cheat-sheet
| What | How ||------|-----|| All Grade 3 keys | C G D A F B♭ E♭ + their relative minors || Natural minor | Same key signature as relative major || Harmonic minor | Natural + raised 7 || Melodic minor | Natural + raised 6 and 7 ascending, natural descending || Triplet | 3 notes in time of 2 || Tritone | 6 semitones; A4 going up, d5 going down (enharmonic) || Primary triads | I, IV, V (Major in major; i, iv, V in harmonic minor) || Major-key triad qualities | M m m M M m d° |
Daily routine (40 min)
| Block | Time | Content ||-------|------|---------|| Warm-up | 3 min | 5-finger pattern in today's key || Scales | 10 min | Today's major + relative natural / harmonic minor, hands separate then together || Triad drill | 3 min | I, IV, V in today's key, root position, both hands || Sight-read | 5 min | A new short piece, including 9/8 or 12/8 sometimes || Repertoire | 15 min | Difficult-bar loops on current piece || Aural | 2 min | Major-or-minor test from random recordings || Theory | 2 min | One past-paper question |
Suggested listening
| Piece | Composer | Why ||-------|----------|-----|| Two-Part Inventions (full set, BWV 772–786) | Bach | Listen to all 15. They are the idea of two-voice writing || Album for the Young, Op. 68 (all 43 pieces) | Schumann | Many sit at Grade 2-4; you'll meet them as you advance || Sonatas, Op. 36 (all 6) | Clementi | The "kids' Mozart"; classical-period form in miniature || Children's Corner | Debussy | Aspirational. Modal, modern, exquisite. Doctor Gradus is a Grade 5-6 piece worth knowing now || Études, Op. 10 No. 3 ('Tristesse') | Chopin | Romantic legato; impossible at Grade 3 but plant the seed || Suite bergamasque — Clair de Lune | Debussy | The eternal motivator. One day this is yours |
References
- ABRSM (current). Music Theory in Practice — Grade 3.- ABRSM (current). Piano Exam Pieces — Grade 3.- Eric Taylor, The AB Guide to Music Theory — Parts I & II.- IMSLP — Bach Two-Part Inventions, Schumann Op. 68, Clementi Op. 36, Tchaikovsky Op. 39, Burgmüller Op. 100.- Heller, 25 Études Mélodiques, Op. 45.- Walter Piston, Harmony — for when you want the theory deeper than the syllabus.
> Note: this post is in progress. Planned additions: audio reference per piece, a worked Roman-numeral analysis of a short Bach minuet, and visual flashcards for the new keys.
Python Course — 05 · Files, Paths, and Exception Handling
Reading from and writing to files — and handling the things that go wrong in the process — is what turns a script into a useful tool. This post covers Python's function, the context manager, the modern API, exception handling, and how to define your own exceptions. It closes the base Python course; future posts extend into stdlib deep-dives, typing, async, and packaging.
> Series map: 00 Setup → 01 Syntax → 02 Data Structures → 03 Functions & Modules → 04 OOP → 05 Files & Exceptions (this post) → (future: stdlib, typing, async, packaging, testing).
Learning Outcome
- Open, read, and write text and binary files.- Use the statement (context manager) — and understand why it matters.- Use for cross-platform path manipulation.- Read structured formats: , .- Handle exceptions with ///.- Raise built-in and custom exceptions.- Avoid the classic "catch everything" anti-pattern.
Chapter 1 — open() and the with statement
Reading
Writing
Modes
| Mode | Meaning ||------|---------|| | read (default) — file must exist || | write — truncates existing, creates if missing || | append — adds to end, creates if missing || | exclusive create — fails if file exists || | binary (combine: , ) || | read + write (, ) |
Why ?
The block is a context manager: the file is guaranteed to be closed when the block exits. Always use it for files.
> Where I got stuck: an early script of mine kept thousands of files open until the OS refused new ones. The fix was 5 characters: wrap the in a . I never forgot again.
Chapter 2 — Encoding
Always pass when opening text files. Without it, Python uses the OS default (cp1252 on Windows, utf-8 on macOS/Linux) → cross-platform bugs.
For binary files (images, executables, etc.), use / — no encoding needed:
Chapter 3 — pathlib (the modern way)
Avoid string concatenation for paths. Use :
Path operations
> Trick: and are perfect for small files. No need for at all. is a one-liner.
Chapter 4 — Structured formats
JSON
CSV
> Trick: always pass to CSV calls. Without it, Windows can write extra blank lines. Trust me, that bug is a 30-minute mystery the first time.
Chapter 5 — Exceptions: what they are
An exception is an error event that interrupts normal flow. Python signals problems by raising exceptions.
If unhandled, the exception propagates up the call stack and (eventually) crashes the program with a traceback.
Chapter 6 — Handling exceptions
Parts:- — code that might fail.- — handle a specific exception.- — multiple types + bind to name.- — runs if completed without exception.- — always runs (cleanup).
Catching too much
A bare catches everything, including (Ctrl+C) and . You will eventually trap a signal you wanted to receive.
> Rule of thumb: catch the narrowest exception type that addresses the failure. If you don't know the type, run the code, see the traceback, then catch that type.
Chapter 7 — Raising exceptions
Use built-in exceptions when they fit:
| Exception | Use when ||-----------|----------|| | A value is wrong type/range || | An argument has wrong type || / | Missing dict key / out-of-range index || | File not found || | Generic runtime issue || | Method must be overridden |
Re-raising
The chains the original — the traceback shows both.
Chapter 8 — Custom exceptions
Just subclass :
Pattern: define one base exception per package, then specific subclasses.
Callers can to catch any of them, or pick specific ones.
Chapter 9 — Context managers (your own)
You've used . You can write your own context manager — useful for resource setup/teardown (DB connections, locks, temp directories).
The block runs at the . Whatever's before/after runs as setup/teardown — even on exceptions thanks to the .
Practice Exercises
Exercise 1 — Word frequency from file
Read a text file, return a dict of word counts. Handle the missing-file case gracefully.
<details><summary>Solution</summary>
</details>
Exercise 2 — Safe int parser
Write that returns if valid, else . Don't crash on bad input.
<details><summary>Solution</summary>
</details>
Exercise 3 — JSON config loader
Write that reads a JSON file and returns its content. Define a custom for missing-file or invalid-JSON cases.
<details><summary>Solution</summary>
</details>
Exercise 4 — Find duplicates across files
Given a directory, find all files. For each line that appears in more than one file, print the line and the files it appears in.
Exercise 5 — Tiny banking system
Use for , custom exceptions for and , and a class with . Persist accounts to a JSON file on each operation.
Cheat-sheet
| What | How ||------|-----|| Read text | || Write text | || Read lines | || Open binary | || Auto-close | || JSON read | / || JSON write | / || CSV read | || Path join | || Path exists | || Glob | || Try / except | || Raise | || Chain raise | || Custom exception | || Always-run | block || Custom context manager | + |
Course base complete — what's next
You now know enough Python to write real scripts: parse files, manipulate data, structure code into modules and classes, handle errors gracefully. That covers 90% of day-to-day Python work.
Planned future posts (extensions):- Python 06: standard library tour (, , , , )- Python 07: typing + static analysis (, )- Python 08: testing (, fixtures, mocking)- Python 09: virtual environments + packaging deep-dive (, )- Python 10: async (, /, concurrent futures)- Python 11: data tools (, essentials)- Python 12: web ( or quick build)
References
- docs.python.org tutorial §7–8- pathlib- json- Fluent Python — Ch. 14 (context managers).
> Note: this post is in progress. Planned additions: encoding deep dive (BOM, latin-1, etc.), examples, JSON streaming for huge files.
Piano Notes — 02 · Grade 2 Theory & Repertoire
Grade 2 introduces three big ideas: compound time (the gallop), semiquavers (faster rhythms), and more keys (up to two sharps and two flats). The pieces start to feel like music instead of exercises — short Bach, Schumann, Bartók, all sit comfortably here.
> Series map: 00 → 01 → 02 Grade 2 (this post) → 03 Grade 3 → 04 Grade 4.
Learning Outcome
- Use 2/4, 3/4, 4/4 simple time and 6/8 compound time comfortably.- Read semiquavers and matching rests.- Build major scales for C, G, D, F, B♭ and play them hands separate, two octaves.- Identify intervals by quality (major / minor / perfect) up to an octave.- Recognise the relative minor of those major keys.- Play 3–5 short pieces hands together at Grade 2 standard.- Understand basic articulation: legato, staccato, slurs, accents.
Chapter 1 — Two more keys
Grade 2 adds D major (2 sharps: F♯, C♯) and B♭ major (2 flats: B♭, E♭).
| Key | Sharps/Flats | Notes ascending ||-----|--------------|-----------------|| C major | none | C D E F G A B C || G major | F♯ | G A B C D E F♯ G || F major | B♭ | F G A B♭ C D E F || D major | F♯ C♯ | D E F♯ G A B C♯ D || B♭ major | B♭ E♭ | B♭ C D E♭ F G A B♭ |
> Trick: the order of sharps you encounter is fixed: F♯ → C♯ → G♯ → D♯ → A♯ → E♯ → B♯. Order of flats reversed: B♭ → E♭ → A♭ → D♭ → G♭ → C♭ → F♭. Same letters, opposite ends. Mnemonics: sharps = "Father Charles Goes Down And Ends Battle"; flats = the same backwards, "Battle Ends And Down Goes Charles' Father".
Finding the key from the signature
- Sharps: the last sharp is the leading tone — go up one semitone to find the tonic.- One sharp (F♯) → up to G → G major.- Two sharps (F♯, C♯) → last is C♯ → up to D → D major.- Flats: the second-to-last flat is the tonic.- Two flats (B♭, E♭) → second-to-last is B♭ → B♭ major.- (Special case: one flat alone = F major.)
> Where I got stuck: the flat-rule asks for the second-to-last, not the last. I missed this constantly. I wrote it on the cover of my notebook. After two weeks it became automatic.
Chapter 2 — Semiquavers (Sixteenth Notes)
A semiquaver / 十六分音符 = half a quaver = quarter of a crotchet. In 4/4, four semiquavers fit in one crotchet's time.
Beaming groups
Semiquavers are usually beamed in groups of 4 (one full crotchet beat). Mixed quaver + semiquaver groupings appear too:
Counting semiquavers out loud
Standard system: "1 e and a, 2 e and a, 3 e and a, 4 e and a" — four syllables per crotchet beat. Each crotchet contains 4 sixteenths; each syllable maps to one sixteenth-note position.
> Trick: try saying "ta-ka-di-mi" instead — many drummers use it, it's faster on the tongue than "1 e and a". As long as you commit to one consistent vocabulary, the brain locks onto the subdivision.
Dotted quaver + semiquaver pattern
The most common Grade 2 rhythm:
In count words: "1 . . a, 2 . . a" — the dotted quaver takes 3 sixteenths, the semiquaver takes the last 1.
Chapter 3 — Compound Time (6/8)
In 6/8 there are two beats per bar, and each beat is a dotted crotchet (= 3 quavers). Don't be fooled by the "6" — you do not count "1-2-3-4-5-6" evenly; you feel two macro-beats, each subdivided into three.
| | 6/8 | 3/4 ||---|-----|-----|| Beats per bar | 2 | 3 || Beat unit | dotted crotchet (3 quavers) | crotchet (2 quavers) || Each beat divides into | 3 | 2 || Feel | Gallop / lilt | Waltz |
The strong beats are the 1 and the 4. The other digits are subdivisions.
> Analogy: simple time is walking — left-right-left-right, two equal steps per beat. Compound time is galloping — DA-da-da, DA-da-da. The "DA" is the macro-beat (dotted crotchet); the "da-da" are the eighth-note subdivisions.
Other compound metres
Grade 2 only requires 6/8, but for context:
| Metre | Beats per bar | Each beat ||-------|---------------|-----------|| 6/8 | 2 | dotted crotchet || 9/8 | 3 | dotted crotchet || 12/8 | 4 | dotted crotchet |
You'll meet 9/8 and 12/8 at Grade 4.
Chapter 4 — Intervals by Quality
Grade 2 upgrades intervals from number-only to quality + number.
The quality lexicon
| Quality | Applies to numbers | Example (above C) ||---------|--------------------|--------------------|| Perfect | 1st, 4th, 5th, 8th | C–C unison, C–F, C–G, C–C octave || Major | 2nd, 3rd, 6th, 7th | C–D, C–E, C–A, C–B || Minor | 2nd, 3rd, 6th, 7th | C–D♭, C–E♭, C–A♭, C–B♭ (one semitone smaller than major) |
> Trick: the perfect intervals (P1, P4, P5, P8) are called "perfect" because both they and their inversions (P5 ↔ P4, P8 ↔ P1) are perfect — symmetric. The major / minor pairs (2nd, 3rd, 6th, 7th) flip into each other when inverted: major 3rd ↔ minor 6th, major 2nd ↔ minor 7th, etc. The 9 - x rule: a major-3rd inverted is a minor-(9-3) = minor-6th.
Counting semitones to find quality
| Interval | Semitones ||----------|-----------|| Perfect unison | 0 || Minor 2nd | 1 || Major 2nd | 2 || Minor 3rd | 3 || Major 3rd | 4 || Perfect 4th | 5 || Tritone (Aug 4 / Dim 5) | 6 || Perfect 5th | 7 || Minor 6th | 8 || Major 6th | 9 || Minor 7th | 10 || Major 7th | 11 || Perfect octave | 12 |
Method:1. Count the staff positions (line + space jumps) including both ends → gives you the number (2nd, 3rd, …).2. Count the semitones on the keyboard → cross-check against the table → gives you the quality.
Working in a key signature
Within a major scale, the intervals from the tonic to each scale degree are always:
| From tonic to | Interval ||---------------|----------|| 2nd | Major 2nd || 3rd | Major 3rd || 4th | Perfect 4th || 5th | Perfect 5th || 6th | Major 6th || 7th | Major 7th || 8th | Perfect octave |
> Trick: in a major key, all intervals built upward from the tonic are major or perfect. There are no naturally-occurring minor intervals from the tonic of a major key — they only appear when you alter notes with accidentals or use a different starting note.
Chapter 5 — Relative Minor
Every major key has a relative minor that shares its key signature. The relative minor's tonic sits a minor 3rd below the major tonic (or equivalently, the 6th degree of the major scale).
| Major | Relative minor | Shared sharps/flats ||-------|----------------|----------------------|| C major | A minor | none || G major | E minor | F♯ || F major | D minor | B♭ || D major | B minor | F♯ C♯ || B♭ major | G minor | B♭ E♭ |
The natural minor scale uses only those shared sharps/flats. (Harmonic and melodic minors add accidentals — Grade 3 material.)
> Where I got stuck: I kept confusing relative minor with parallel minor.> - Relative: same key signature, different tonic (C major ↔ A minor).> - Parallel: same tonic, different key signature (C major ↔ C minor).>> The fix that stuck: "Relative" = the related key with the same parents (signature). "Parallel" = the parallel universe with the same name (tonic). Two distinct concepts; pin them down separately.
Chapter 6 — Articulation
Grade 2 starts to care about how you play, not just what.
| Marking | Meaning ||---------|---------|| Legato | Connected, smooth (often shown with a slur) || Staccato (dot above/below note) | Short, detached — roughly half the written value || Tenuto (line above/below) | Held to full value, slight emphasis || Accent (>) | Played louder than surrounding notes || Slur (curved line over multiple notes) | Phrase boundary; play legato within || Fermata (eye-shaped pause) | Hold longer than written |
> Trick: the staccato dot means "half the value, the rest is silence". So a staccato crotchet = a quaver of sound + a quaver of silence. Don't clip the note artificially short; just lift the finger earlier and let the air do the rest.
Touch types — the three you'll use most
- Legato — finger weight transfers from key to key without lifting. The previous finger releases as the next presses, like walking.- Staccato — the finger bounces off the key. Wrist relaxed; energy from the fingertip, not the arm.- Portato — between legato and staccato, marked with dots under a slur. Each note slightly separated but still "singing" through.
Chapter 7 — Suggested Practice Pieces
Grade 2 (mainstream)
| Piece | Composer | Why ||-------|----------|-----|| Minuet in G minor (BWV Anh. 115) | Bach (attr. Petzold) | Companion to the famous G major minuet. Slightly more melancholy, same difficulty || Burgmüller, Op. 100 No. 2 ('Arabesque') | Burgmüller | The first piece beginners feel proud of. Quick, satisfying, sounds harder than it is || Mikrokosmos, Vol. 2 No. 47 ('Big Fair') | Bartók | Compound feel, jaunty. Real musical character || Album for the Young, Op. 68 No. 1 ('Melodie') | Schumann | Pure singing melody, simple two-voice texture. Romantic style introduction || Sonatina in C, Op. 36 No. 1 | Clementi | Movement I. The classic "first real sonatina". Hands together, real form |
Stretching toward Grade 3
| Piece | Composer | Why ||-------|----------|-----|| Allegro in B♭, K. 3 | Mozart | Mozart aged 5. Hands separate, very early style || Minuet in F major (BWV Anh. 113) | Bach | Two voices, longer phrases than its companions || Burgmüller, Op. 100 No. 5 ('Innocence') | Burgmüller | Smooth RH semiquavers over walking LH — classic compound technique |
How to choose
Pick one piece that excites you (whatever the level) and one that's slightly easier than your current ability. The exciting piece pulls you forward; the easy piece is where you actually drill technique without frustration. Rotate every 4–6 weeks.
> Trick: finish every learning session by playing the easiest piece you know at performance tempo, all the way through. It costs 90 seconds and reinforces what "finished" feels like. The pieces you struggle with don't get this treatment — only the ones you've already mastered.
Chapter 8 — Practice Templates
"Difficult bar" loop (10 minutes)
Pick the worst 4-bar passage in your current piece. Set metronome to half your target tempo. Play those 4 bars 10 times in a row without stopping. If you fail, slow the metronome by 10 BPM and start the count again. After 10 clean reps, raise BPM by 5. Repeat until you hit target.
This is the single highest-leverage practice technique. Twenty minutes of this beats two hours of "playing the whole piece from the top".
"Pulse robot" warm-up (5 minutes)
Set the metronome to quarter = 60. Play any scale you know, one note per click, both hands separate. Then both hands together. Then two notes per click. Then four. The point isn't the scale — it's getting your hands locked to an external clock.
"Mock exam" run (20 minutes, once a week)
Treat one full practice session per week as the exam itself. Set up your music, your phone-recorder, your metronome. Play your three current pieces back-to-back with no restarts. Then listen to the recording. Mistakes you didn't notice in the moment will jump out on playback. That's your homework for the next six days.
Chapter 9 — Aural Skills at Grade 2
ABRSM Grade 2 aural adds:
- Identify whether a phrase is in 2/4, 3/4, or now 6/8.- Sing back a slightly longer phrase (4 notes).- Clap back a 4-bar rhythm.- Identify a feature: "loud", "soft", "smooth", "detached", "ending on a different note than it started" — broader description.
> Trick: to tell 6/8 from 3/4, listen for the gallop. 3/4 walks evenly in threes — ONE-two-three, ONE-two-three. 6/8 lopes — DA-da-da DA-da-da. Tap your foot. If the foot lands twice per bar, it's 6/8. If three times, it's 3/4. The foot doesn't lie.
Chapter 10 — Common Pitfalls at Grade 2
| Pitfall | Fix ||---------|-----|| Counting compound time as simple (1-2-3-4-5-6 evenly) | Subdivide aloud as "1-and-a 2-and-a". Foot taps the two macro-beats || Forgetting which sharps/flats apply | Re-write the key signature on a sticky note at the top of every page during practice || Rushing fast notes | Tempo is a choice, not a test. Slow until clean. Speed comes free || Ignoring articulation marks | Highlight staccato dots and slur arcs with coloured pencil. The eye blocks them out otherwise || All practice in one big chunk | Two 20-min sessions > one 40-min. Memory consolidates between sessions || Stopping at the first mistake | Don't stop. Mark the bar, finish the piece, then loop the marked bar at the end |
Useful Shortcut
Cheat-sheet
| What | How ||------|-----|| Sharps order | F♯ C♯ G♯ D♯ A♯ E♯ B♯ || Flats order | B♭ E♭ A♭ D♭ G♭ C♭ F♭ || Key from sharps | Last sharp + 1 semitone = tonic || Key from flats | Second-to-last flat = tonic (1 flat = F) || Relative minor | 3 semitones below major tonic || Compound feel | Macro-beats divide into 3 || Major-key intervals from tonic | All major or perfect || Inversion rule | (9 - number); major ↔ minor; perfect ↔ perfect || Staccato | Half the written value, rest is silence |
Daily routine (35 min)
| Block | Time | Content ||-------|------|---------|| Five-finger warm-up | 3 min | C, G, F, D, B♭ positions || Scales | 7 min | Today's key + relative minor, hands separate, 2 octaves || Sight-read | 5 min | New short piece each day, including 6/8 || Repertoire | 15 min | Difficult-bar loops on current pieces || Aural | 3 min | Clap back a rhythm from the metronome || Theory | 2 min | One past-paper question |
Suggested listening
| Piece | Composer | Why ||-------|----------|-----|| Anna Magdalena Notebook (full set) | Bach | Several pieces sit at Grade 2; you'll meet them in the next 6 months || Album for the Young, Op. 68 (first 10) | Schumann | Romantic equivalent of the Anna Magdalena set || Pavane pour une infante défunte | Ravel | Slow, beautiful, aspirational. Listen for what compound time can feel like || Songs Without Words, Op. 19 No. 1 | Mendelssohn | RH melody + LH accompaniment in the canonical lyrical style || Sonata in C, K. 545 (Mvt. II) | Mozart | Pure singing line; what your scale-runs are eventually for |
References
- ABRSM (current). Music Theory in Practice — Grade 2.- ABRSM (current). Piano Exam Pieces — Grade 2.- Eric Taylor, The AB Guide to Music Theory — Part I.- IMSLP — Bach Anna Magdalena Notebook, Schumann Album for the Young, Burgmüller Op. 100, Bartók Mikrokosmos.- Charles-Louis Hanon, The Virtuoso Pianist in 60 Exercises, Part 1.
> Note: this post is in progress. Planned additions: audio reference for each suggested piece, downloadable practice tracker PDF, common-question Q&A from real Grade 2 exams.
Piano Notes — 01 · Grade 1 Theory & Repertoire
ABRSM Grade 1 covers the foundations every musician needs: clefs, note values, simple time signatures, the first few keys, basic intervals, and the very first scales. This post pairs the syllabus with practice pieces graded at the same level, plus the memory tricks I wish someone had handed me on day one.
> Series map: 00 Beginner Basics → 01 Grade 1 (this post) → 02 Grade 2 → 03 Grade 3 → 04 Grade 4. Grades 5–8 to follow.
Learning Outcome
- Read fluently in treble and bass clef on the five staff lines, four spaces, and one ledger line above or below.- Identify all note values from semibreve to quaver, and matching rests.- Use 2/4, 3/4, and 4/4 time signatures correctly.- Name notes in C, G, F majors and their key signatures.- Build major scales for C, G, F (one octave, hands separate).- Identify intervals between any two notes of the C major scale (number only).- Recognise the tonic, dominant, subdominant of those three keys.- Play 3 to 5 short pieces hands together at Grade 1 standard.
Chapter 1 — Pitch Notation Recap
Terminology
- Pitch (音高) — how high or low a note sounds, measured in frequency.- Accidental — sharp ♯ / flat ♭ / natural ♮ applied to a single note.- Sharp (♯) — raise the pitch by one semitone.- Flat (♭) — lower the pitch by one semitone.- Natural (♮) — cancel a previous sharp or flat.
An accidental affects every occurrence of that note in the same octave for the rest of the bar — then the barline resets it. A key signature is the only "global" accidental.
Ledger lines (加線)
Grade 1 requires one ledger above and one below in each clef.
- Treble: one line above the staff = A5, one line below the staff = Middle C (C4).- Bass: one line above the staff = Middle C (C4) as well (the same note), one line below the staff = E2.
> Trick: Middle C is the connector. It sits one ledger below the treble staff AND one ledger above the bass staff. Same key on the piano, two ways to write it. Drill this until it's automatic — Grade 2 and beyond use it constantly.
Chapter 2 — Note Values (音符的時值)
English / 中文 / symbol table
| EN | 中文 | UK name | Beats in 4/4 ||----|------|---------|--------------|| Whole note | 全音符 | Semibreve | 4 || Half note | 二分音符 | Minim | 2 || Quarter note | 四分音符 | Crotchet | 1 || Eighth note | 八分音符 | Quaver | ½ |
ABRSM uses the UK terms (semibreve, minim, crotchet, quaver). American sheet music uses whole/half/quarter/eighth. Same notes, different names. Get used to both.
Rests
Every note value has a matching rest. The same beat counts apply — a crotchet rest is 1 beat of silence in 4/4.
> Trick: I confused the whole-note rest (hangs down from a line) and the half-note rest (sits on top of a line). Memory aid: "the whole rest is a hole — it falls down. The half is half full — it sits up." Silly, never forgot it again.
Dots and ties
- A dot after a note adds half its value. Dotted minim = 2 + 1 = 3 beats.- A tie joins two notes of the same pitch — sum their durations.- A slur joins two notes of different pitches — phrasing, not duration.
Chapter 3 — Time Signatures (拍號)
Grade 1 covers 2/4, 3/4, 4/4 only.
The top number = beats per bar. The bottom number = which note value gets one beat (4 = crotchet).
| Time signature | Beats per bar | Feel ||----------------|---------------|------|| 2/4 | 2 | March (left-right-left-right) || 3/4 | 3 | Waltz (ONE-two-three) || 4/4 | 4 | Pop, hymn, default (ONE-two-three-four) |
The first beat of every bar is the strongest. Place natural emphasis there; the bar lines exist precisely to tell you where to push slightly.
Bar (小節) maths
The notes in any bar must add up to the time signature's beat count. If 4/4 has only crotchets and quavers, common bars include:
> Trick: when sight-reading, count out loud on every beat — including rests. The voice keeps the pulse even when your hands stumble. Silent counting is for performance, not learning.
Chapter 4 — Keys and Key Signatures
Grade 1 syllabus: C major, G major, F major.
| Key | Sharps/Flats | Memory anchor ||-----|--------------|---------------|| C major | none | Easy default || G major | 1 sharp: F♯ | "Goes up" → sharp || F major | 1 flat: B♭ | "Falls down" → flat |
Scale construction reminder
Major scale pattern in semitones: W W H W W W H (whole, whole, half, whole, whole, whole, half).
Apply from any tonic and you get a major scale. From C: all whites. From G: hits F♯ as the 7th. From F: hits B♭ as the 4th.
> Trick: the major-scale pattern doesn't change — only the starting note does. If you can derive C major from scratch, you can derive every major scale by counting W W H W W W H with your finger on the keyboard. Don't memorise 12 scales; memorise one pattern and 12 starting points.
Tonic, Dominant, Subdominant
For any major scale:
- Tonic (I) — the 1st degree. Home note. C in C major.- Subdominant (IV) — the 4th degree. F in C major.- Dominant (V) — the 5th degree. G in C major.
These three notes form the primary triads of the key, the most important chords in any major piece. Half of pop and folk music is built from just I, IV, V.
> Where I got stuck: I assumed "dominant" meant "loudest" or "main". It actually means the 5th, always. The label is positional, not musical. Once I stopped overthinking it, every scale fell into place.
Chapter 5 — Intervals (Number Only)
At Grade 1 you only need to identify the number of an interval (2nd, 3rd, etc.), not its quality (major / minor / perfect). Quality starts at Grade 2.
Counting
Count the lower note as 1, then count up the staff lines and spaces to the upper note. The count includes both notes.
| Interval | Staff positions ||----------|-----------------|| Unison | Same line/space || 2nd | Adjacent line + space || 3rd | Line to next line, or space to next space || 4th | Line to space-after-the-next-line || 5th | Line to second line above || 6th | Space to third line above, or line to third space above || 7th | Line to third line above, or space to third space above (one short of an octave) || Octave (8th) | Same letter, seven steps up (line to space, or space to line) |
> Trick: 3rds and 5ths "jump white" — they go line-to-line or space-to-space, looking visually stacked. 2nds and 4ths "step black" — one note sits on a line, the other in a space. Once your eye reads these shapes, you stop counting notes one-by-one.
Chapter 6 — Hands-Together Coordination
You played hands together in Post 00 already with "Twinkle". Grade 1 expands this. The technique:
1. Each hand alone, played until boring. Genuinely boring — no mistakes, no thinking.2. Hands together at half speed. Eyes on the page, not the hands.3. Pulse first, accuracy second. If one hand stumbles, don't stop the pulse. Drop the wrong-hand note rather than break the beat.4. Slow with metronome. Crotchet = 60. Once smooth, raise by 5 BPM increments.
> Where I got stuck: my left hand was 6 weeks behind my right. The fix: I practised only the left hand for one full week. No right hand at all. Result: by the next week my left could play its own line cleanly, and hands-together suddenly worked.
Chapter 7 — Suggested Practice Pieces (Grade 1 level)
These are real Grade 1 / Initial Grade pieces with public domain or freely-available scores. Hunt them on IMSLP or buy the ABRSM exam book — the album also contains your audio reference.
Easier end (still inside Initial Grade)
| Piece | Composer | Why it's good for you ||-------|----------|------------------------|| Minuet in G (BWV Anh. 114) | Bach (attr. C. Petzold) | Two-bar phrases, classic Baroque feel, hands-together at a comfortable tempo. Real music, not a "method book exercise" || Allegro in C | Diabelli, Op. 125 No. 1 | Pure C major, balanced hands, teaches the I-IV-V harmony pattern aurally || No. 9 'In Yugoslav Mode' | Bartók, Mikrokosmos Vol. 1 | Modern teaching piece; clean RH melody, sparse LH. Bartók wrote these for his son || Burgmüller, Op. 100 No. 1 ('La Candeur') | Burgmüller | Lyrical RH melody over a steady LH; brilliant first piece with real expression |
Slightly stretching
| Piece | Composer | Why ||-------|----------|-----|| Minuet in F (K. 2) | Mozart (age 6) | Yes, six. Easy enough for Grade 1, written by a child — fun fact while you struggle || Russian Folk Song Op. 107 No. 3 | Beethoven | Two voices, both inside one octave. Tiny, perfect study of independent hands || No. 6 'Gypsy Dance' | Bartók, For Children Vol. 1 | Drone bass, melody floats above. Teaches "ostinato" by feel |
How to study a piece
1. Hands separate, slow, no metronome — until you can do four bars without error.2. Hands separate, with metronome — at the slowest tempo where you're still error-free.3. Hands together, slow — half the eventual target.4. Hands together, target tempo — and only here do you allow yourself to think about expression.5. Memorise the hardest bar — play it from any cold start.
> Trick: number the bars and track them on a notepad. Mark each bar with ✓ when you can play it hands-together at tempo. The unchecked bars are your next 10-minute focus, not the whole piece. You'd be amazed how few bars are actually broken — usually 3-4 out of 32.
Chapter 8 — Aural / Listening Skills
Grade 1 ABRSM practical includes an aural test. The skills:
- Clap back a rhythm — listen to a 2- or 3-bar rhythm in 2/4, 3/4, or 4/4; clap it back.- Sing back a short phrase — three or four notes, played twice.- Identify time signature — listen to a tune; say whether it's in 2/4, 3/4, or 4/4.
Practising aural without a teacher
- Phone metronome + clap for rhythms. Tap a 4-bar pattern on the table, then clap it back without looking.- Sing scale degrees — call out "1, 2, 3" up the major scale while playing it. Builds the do-re-mi reflex.- Listen to any piece and tap your foot. If your tapping settles into pairs, it's 2/4 or 4/4. If into threes, it's 3/4. Public music is your unlimited test bank.
> Trick: whistling is sneaky-good for aural training. If you can whistle the tune you've been practising, you've internalised the pitch shape. If you can only "sort of" whistle it, you haven't. The whistle is a free pitch test.
Chapter 9 — Common Grade 1 Pitfalls
| Pitfall | Fix ||---------|-----|| Counting in your head, not out loud | Out loud — especially on rests. The voice doesn't lie || Forgetting accidentals carry through the bar | Re-write any tricky bar on paper, accidentals included || Reading every note individually | Train shapes (steps vs leaps, scale-fragments) — see Chapter 5 || Skipping the LH because RH is "the melody" | LH is half the music. Practise LH alone twice as much for a month || Slowing down only the hard bars | Slow down the whole piece. Speed differences mid-piece hide as nervousness in exam || Practising past tiredness | 25 min focused > 60 min tired. Stop when accuracy drops |
Useful Shortcut
Cheat-sheet
| What | How ||------|-----|| Find any key in G major | Same as C, except F → F♯ || Find any key in F major | Same as C, except B → B♭ || Major scale pattern | W W H W W W H || Identify interval number | Count up staff positions, include both endpoints || Dotted note value | note + half its value || Bar must equal | Top number of time signature || Tonic / subdominant / dominant | 1st / 4th / 5th degrees || Whole rest hangs | Half rest sits |
Daily routine (30 min)
| Block | Time | Content ||-------|------|---------|| Five-finger warm-up | 3 min | C, G, F positions, both hands || Scale | 5 min | C, G, F major hands separate, one octave || Sight-reading | 5 min | New short piece each day || Repertoire | 12 min | Current piece, focus on the worst 4 bars || Theory | 5 min | One past-paper question, written out by hand |
Suggested listening (context, not homework)
| Piece | Composer | Why ||-------|----------|-----|| Anna Magdalena Notebook (full) | Bach | Bach wrote this for his second wife — beginner-friendly but real music. Many Grade 1-3 pieces sit inside it || Album for the Young, Op. 68 | Schumann | Romantic counterpart to Bach's notebook. Hear what's coming in Grade 2-3 || Minute Waltz, Op. 64 No. 1 | Chopin | Aspirational; impossible at Grade 1 but plant the seed || Goldberg Variations, BWV 988 | Bach | The Mount Everest of solo keyboard. Listen for context, not to play (yet) || Children's Album, Op. 39 | Tchaikovsky | Russian counterpart to Schumann's; many pieces sit at Grade 3-4 |
References
- ABRSM (current). Music Theory in Practice — Grade 1.- ABRSM (current). Piano Exam Pieces — Initial / Grade 1 (the official syllabus collection).- Eric Taylor, The AB Guide to Music Theory — Part I.- IMSLP — public-domain scores for every classical work mentioned.- Bartók, Mikrokosmos Vols. 1–2 (Boosey & Hawkes).- Burgmüller, 25 Easy and Progressive Studies, Op. 100.
> Note: this post is in progress. I'll add embedded audio reference snippets per piece once I find legally-clean recordings, plus a printable practice-tracker checklist.
Piano Notes — 00 · Beginner Basics & Your First Songs
The first post in a self-study piano series. Goal: by the end of this one you can sit at any keyboard, find any note in under five seconds, and play three short pieces from memory. Skip the marketing fluff and go straight to the muscle memory.
> Series map: 00 Beginner (this post) → 01 Grade 1 → 02 Grade 2 → 03 Grade 3 → 04 Grade 4. Grades 5–8 will follow.
Learning Outcome
- Sit comfortably at the keyboard with healthy posture.- Name every white key on sight — both directions, both clefs.- Find Middle C on any size piano without thinking.- Play three short pieces with both hands.- Recognise the difference between a piano, an upright, a digital, and a synth — and pick the right one for practice.
Chapter 1 — Why piano is a good first instrument
The keyboard is the clearest visual map of Western music. Every other instrument hides pitch behind a fingering chart; the piano lays the entire pitch space out in front of you, left-to-right, low-to-high. If you understand "how a scale looks" on the piano, you understand it on a guitar, a violin, or in a software synth — you just don't see it as plainly.
A second practical reason: the piano is monophonically simple but polyphonically rich. Beginners can produce a clean tone from day one (press → sound), while advanced players spend a lifetime on the same instrument. Few instruments span that range.
> Where I started: I wasted my first two weeks googling "best digital piano under $500" instead of practising. The truth is any 88-key weighted keyboard from a major brand (Yamaha, Roland, Casio, Kawai) is fine for the first year. The piano you have and play every day beats the piano you research and never own.
Chapter 2 — Picking an instrument
Acoustic (real) piano
- Upright (直立式) — most homes. Footprint 150 cm wide, depth 60 cm. Tone is good but action is lighter than a grand.- Grand (平台式) — long horizontal action, more responsive. Babies (150 cm) to concert (275 cm). Expensive, needs tuning twice a year.
Digital piano
- Weighted action (重錘鍵盤) is non-negotiable for serious practice. "Semi-weighted" and "synth action" feel different and will delay your finger development.- 88 full keys preferred over 76 or 61 — exam pieces will eventually need the full range.- Built-in speakers are a "nice to have"; quality varies. Headphones bypass the problem and are quieter for housemates.
What you actually need (the honest list)
| Item | Necessity | Why ||------|-----------|-----|| 88-key fully-weighted digital, or any acoustic upright | Essential | Your hands form habits around action weight || Bench at correct height | Essential | Wrong height = wrist strain in 4 weeks || Metronome (app fine) | Essential | The most-skipped tool that fixes the most-common problem || Music stand with light | Highly recommended | You'll be reading every session || Headphones (digital) | Recommended | Practise at any hour without conflict || Pedal (sustain) | Eventually | Not for week 1; needed by week 8 |
> Trick: the right bench height = your forearms parallel to the floor when fingers rest on the keys, wrists neither dropping nor arching. Sit too high → you push the keys down with extra force and tense the wrist. Sit too low → you reach up and the fingers fight gravity. Adjust this on day one. Re-check it monthly.
Chapter 3 — The keyboard map
Black-key landmarks
The black keys come in groups of 2 and 3. The 2-group anchors C-D-E; the 3-group anchors F-G-A-B.
- The white key immediately left of a 2-group is always C.- The white key immediately left of a 3-group is always F.
These two anchors are the only ones you ever need to memorise. The other letters (D, E, G, A, B) are derived by counting in alphabetical order from C or F.
> Trick: the 2-group is C-D-E; 3-group is F-G-A-B. Stack the consonants in your head: Car Drives East, Fish Goes Around Back. Cheesy works.
Middle C
The C closest to the centre of the keyboard. On an 88-key piano this is the fourth C from the bottom — C4 in scientific pitch notation. On a 61-key it's the third C. Either way, find the centre, find the 2-group nearest it, drop your right thumb on the white key to the left of that pair.
Octaves
Same letter, doubled frequency: $f{n+12} = 2 \cdot fn$. The keyboard pattern repeats every 12 keys (7 white + 5 black). Once you memorise the 7-white-key span (C D E F G A B), the entire 88-key keyboard is mapped.
Chapter 4 — Posture and hand mechanics
Sitting
- Bench centred on Middle C.- Sit on the front third of the bench, not slumped back.- Feet flat on the floor. (Smaller players: get a footstool; dangling feet cause back tension.)- Elbows roughly at keyboard height.- Shoulders down and relaxed. No shrugging up to the ears.
Hands
- Curved fingers, as if holding a tennis ball.- Strike with the fingertip, not the pad.- Wrist is level with the back of the hand — flat, not collapsed, not arched.- Thumb plays with its side, slightly tucked under.
Finger numbering
| Hand | 1 | 2 | 3 | 4 | 5 ||------|---|---|---|---|---|| Right | Thumb | Index | Middle | Ring | Little || Left | Thumb | Index | Middle | Ring | Little |
Both hands use the same scheme — the thumb is always 1 for its own hand. Sheet music writes RH finger numbers above the staff, LH below.
> Where I got stuck: I kept dropping my wrist when playing softly. Fix: I propped a coin on the back of my hand during slow practice. If it stayed put for eight bars, my wrist was level. Sounds gimmicky, fixes it in three days.
Chapter 5 — Reading the staff (just enough for now)
Only what you need for the three first songs is covered here. Full staff theory is in Post 01.
Treble (right hand)
Lines bottom to top: E G B D F — "Every Good Boy Does Fine".Spaces bottom to top: F A C E — already spells FACE.
Bass (left hand)
Lines: G B D F A — "Good Boys Do Fine Always".Spaces: A C E G — "All Cows Eat Grass".
Middle C bridges both
Middle C sits on the first ledger line below the treble staff and the first ledger line above the bass staff. The same note, written two ways. The grand staff joins the two clefs with a brace — right hand on top, left hand on bottom.
> Analogy: the grand staff is two ladders bolted together at Middle C. Right hand climbs the top ladder (higher pitches), left hand climbs the bottom ladder (lower pitches). Middle C is the rung they share.
Chapter 6 — Three first pieces
These are the canonical first songs. I picked them because (1) the right-hand melody fits inside one hand position, (2) the left hand uses only two or three notes, and (3) you've heard them since you were five — your ear corrects you before your brain does.
Piece 1 — "Ode to Joy" (Beethoven, Symphony No. 9)
Hand position: RH thumb on Middle C.
Repeat. Then play:
Why this piece: the melody never leaves the five-finger span of one hand. You don't move your wrist. The whole song is your introduction to "fingers stay put, brain reads."
> Trick: count "1 2 3 4" steadily through it — every note is one beat except the last D of each line, which is two beats. If you can clap it without playing, you can play it.
Piece 2 — "Mary Had a Little Lamb"
Hand position: RH thumb on Middle C.
Why this piece: introduces a longer arc with repetition. You'll notice the same three-note shape repeats — once you spot the pattern your eye stops reading note-by-note.
Piece 3 — "Twinkle Twinkle Little Star" — both hands
RH: thumb on Middle C.
LH: start with the 5th finger on the C an octave below Middle C (so 5 = C3, 3 = E3, 1 = G3).
For your first attempt, just play the C3 long-held for each bar — one note per bar. Hold it under the right hand.
Once that's solid, add G3 alternating where the harmony changes (bar 3, bar 6).
> Where I got stuck: hands together on day three felt impossible. Fix: don't try hands together until each hand is boring on its own. "Boring" is the right level — if you have to think, you're not ready. Each hand should run on autopilot, and only then do you stack them.
Chapter 7 — How to practise (the meta-skill)
If you take one thing from this post, take this: slow practice with full attention beats fast practice with split attention by an order of magnitude. The brain encodes accuracy, not speed. Speed comes free once accuracy is locked in.
Daily routine, 25–30 minutes
| Block | Time | What ||-------|------|------|| Warm-up | 3 min | 5-finger pattern, C major position, RH then LH then both || Note-naming | 2 min | Pick a random key, name it out loud || Today's piece | 15 min | One section at a time, slow, no mistakes || Sight-read | 5 min | Brand-new short piece, no repeats — see how far you get || Cool-down | 2 min | Replay your most-mastered piece for fun |
Slow practice rules
1. Start at a tempo where you make zero mistakes. Mistakes at speed become mistakes at all speeds.2. Loop the section that's hard, not the whole piece. Four bars. Ten times. Then move on.3. Hands separate before hands together. Always.4. Watch your hand for one minute, then watch the page for one minute. Alternate. Eyes-on-page-only forces you to internalise the keyboard map.5. End on a success. The last attempt before you stop is the one your brain rehearses overnight.
> Trick I steal from sports coaches: finish every practice session by playing the easiest passage of the day one more time, slowly and perfectly. Going to bed on a clean run reinforces the right pattern in sleep. Going to bed frustrated reinforces the wrong one.
Chapter 8 — Common beginner mistakes
| Mistake | Fix ||---------|-----|| Eyes glued to the hand | Cover the keys with a small towel for one passage; force the eye onto the page || Tense shoulders | Pause every 5 min; roll shoulders back; reset posture || Speeding through easy bars, stuttering on hard ones | Practise the hard bars at the easy bars' tempo, not the other way round || Skipping the metronome | The metronome reveals your fudges. Use it on slow practice. Speed practice later || Always practising from bar 1 | Bar 1 gets 100× practice, bar 32 gets 1×. Start from random bars || Quitting before recording | Record yourself once a week, even on phone audio. The recording is honest in ways your ears in the moment are not |
Useful Shortcut
Cheat-sheet
| What | How ||------|-----|| Find Middle C | White key left of the 2-black-key group nearest the keyboard centre || Treble lines | E G B D F (Every Good Boy Does Fine) || Treble spaces | F A C E || Bass lines | G B D F A (Good Boys Do Fine Always) || Bass spaces | A C E G (All Cows Eat Grass) || Finger numbering | 1 = thumb (both hands) → 5 = pinky || Bench height | Forearms parallel to floor when fingers rest on keys || Practice motto | Slow + accurate > fast + sloppy || End each session | One perfect run of an easy passage |
When to move on
You're ready for Post 01 — Grade 1 Theory when you can:- Play all three first songs hands together from memory.- Name any white key in under 2 seconds.- Identify any line or space note in either clef.- Sit at the piano without checking your posture.
If you're not there yet, stay here another week or two. The grades build on the basics; rushing past the basics breaks every grade above.
Suggested next listening
These pieces aren't homework — they're context. Listen to them on your commute or in the background while cooking. Knowing what good piano sounds like trains your ear faster than any exercise.
| Piece | Composer | Why ||-------|----------|-----|| Minuet in G (BWV Anh. 114) | Bach (attr.) | Where every classical piano student is heading; clean, simple, beautiful || Gymnopédie No. 1 | Satie | Modern feel, dead-easy harmony, will hook you on the instrument || Clair de Lune | Debussy | Aspirational — when you can read this in three years, you've arrived || Children's Corner — I. Doctor Gradus ad Parnassum | Debussy | A study with melody. Teaches what practice can become || Mikrokosmos, Vol. 1 | Bartók | Modern teaching pieces — many at Grade 1 level. Listen and you've already half-learned them |
References
- ABRSM (current edition). Piano Practical Syllabus. (Skim the Initial Grade list now.)- Adam Sietz, Piano Lessons for Adults. (Adult-focused, no kids-book art.)- James Bastien, Bastien Piano Basics — Primer Level. (The classic English-language beginner method.)- Alfred's Adult All-In-One Course — Level 1. (Alternative method book — pick one and stick to it.)- Chuan C. Chang, Fundamentals of Piano Practice. (Free online — practice technique deep dive.)- Heinrich Neuhaus, The Art of Piano Playing. (Eventual reading; advanced philosophy.)
> Note: this post is in progress. Planned: audio reference tracks per song once I find a clean-license source, and a video of correct vs incorrect posture.
Python Course — 04 · Object-Oriented Python (classes, inheritance, dataclasses)
Object-oriented programming organises code around data + the operations on it. Python's OOP is lightweight (no keyword, no compile-time type checking) yet flexible enough for everything from 10-line scripts to massive frameworks. This post covers classes, instances, inheritance, dunder methods, properties, and the modern decorator.
> Series map: 00 Setup → 01 Syntax → 02 Data Structures → 03 Functions & Modules → 04 OOP (this post) → 05 Files & Exceptions → (future).
Learning Outcome
- Define classes with , methods, and instance attributes.- Use inheritance and the mechanism.- Override dunder methods (, , , etc.).- Use for computed attributes.- Use and .- Write classes with (the modern shortcut).- Understand composition over inheritance.
Chapter 1 — Class basics
Terminology
- Class — a template that defines attributes and methods.- Instance — an object created from a class.- Attribute — data stored on an instance (or class).- Method — a function defined inside a class.- — the conventional first parameter of every instance method, automatically bound to the instance.
Minimal class
is the constructor — called automatically when you do . The first parameter is the freshly-created instance.
> Trick: you don't pass when calling — Python passes it for you. Inside the class definition, every method that operates on instance data needs as the first parameter.
Chapter 2 — Class vs instance attributes
Mutable class attributes are a trap — same pattern as the function default bug:
Fix: initialise in so each instance gets its own list.
Chapter 3 — Inheritance
super() — calling the parent
Multiple inheritance exists () and uses the MRO (method resolution order). Keep it simple — use single inheritance unless you have a strong reason.
Chapter 4 — Dunder methods
"Dunder" = "double underscore". These are how Python hooks into your class for built-in operations.
| Dunder | Triggered by | Returns ||--------|-------------|---------|| | | nothing (initialises) || | , REPL display | str (developer view) || | , | str (user view) || | | bool || | | bool || | | int || | | item || | | bool || | | iterator || | | result || | | result |
Example: a Vector class
Chapter 5 — Properties (computed attributes)
lets you expose calculated values as if they were attributes, and add validation/setters later without breaking callers.
Chapter 6 — classmethod and staticmethod
- — gets the class as . Used for alternative constructors.- — gets nothing. Used for utility functions that belong with the class logically.
Chapter 7 — @dataclass (the modern shortcut)
Most classes are just "bags of attributes" with , , and . The decorator generates all of that for you.
That's it. No boilerplate.
Options
- — immutable (hashable, usable as dict keys).- (3.10+) — faster + uses less memory.- — generates , , , .
Default values
> Trick: should be your default class style. Reach for plain only when you need custom logic.
Chapter 8 — Composition over inheritance
A common OOP design rule: when you can use containment instead of inheritance, do.
Inheritance creates a tight, often-unwanted coupling. Composition keeps pieces interchangeable.
Practice Exercises
Exercise 1 — BankAccount
Write a class with , , and (read-only). Reject withdrawals that would overdraw. Track all transactions in a list.
<details><summary>Solution</summary>
</details>
Exercise 2 — Vector class
Extend from Chapter 4: add scalar multiplication (), subtraction, dot product as a method.
Exercise 3 — Animal hierarchy
Build → , , . Each returns a different sound. Then write a function that takes a list of animals and prints each one's sound.
Exercise 4 — Stack with dunders
Implement a class supporting:---- — False if empty- — shows contents
<details><summary>Solution</summary>
</details>
Exercise 5 — @dataclass for a Book library
Use to model a (title, author, year). Then make a class that holds a list of books with methods , , and .
Cheat-sheet
| What | How ||------|-----|| Class | || Constructor | || Inherit | || Call parent | || Repr | || Equality | || Property | decorator || Setter | || Class method | (alternative constructor) || Static method | (utility, no self) || Dataclass | || Frozen | || Mutable default | |
What's next
Post 05 covers files and exceptions: reading and writing text/binary files, the modern , exception handling, custom exceptions, and the context-manager protocol.
References
- docs.python.org tutorial §9- dataclasses module- Fluent Python — Ch. 9–14.
> Note: this post is in progress. Planned additions: ABCs (abstract base classes), deep dive, multiple inheritance + MRO walkthrough.
Violin Notes — 06 · Grade 6 Double Stops, Higher Positions, Chromatic Scales
Grade 6 ABRSM violin is where the instrument doubles itself. Double stops — two strings sounded together — become a syllabus requirement. The right hand learns flying staccato, the left hand uses all positions through 5th regularly, and chromatic scales add 12-note fluency. The repertoire is now full Baroque sonatas, mid-Romantic showpieces, and the first complete concerto movements expected at concert level.
> Series map: 00 Beginner → 01 Grade 1 → … → 05 Grade 5 → 06 Grade 6 (this post) → 07 Grade 7 → 08 Grade 8.
Learning Outcome
- Play 3rds and 6ths double stops through one octave on selected keys.- Play chromatic scale (one or two octaves) starting on G or A.- Use 1st–5th positions fluently in a single piece.- Play three-octave scales in G, A, B♭ major (and some minor).- Use staccato volante ("flying staccato") in showpieces.- Identify ornaments + execute trills, mordents, turns idiomatically.- Perform a complete sonata movement + a Romantic showpiece.
Chapter 1 — Double stops: the violin singing in two voices
A double stop is two strings bowed simultaneously, each producing a different pitch. The bow must contact both strings at once.
Bow angle for double stops
The bow normally tilts to one side to contact one string. For double stops, the bow lies flat on both strings at the same angle. Bow arm height adjusts to suit.
Easy double stops: open string + stopped string
Examples:- Open E + 1st finger B on A = B4 + E5 (a 4th)- Open A + 1st finger F♯ on E = A4 + F♯5 (a 6th)
These are the entry-level double stops; you've been hearing them in pieces since Grade 3 (as the drone effect).
Stopped double stops: 3rds
Two fingers on adjacent strings, both stopped. For a 3rd in 1st position:
To get a 3rd, you need two fingers, one per string, giving notes 3 letters apart. In 1st position on A + E:
The Grade 6 syllabus typically asks for a one-octave scale in 3rds in keys like G major.
6ths
Two-finger spread; the two fingers are usually on different strings, one slightly behind the other.
> Where I got stuck: my fingers couldn't independently stop adjacent strings at different positions. Fix: very slow practice with a tuner on each note separately, then together. 5 minutes per day, 6 weeks, before any scale in 3rds was reliable.
Chapter 2 — Chromatic scale
12 semitones in one octave, played either with traditional fingering or sliding-finger chromatic.
Traditional fingering (G chromatic ascending, one octave on G + D string)
The same finger plays two consecutive semitones by sliding (1 plays G♯ then A; 2 plays A♯ then B). The finger slides up about ½ a finger-width.
Galamian's chromatic fingering
Uses a different finger pattern that avoids slides. Faster but harder to learn.
> Trick: the slide-finger chromatic is more idiomatic and what most pieces expect. Practise it very slowly with metronome. The "click" of the finger sliding between two semitones should be inaudible — the bow disguises it.
Chapter 3 — Flying staccato (staccato volante)
A series of bouncing staccato notes all on one bow direction, the bow lifting between each.
Distinct from slurred staccato (which stays on the string). Flying staccato lifts.
How to learn it
1. Solid up-bow staccato first (easier direction). 4 notes per bow at slow tempo.2. Each note: bow stops and lifts a millimetre, then drops for the next note.3. Build to 8 notes per bow.4. Reverse to down-bow staccato.
Used famously in: Sarasate Zigeunerweisen, Wieniawski concertos, encore showpieces.
> Trick: the wrist + fingers produce the "stop+lift" motion; the arm stays steady. If your arm is jerking, you're forcing it. Relax, slow down.
Chapter 4 — Higher positions: 6th, 7th, half position
Half position
The hand sits below 1st position — 1st finger plays just one semitone above the open string (B♭ on the A string). Used for low chromatic passages.
6th and 7th positions
6th pos on A: 1=G♯5.7th pos on A: 1=A5 (an octave above open A).
In 7th position, the hand sits over the body of the violin. Thumb adjusts to a different position; left hand has limited mobility. Used mostly for very high passages in concertos and showpieces.
> Where I got stuck: my left wrist collapsed in 7th position — the angle felt wrong. Fix: explicitly lift the left elbow forward (more underneath the violin) when shifting above 5th. The hand pivots more from underneath.
Chapter 5 — Ornaments executed idiomatically
Grade 6 demands playing, not just identifying, ornaments.
Trill (tr or ⟵⟶)
Rapid alternation between the written note and the note a step above. In Baroque: starts on the upper note. In Classical/Romantic: starts on the written note.
The 2nd finger trills (lift-drop) while bow sustains. Trill speed: 6–10 oscillations per second. Practise slowly first, build speed.
Mordent (𝆚)
Quick three-note ornament: written note → step below (or above) → written note.
Turn (∾)
Four-note ornament: above-note → written → below-note → written.
Appoggiatura (small note before main note)
Takes half the value of the following note in Classical music.
Acciaccatura (small note with slash through stem)
A "crush" note — played as fast as possible, then immediately to the main note.
Chapter 6 — Suggested Practice Pieces
Suzuki Vol. 6 staples
| Piece | Composer | Why ||-------|----------|-----|| La Folia | Corelli (arr. Suzuki) | Theme + variations; double stop practice || Sonata in F | Handel | Full Baroque sonata || Allegro | Fiocco | Bright Baroque showpiece || Gavotte | Rameau | Dance with ornaments |
ABRSM Grade 6 alternatives
| Piece | Composer | Why ||-------|----------|-----|| Concerto in A minor, complete | Accolay | Standard student concerto || Romance in F | Beethoven | Romantic lyrical line || Méditation from Thaïs | Massenet | Full version of the dream piece || Hungarian Dance | Brahms (arr.) | Rubato + showpiece || Czardas (excerpt) | Monti | Aspirational virtuoso piece |
Étude staples (Grade 6)
- Kreutzer 42 Études — Nos. 2, 8, 9 standard.- Mazas Op. 36 Book 2 — continued.- Dont Op. 37 — etude introduction.
Chapter 7 — Aural / Listening Skills
Grade 6 aural expands:
- Sing/play back 4-bar phrases with modulations.- Identify modulations to dominant, subdominant, relative minor.- Identify chord progressions including II-V-I, secondary dominants.- Identify formal sections (binary, ternary, rondo).- Sight-sing 8-bar phrase with chromatic notes.
Modulation identification
Listen for the new key's tonic as the resolution point. The dominant of the new key (V/V if modulating to dominant) often precedes it.
> Trick: practise modulation identification using piano hymnals or simple chorales. Sing the new tonic when it arrives. Build the habit of locating "the new home".
Chapter 8 — Common Grade 6 Pitfalls
| Pitfall | Fix ||---------|-----|| Double stop sounds scratchy | Bow weight balanced between strings; even contact || Double stop intonation wrong | Tune each note separately first; combine slowly || Chromatic scale uneven rhythm | Metronome with subdivisions; slow practice || Flying staccato becomes legato | Visible lift between notes — film yourself || Trill speed inconsistent | Slow trill drill: 60 bpm @ 4 notes per beat → 8 → 12 || 7th position cramped | Lift left elbow more; pivot wrist position || Ornaments start wrong (Baroque vs Classical) | Mark the start note above the trill in pencil || Sonata movement memory failure mid-performance | Memorise in chunks (4 bars per session) |
Useful Shortcut
Cheat-sheet
| What | How ||------|-----|| Double stop bow | Flat on both strings, balanced weight || 3rds | Two fingers, one per string, 3 letters apart || 6ths | Two fingers, different strings, slight stagger || Chromatic finger slide | Same finger plays two semitones (½ finger-width) || Flying staccato | Bow lifts between each note, same direction || Half position | 1st finger lower than 1st position || 7th position | Above 5th; elbow lifts forward || Trill (Baroque) | Start on upper note || Trill (Classical) | Start on written note || Appoggiatura | Half the value of the main note |
Daily routine (90 min)
| Block | Time | Content ||-------|------|---------|| Tune | 2 min | Tuner + 5ths || Bow warm-up | 8 min | Long bows + spiccato + flying staccato drill || Vibrato + tone | 5 min | Slow vibrato on each string in turn || Scales (single notes) | 10 min | 1 three-octave + 1 two-octave || Scales (double stops) | 10 min | 3rds + 6ths in selected key || Chromatic scale | 5 min | Slow → fast metronome || Shifting drill | 5 min | 1↔3↔5↔7 silent shifts || Étude | 15 min | Kreutzer or Mazas || Sight-read | 5 min | New 16–24 bar piece || Repertoire | 20 min | Full sonata or concerto movement || Cool-down | 5 min | Slow open string + favourite phrase |
Suggested listening (context)
| Piece | Performer | Why ||-------|-----------|-----|| Bach Sonatas & Partitas | Hilary Hahn | The Mount Everest of solo violin || Beethoven Violin Concerto | Anne-Sophie Mutter | Standard concerto repertoire || Sarasate — Zigeunerweisen | Sarah Chang | Flying staccato + Romantic fire || Wieniawski — Légende | Anne Akiko Meyers | Lyrical Romantic showpiece || Tchaikovsky Violin Concerto | Hahn | Adult repertoire; aspirational || Saint-Saëns — Introduction & Rondo Capriccioso | Sarah Chang | Spanish flavour; flying staccato finale |
References
- ABRSM (current). Violin Exam Pieces — Grade 6.- Suzuki, S. Suzuki Violin School, Vol. 6.- Carl Flesch, Scale System (double-stop section).- Kreutzer, 42 Études.- Mazas, Op. 36 Book 2.- Dont, Op. 37.- Simon Fischer, Practice: 250 Step-by-Step Practice Methods.- Galamian, Contemporary Violin Technique (double-stop chapter).
> Note: this post is in progress. Planned additions: double-stop diagrams; flying staccato audio reference; ornament execution examples per period.










