TouchGrass-7b / data /music_qa_generator.py
Zandy-Wandy's picture
Upload 39 files
4f0238f verified
"""
Synthetic Music QA Dataset Generator for TouchGrass.
Generates training data covering all music domains and skill levels.
"""
import json
import random
from typing import List, Dict, Tuple, Optional
from pathlib import Path
class MusicQAGenerator:
"""
Generates synthetic music QA pairs for fine-tuning.
Covers:
- Guitar & Bass
- Piano & Keys
- Drums & Percussion
- Vocals & Singing
- Music Theory & Composition
- DJ & Production
- Frustration/Emotion responses (EQ training)
"""
def __init__(self, seed: int = 42):
"""Initialize generator with random seed."""
random.seed(seed)
self.seed = seed
# Load question templates
self.qa_categories = self._define_qa_categories()
# System prompt
self.system_prompt = """You are Touch Grass 🌿, a warm, encouraging, and knowledgeable music assistant.
You help people with:
- Learning instruments (guitar, bass, piano, keys, drums, vocals)
- Understanding music theory at any level
- Writing songs (lyrics, chord progressions, structure)
- Ear training and developing musicality
- DJ skills and music production
- Genre knowledge and music history
Your personality:
- Patient and encouraging — learning music is hard and takes time
- Adapt to the learner's level automatically — simpler for beginners, deeper for advanced
- When someone is frustrated, acknowledge it warmly before helping
- Use tabs, chord diagrams, and notation when helpful
- Make learning fun, not intimidating
- Celebrate small wins
When generating tabs use this format:
[TAB]
e|---------|
B|---------|
G|---------|
D|---------|
A|---------|
E|---------|
[/TAB]
When showing chord progressions use: [PROGRESSION]I - IV - V - I[/PROGRESSION]"""
def _define_qa_categories(self) -> Dict[str, List[Dict]]:
"""Define all QA categories with templates."""
categories = {
"guitar_basics": [
{
"question": "How do I play a G chord?",
"context": "[GUITAR][BEGINNER]",
"answer": self._gen_g_chord_answer,
},
{
"question": "What is a barre chord?",
"context": "[GUITAR][INTERMEDIATE]",
"answer": self._gen_barre_chord_answer,
},
{
"question": "How do I read guitar tabs?",
"context": "[GUITAR][BEGINNER]",
"answer": self._gen_tabs_reading_answer,
},
{
"question": "What does the capo do?",
"context": "[GUITAR][BEGINNER]",
"answer": self._gen_capo_answer,
},
{
"question": "How do I tune my guitar?",
"context": "[GUITAR][BEGINNER]",
"answer": self._gen_tuning_answer,
},
{
"question": "What are some easy songs for beginners?",
"context": "[GUITAR][BEGINNER]",
"answer": self._gen_easy_songs_answer,
},
{
"question": "How do I do a hammer-on?",
"context": "[GUITAR][INTERMEDIATE]",
"answer": self._gen_hammeron_answer,
},
{
"question": "What's the difference between acoustic and electric guitar?",
"context": "[GUITAR][BEGINNER]",
"answer": self._gen_acoustic_vs_electric_answer,
},
],
"piano_basics": [
{
"question": "How do I find middle C?",
"context": "[PIANO][BEGINNER]",
"answer": self._gen_middle_c_answer,
},
{
"question": "What is proper hand position?",
"context": "[PIANO][BEGINNER]",
"answer": self._gen_hand_position_answer,
},
{
"question": "How do I read sheet music?",
"context": "[PIANO][BEGINNER]",
"answer": self._gen_sheet_music_answer,
},
{
"question": "What are the black keys?",
"context": "[PIANO][BEGINNER]",
"answer": self._gen_black_keys_answer,
},
{
"question": "How do I play scales?",
"context": "[PIANO][INTERMEDIATE]",
"answer": self._gen_scales_answer,
},
{
"question": "What is finger numbering?",
"context": "[PIANO][BEGINNER]",
"answer": self._gen_finger_numbering_answer,
},
{
"question": "How do I use the sustain pedal?",
"context": "[PIANO][INTERMEDIATE]",
"answer": self._gen_pedal_answer,
},
],
"drums_basics": [
{
"question": "How do I set up a drum kit?",
"context": "[DRUMS][BEGINNER]",
"answer": self._gen_drum_setup_answer,
},
{
"question": "What is a basic rock beat?",
"context": "[DRUMS][BEGINNER]",
"answer": self._gen_rock_beat_answer,
},
{
"question": "How do I hold drumsticks?",
"context": "[DRUMS][BEGINNER]",
"answer": self._gen_stick_grip_answer,
},
{
"question": "What are the different drum types?",
"context": "[DRUMS][BEGINNER]",
"answer": self._gen_drum_types_answer,
},
{
"question": "How do I improve my timing?",
"context": "[DRUMS][INTERMEDIATE]",
"answer": self._gen_timing_answer,
},
],
"vocals_basics": [
{
"question": "How do I warm up my voice?",
"context": "[VOCALS][BEGINNER]",
"answer": self._gen_voice_warmup_answer,
},
{
"question": "What is proper breathing for singing?",
"context": "[VOCALS][BEGINNER]",
"answer": self._gen_breathing_answer,
},
{
"question": "How do I find my vocal range?",
"context": "[VOCALS][BEGINNER]",
"answer": self._gen_vocal_range_answer,
},
{
"question": "How do I sing on pitch?",
"context": "[VOCALS][BEGINNER]",
"answer": self._gen_pitch_answer,
},
{
"question": "What are vocal registers?",
"context": "[VOCALS][INTERMEDIATE]",
"answer": self._gen_vocal_registers_answer,
},
],
"music_theory": [
{
"question": "What is the circle of fifths?",
"context": "[THEORY][INTERMEDIATE]",
"answer": self._gen_circle_of_fifths_answer,
},
{
"question": "What makes a chord minor vs major?",
"context": "[THEORY][BEGINNER]",
"answer": self._gen_major_minor_answer,
},
{
"question": "What is a key signature?",
"context": "[THEORY][BEGINNER]",
"answer": self._gen_key_signature_answer,
},
{
"question": "What is the difference between rhythm and beat?",
"context": "[THEORY][BEGINNER]",
"answer": self._gen_rhythm_vs_beat_answer,
},
{
"question": "What are time signatures?",
"context": "[THEORY][INTERMEDIATE]",
"answer": self._gen_time_signature_answer,
},
{
"question": "What is a scale?",
"context": "[THEORY][BEGINNER]",
"answer": self._gen_scale_answer,
},
{
"question": "What are intervals?",
"context": "[THEORY][INTERMEDIATE]",
"answer": self._gen_intervals_answer,
},
{
"question": "What is a chord progression?",
"context": "[THEORY][BEGINNER]",
"answer": self._gen_chord_progression_answer,
},
{
"question": "What is syncopation?",
"context": "[THEORY][ADVANCED]",
"answer": self._gen_syncopation_answer,
},
],
"ear_training": [
{
"question": "How do I improve my ear?",
"context": "[THEORY][BEGINNER]",
"answer": self._gen_ear_improvement_answer,
},
{
"question": "What does a perfect fifth sound like?",
"context": "[THEORY][INTERMEDIATE]",
"answer": self._gen_perfect_fifth_answer,
},
{
"question": "How do I recognize chord quality by ear?",
"context": "[THEORY][INTERMEDIATE]",
"answer": self._gen_chord_quality_ear_answer,
},
{
"question": "What is relative pitch?",
"context": "[THEORY][BEGINNER]",
"answer": self._gen_relative_pitch_answer,
},
],
"songwriting": [
{
"question": "What chord progressions work for pop music?",
"context": "[THEORY][INTERMEDIATE]",
"answer": self._gen_pop_progressions_answer,
},
{
"question": "How do I write a chorus?",
"context": "[THEORY][INTERMEDIATE]",
"answer": self._gen_chorus_writing_answer,
},
{
"question": "What is a hook in music?",
"context": "[THEORY][BEGINNER]",
"answer": self._gen_hook_answer,
},
{
"question": "How do I write lyrics?",
"context": "[THEORY][INTERMEDIATE]",
"answer": self._gen_lyric_writing_answer,
},
{
"question": "What is song structure?",
"context": "[THEORY][BEGINNER]",
"answer": self._gen_song_structure_answer,
},
],
"production_dj": [
{
"question": "What BPM is house music typically?",
"context": "[DJ][BEGINNER]",
"answer": self._gen_house_bpm_answer,
},
{
"question": "What is sidechain compression?",
"context": "[DJ][INTERMEDIATE]",
"answer": self._gen_sidechain_answer,
},
{
"question": "How do I beatmatch?",
"context": "[DJ][BEGINNER]",
"answer": self._gen_beatmatch_answer,
},
{
"question": "What is a DAW?",
"context": "[DJ][BEGINNER]",
"answer": self._gen_daw_answer,
},
{
"question": "What is EQ?",
"context": "[DJ][BEGINNER]",
"answer": self._gen_eq_answer,
},
{
"question": "How do I mix tracks?",
"context": "[DJ][INTERMEDIATE]",
"answer": self._gen_mixing_answer,
},
],
"frustration_responses": [
{
"question": "I've been trying this chord for an hour and can't get it",
"context": "[GUITAR][BEGINNER][FRUSTRATED]",
"answer": self._gen_frustrated_chord_answer,
},
{
"question": "My fingers hurt so much from practicing",
"context": "[GUITAR][BEGINNER][FRUSTRATED]",
"answer": self._gen_finger_pain_answer,
},
{
"question": "I'll never be able to play this",
"context": "[GUITAR][BEGINNER][FRUSTRATED]",
"answer": self._gen_never_able_answer,
},
{
"question": "This is too hard, I want to quit",
"context": "[GUITAR][BEGINNER][FRUSTRATED]",
"answer": self._gen_quit_answer,
},
{
"question": "I'm so confused by music theory",
"context": "[THEORY][BEGINNER][FRUSTRATED]",
"answer": self._gen_confused_theory_answer,
},
{
"question": "I keep losing the beat",
"context": "[DRUMS][BEGINNER][FRUSTRATED]",
"answer": self._gen_losing_beat_answer,
},
],
}
return categories
# Answer generation methods
def _gen_g_chord_answer(self) -> str:
"""Generate G major chord answer."""
return """Here's the G major chord in open position:
[TAB]
e|--3--|
B|--3--|
G|--0--|
D|--0--|
A|--2--|
E|--3--|
[/TAB]
Place your fingers:
- Ring finger on 3rd fret of low E string
- Middle finger on 2nd fret of A string
- Pinky on 3rd fret of high e string
- Index finger on 3rd fret of B string
**Tip for beginners**: If this feels difficult, try the easy G chord:
[TAB]
e|--3--|
B|--3--|
G|--0--|
D|--0--|
A|--x--|
E|--3--|
[/TAB]
Just use fingers on the top 3 strings!"""
def _gen_barre_chord_answer(self) -> str:
"""Generate barre chord explanation."""
return """A barre chord uses your index finger to press down multiple strings across the fretboard, essentially creating a movable chord shape.
**How to play a barre chord:**
1. Place your index finger flat across all strings at a fret
2. Use other fingers to form the chord shape
3. Apply even pressure with your thumb behind the neck
**Common barre chords:**
- F major: 1st fret, all strings barred, ring on 3rd fret A, pinky on 3rd fret D
- B minor: 2nd fret barre, middle on 4th fret D, ring on 4th fret G
**Tips:**
- Start with partial barres (only barre 2-3 strings)
- Build finger strength gradually
- It's normal to buzz at first — keep practicing!"""
def _gen_tabs_reading_answer(self) -> str:
"""Generate tab reading explanation."""
return """Guitar tabs (tablature) show you exactly where to place your fingers on the fretboard.
**How to read tabs:**
- Each line represents a string (from high e at top to low E at bottom)
- Numbers are fret numbers (0 = open string, x = muted)
- Read left to right, play notes in sequence
**Example:**
[TAB]
e|--0--3--5--|
B|--1--3--5--|
G|--0--2--5--|
D|--2--0--5--|
A|--3--------|
E|-----------|
[/TAB]
This shows a chord (all notes played together) or arpeggio depending on timing.
**Key points:**
- Vertical alignment = play together
- Spacing indicates timing
- 'h' = hammer-on, 'p' = pull-off, '/' = slide up, '\\' = slide down"""
def _gen_capo_answer(self) -> str:
"""Generate capo explanation."""
return """A capo (short for "capotasto", Italian for "head of fretboard") is a clamp that raises the pitch of all open strings.
**What it does:**
- Capo on 1st fret = all chords go up 1 semitone
- Capo on 2nd fret = all chords go up 2 semitones
- etc.
**Why use a capo:**
1. Play in different keys with familiar chord shapes
2. Get brighter, more ringing sound from open strings
3. Match vocal range without learning new fingerings
**Example:**
- Capo on 3rd fret + G chord shape = sounds as Bb
- Capo on 5th fret + C shape = sounds as F
**Common capo positions:**
- 2nd fret: D becomes E
- 3rd fret: C becomes Eb
- 5th fret: G becomes Bb
- 7th fret: G becomes D"""
def _gen_tuning_answer(self) -> str:
"""Generate tuning explanation."""
return """Standard guitar tuning (low to high): E A D G B E
**How to tune:**
1. Use an electronic tuner or tuning app
2. Pluck each string, adjust peg until needle/green light
3. Start with low E, work up to high e
**Alternative tunings:**
- Drop D: D A D G B E (lower low E to D) — great for rock/metal
- Open G: D G D G B D — slide guitar friendly
- DADGAD: D A D G A D — folk/alternative
**Tips:**
- Tune up (tighten) rather than down when possible
- Tune in a quiet environment
- Check tuning frequently — strings go out of tune easily"""
def _gen_easy_songs_answer(self) -> str:
"""Generate easy songs list."""
return """Great beginner songs that use simple chords:
**3-chord songs:**
- "Knockin' on Heaven's Door" — G, D, Am, C
- "Horse with No Name" — Em, D6/9 (just 2 chords!)
- "Bad Moon Rising" — D, A, G
- "Wild Thing" — A, D, E
**4-chord songs:**
- "Let It Be" — C, G, Am, F
- "Stand By Me" — A, F#m, D, E
- "Someone Like You" — A, E, F#m, D
**Tips:**
- Start with songs that have slow tempo
- Focus on smooth chord transitions
- Use a capo to make songs easier if needed"""
def _gen_hammeron_answer(self) -> str:
"""Generate hammer-on explanation."""
return """A hammer-on is a technique where you "hammer" your finger onto the fretboard to sound a note without picking the string.
**How to do it:**
1. Pick a note (e.g., 5th fret)
2. Quickly place another finger on a higher fret (e.g., 7th fret) with enough force
3. The second note sounds without picking
**Notation in tabs:**
[TAB]
e|--5h7--|
[/TAB]
The 'h' means hammer-on from 5th to 7th fret.
**Uses:**
- Smooth, connected phrases (legato)
- Speed up playing
- Add expressiveness
**Practice exercise:**
Try: 5th fret → 7th fret → 8th fret on one string, all hammer-ons."""
def _gen_acoustic_vs_electric_answer(self) -> str:
"""Generate acoustic vs electric explanation."""
return """**Acoustic Guitar:**
- Sound: Natural, resonant, no amp needed
- Strings: Usually steel (or nylon for classical)
- Body: Hollow, soundhole
- Best for: Folk, singer-songwriter, practice anywhere
**Electric Guitar:**
- Sound: Requires amp, many tonal possibilities
- Strings: Usually steel, lighter gauge
- Body: Solid or semi-hollow
- Best for: Rock, metal, jazz, blues, effects exploration
**For beginners:**
- Acoustic: Builds finger strength faster, portable
- Electric: Easier to play (lighter strings), quieter with headphones
**Recommendation:** Start with whichever excites you more — passion matters most!"""
def _gen_middle_c_answer(self) -> str:
"""Generate middle C explanation."""
return """Middle C is the C note near the center of the piano keyboard, and it's a crucial reference point.
**How to find it:**
- On full-size pianos (88 keys): It's the 4th C from the left
- Look for the brand name — usually centered around middle C
- It's in the middle of the treble and bass clefs
**Why it's important:**
- Reference for reading sheet music
- Starting point for scales and exercises
- Helps you navigate the keyboard
**Visual:**
... (left side) | C3 | C4 (Middle C) | C5 | ... (right side)
**Practice:** Place your right thumb on middle C, then play C-D-E-F-G with fingers 1-2-3-4-5."""
def _gen_hand_position_answer(self) -> str:
"""Generate hand position explanation."""
return """Proper hand position prevents injury and improves technique.
**For right hand (if right-handed):**
- Wrist: Straight, not bent
- Palm: Slightly curved, not flat
- Fingers: Curved like holding a ball
- Thumb: Relaxed, not stiff
**For left hand (fretting):**
- Thumb: Behind neck, roughly middle of back
- Fingers: Curved, use fingertips (not pads)
- Wrist: Slightly angled down, not bent inward
- Elbow: Close to body
**Common mistakes to avoid:**
❌ Flat fingers (causes buzzing)
❌ Thumb over the neck (weak grip)
❌ Wrist bent sharply (can cause strain)
❌ Arm too tense (relax!)
**Exercise:** Play slow scales, focusing on hand shape. Use a mirror to check!"""
def _gen_sheet_music_answer(self) -> str:
"""Generate sheet music reading explanation."""
return """Sheet music uses the staff (5 lines) to show pitch and rhythm.
**The basics:**
- **Treble clef** (𝄞): Higher notes (right hand on piano, violin, etc)
- **Bass clef** (𝄢): Lower notes (left hand on piano, cello, etc)
- **Notes**: Position on staff determines pitch
- **Rests**: Silence for specific durations
**Note values:**
- Whole note: 4 beats
- Half note: 2 beats
- Quarter note: 1 beat
- Eighth note: ½ beat (often beamed together)
**Key signature:** Sharps/flats at beginning tell you what key
**Time signature:** Top = beats per measure, bottom = note value (4 = quarter)
**Start learning:**
1. Learn the notes on treble clef (FACE, Every Good Boy Does Fine)
2. Practice with simple sheet music
3. Count rhythms out loud
4. Use a metronome!"""
def _gen_black_keys_answer(self) -> str:
"""Generate black keys explanation."""
return """The black keys on piano are sharps (#) and flats (♭) — they're the "in-between" notes.
**Pattern:**
- Groups of 2 black keys, then 3 black keys, repeating
- This pattern helps you navigate
**What they are:**
- Each black key has two names (enharmonic):
- C# = Db
- D# = Eb
- F# = Gb
- G# = Ab
- A# = Bb
**How many:**
- 12 total chromatic notes in an octave
- 7 white keys (C D E F G A B)
- 5 black keys (C#, D#, F#, G#, A#)
**Fun fact:** The pattern of 2s and 3s repeats every octave!
**Practice:** Find all the C# notes (they're the first black key in each 2-key group)."""
def _gen_scales_answer(self) -> str:
"""Generate scales explanation."""
return """A scale is a series of notes in ascending or descending order.
**Major scale (happy sound):**
Pattern: Whole-Whole-Half-Whole-Whole-Whole-Half
Example C major: C D E F G A B C
**Natural minor scale (sad sound):**
Pattern: Whole-Half-Whole-Whole-Half-Whole-Whole
Example A minor: A B C D E F G A
**How to practice:**
1. Start with C major (no sharps/flats)
2. Use proper fingering (piano: 1-2-3-1-2-3-4-5 for right hand)
3. Play hands separately, then together
4. Use a metronome, start slow
**Common scales to learn:**
- C major (foundation)
- G major (1 sharp)
- F major (1 flat)
- A minor (relative of C major)
**Why scales matter:** They build technique, finger strength, and understanding of keys."""
def _gen_finger_numbering_answer(self) -> str:
"""Generate finger numbering explanation."""
return """Piano finger numbering (standard):
**Right hand:**
1 = thumb
2 = index
3 = middle
4 = ring
5 = pinky
**Left hand:**
Same numbering, but remember thumb is still #1!
**In sheet music:**
Numbers above notes tell you which finger to use.
**Example:**
[TAB]
Right hand C-D-E-F-G: 1-2-3-1-2
[/TAB]
**Why it matters:**
- Proper fingering makes passages smoother
- Prevents awkward hand positions
- Builds good habits
**General rules:**
- Thumb (1) often plays on white keys
- Avoid using same finger for consecutive notes
- Follow the natural curve of your hand"""
def _gen_pedal_answer(self) -> str:
"""Generate pedal explanation."""
return """The sustain pedal (right pedal) makes notes ring out longer by lifting all dampers.
**How to use:**
1. Press pedal down BEFORE playing notes (preparation)
2. Keep pedal down while notes sustain
3. Release pedal when you want to stop the sound
4. Re-press for new harmony
**Pedaling notation:**
- Ped. = press pedal
- * = release pedal
- / or \\ = lift and re-press quickly
**Tips:**
- Change pedal when harmony changes (chords)
- Don't "stomp" — smooth pressing
- Listen! If sound gets muddy, release pedal
**Common mistakes:**
- Holding pedal too long (muddiness)
- Not using pedal at all (dry sound)
- Changing on every note (ineffective)
**Practice:** Play a simple chord progression, pedaling on each chord change."""
def _gen_drum_setup_answer(self) -> str:
"""Generate drum setup explanation."""
return """Basic drum kit setup (5-piece):
**Standard arrangement (from player's perspective):**
**Hi-hat** (left or right foot) — two cymbals that clamp together
**Snare drum** (center, between legs) — the "crack" sound
**Tom 1** (floor tom, right of snare) — low pitch
**Tom 2** (rack tom, above snare) — higher pitch
**Crash cymbal** (left or right) — accent sound
**Ride cymbal** (right) — steady pattern
**Kick drum** (left foot) — the "boom"
**Height adjustments:**
- Snare: at waist level, comfortable reach
- Toms: angled slightly toward you
- Cymbals: just above head height
- Kick: so your knee is slightly bent
**Remember:** Setup is personal — adjust for comfort and reach!"""
def _gen_rock_beat_answer(self) -> str:
"""Generate rock beat explanation."""
return """The basic rock beat is 4/4 time with kick on 1 & 3, snare on 2 & 4, hi-hat on all eighth notes.
**Pattern:**
```
1 e & a 2 e & a 3 e & a 4 e & a
K S K S
H H H H H H H H
```
**How to play:**
- **Right hand (or left if left-handed):** Hi-hat on every eighth note
- **Left hand:** Snare on beats 2 and 4
- **Right foot:** Kick drum on beats 1 and 3
**Simplified version (quarter notes):**
- Hi-hat: 1 2 3 4
- Snare: 2 4
- Kick: 1 3
**Build up:**
1. Master the simplified version
2. Add eighth notes on hi-hat
3. Add variations (kick on "and" of 3, etc)
4. Add crash cymbal on downbeat of new sections
**Practice with metronome!** Start at 60 BPM, gradually increase."""
def _gen_stick_grip_answer(self) -> str:
"""Generate stick grip explanation."""
return """Proper stick grip is essential for control and speed.
**Traditional grip (marching/jazz):**
- Right hand: pencil grip between thumb and index
- Left hand: palm up, stick rests in web between thumb/index
- Fulcrum: where thumb and index meet
**Matched grip (rock/pop/concert):**
- Both hands same grip
- Stick balanced on middle finger knuckle
- Thumb on top, index wrapped around
- Fulcrum: between thumb and index
**Key points:**
- Don't grip too tight — hold like a bird (firm enough not to drop, loose enough not to hurt)
- Fulcrum should be loose, allowing rebound
- Wrist and fingers do the work, not arm
**Common mistakes:**
❌ Death grip (tension, fatigue)
❌ Sticks too far in palm (no rebound)
❌ Wrist stiff (use wrist/fingers)
**Practice:** Drop and catch drills, fulcrum control exercises."""
def _gen_drum_types_answer(self) -> str:
"""Generate drum types explanation."""
return """**Main drum types in a standard kit:**
**Kick drum (bass drum):**
- Largest drum, on floor
- Played with pedal
- Provides the "boom" and pulse
**Snare drum:**
- Medium size, metal wires (snares) on bottom
- Sharp "crack" sound
- Backbeat (beats 2 & 4 in rock)
**Toms:**
- Rack toms: mounted above snare, various pitches
- Floor tom: stands on floor, lowest pitch
- Used for fills and transitions
**Cymbals:**
- **Hi-hat:** Two cymbals that clamp together, played with foot or sticks
- **Ride:** Large cymbal for steady patterns (ding)
- **Crash:** Medium, explosive accents (crash!)
- **China:** Upside-down, trashy sound
**Other percussion:**
- Cowbell, tambourine, woodblock, etc.
**Sizes:** Measured in inches — larger = deeper sound, smaller = higher pitch."""
def _gen_timing_answer(self) -> str:
"""Generate timing improvement explanation."""
return """Good timing is essential for drummers. Here's how to improve:
**Use a metronome — always!**
- Start slow (60 BPM)
- Play along, focus on hitting EXACTLY on the beat
- Gradually increase tempo
**Practice methods:**
1. **Quarter note pulse:** Just play quarter notes, listen to metronome
2. **Eighth notes:** Add subdivisions
3. **Off-beat exercises:** Play on "and" of beats
4. **Accent patterns:** Emphasize different beats
**Listen critically:**
- Record yourself playing
- Compare to metronome
- Identify where you rush or drag
**Physical techniques:**
- Relax! Tension causes timing issues
- Use wrist/fingers, not arm
- Let sticks rebound naturally
**Play along with music:**
- Choose songs with steady tempo
- Start with simple songs
- Match the drummer's timing exactly
**Daily practice:** 10 minutes of pure timing exercises makes huge difference!"""
def _gen_voice_warmup_answer(self) -> str:
"""Generate voice warmup explanation."""
return """Warming up your voice prevents strain and improves performance.
**5-10 minute warmup routine:**
**1. Breathing (2 min):**
- Diaphragmatic breathing: hand on stomach, inhale to expand, exhale slowly
- 4 counts in, 4 counts hold, 8 counts out
**2. Lip trills (2 min):**
- Relax lips, blow air to make them vibrate
- Glide up and down scales
- Relaxes vocal cords
**3. Humming (2 min):**
- Hum scales (do-re-mi...)
- Feel vibrations in face/chest
- Gentle on voice
**4. Sirens (1 min):**
- Glide from low to high and back (like a siren)
- "Woo" or "wee" sounds
- Stretches vocal range
**5. Arpeggios (2 min):**
- 1-3-5-8-5-3-1 on "ah" or "oh"
- Smooth transitions
**6. Song practice (1-2 min):**
- Sing a familiar song gently
**Remember:**
- Start easy, gradually increase range
- Never push to pain
- Stay hydrated!"""
def _gen_breathing_answer(self) -> str:
"""Generate breathing explanation."""
return """Proper breathing is the foundation of good singing.
**Diaphragmatic breathing (belly breathing):**
**How to do it:**
1. Lie down or stand straight
2. Place hand on stomach (just below ribs)
3. Inhale slowly through nose — feel stomach expand OUT
4. Exhale slowly — feel stomach IN
5. Shoulders and chest should stay relatively still
**Why it matters:**
- Provides steady airflow
- Supports tone
- Prevents vocal strain
- Increases breath control
**Exercises:**
1. **4-4-8:** Inhale 4 counts, hold 4, exhale 8
2. **Hissing:** Exhale on "ssss" for as long as possible (aim for 20+ seconds)
3. **Book balance:** Place book on stomach, make it rise/fall
**During singing:**
- Take deep, quick breaths (not shallow)
- Support with core muscles (slight abdominal tension)
- Don't gasp or take too long to breathe
**Practice daily!** Breathing becomes habit with repetition."""
def _gen_vocal_range_answer(self) -> str:
"""Generate vocal range explanation."""
return """Your vocal range is the span of notes you can sing comfortably.
**Voice types (from high to low):**
- Soprano (female highest)
- Mezzo-soprano
- Alto (female lowest)
- Tenor (male highest)
- Baritone
- Bass (male lowest)
**How to find your range:**
1. Start with comfortable middle note
2. Glide up (sirens) until voice cracks — that's approximate top
3. Glide down until can't sing comfortably — that's approximate bottom
4. Your *range* is from bottom to top
5. Your *tessitura* (comfortable range) is smaller
**Most adults:**
- 1.5 to 2 octaves comfortable
- 2+ octaves total range
**Don't force it!** Pushing too high/too low causes strain.
**Find your voice type:**
- Compare to known singers
- Consider gender and comfort zone
- A teacher can help identify
**Remember:** Range expands with proper technique and practice!"""
def _gen_pitch_answer(self) -> str:
"""Generate pitch singing explanation."""
return """Singing on pitch means matching the exact frequency of a note.
**How to improve pitch accuracy:**
**1. Ear training:**
- Play a note, try to match it
- Use a piano, tuner, or app
- Start with single notes, then scales
**2. Use visual feedback:**
- Tuner apps show if you're sharp (high) or flat (low)
- Sing into tuner, adjust until needle centers
**3. Record yourself:**
- Play reference tone
- Sing along
- Listen back — were you on pitch?
**4. Scales and arpeggios:**
- Practice with piano
- Match each note exactly
- Slow, deliberate practice
**5. Interval training:**
- Learn to recognize distances between notes
- Helps you anticipate pitch changes
**Common issues:**
- Listening too late → start note early
- Tension → relax jaw/throat
- Not listening enough → trust your ear!
**Daily practice:** 10 minutes of pitch matching shows improvement in weeks!"""
def _gen_vocal_registers_answer(self) -> str:
"""Generate vocal registers explanation."""
return """Vocal registers are different "modes" of your voice, each with distinct sound and sensation.
**Main registers:**
**Chest voice (lower register):**
- Feels vibrations in chest
- Rich, full, powerful
- Used for lower notes
- More "speech-like"
**Head voice (upper register):**
- Feels vibrations in head/face
- Light, airy, floating
- Used for higher notes
- Less "chest" feeling
**Mixed voice (blend):**
- Combination of chest and head
- Smooth transition between registers
- Most useful for contemporary singing
**The "break" (passaggio):**
- Where voice naturally switches registers
- Usually around E4-G4 for women, E3-G3 for men
- Can be smoothed with training
**Exercises:**
- Sirens: glide through break smoothly
- Arpeggios: 1-5-8-5-1, feeling the shift
- Lip trills through entire range
**Goal:** Seamless voice with no audible "flip" or strain."""
def _gen_circle_of_fifths_answer(self) -> str:
"""Generate circle of fifths explanation."""
return """The circle of fifths organizes keys by their relationship.
**How it works:**
- Clockwise: each step adds a sharp (or removes a flat)
- Counter-clockwise: each step adds a flat (or removes a sharp)
- Keys opposite each other are relative major/minor
**The circle (starting at C):**
C → G → D → A → E → B → F#/Gb → C#/Db → G#/Eb → D#/Bb → A#/F → F → back to C
**Uses:**
1. **Find key signature:** Count steps from C
- G = 1 sharp (F#)
- D = 2 sharps (F#, C#)
- F = 1 flat (Bb)
2. **Relative minor:** Go 6 steps clockwise (or down a minor 3rd)
- C major → A minor
- G major → E minor
3. **Chord progressions:** Adjacent keys work well together
**Mnemonic:** "Father Charles Goes Down And Ends Battle" (sharps)
**Mnemonic:** "Battle Ends And Down Goes Charles' Father" (flats)
**Memorize it!** It's one of music theory's most useful tools."""
def _gen_major_minor_answer(self) -> str:
"""Generate major/minor chord explanation."""
return """The difference between major and minor chords is the 3rd scale degree.
**Major chord (happy sound):**
- Root + Major 3rd + Perfect 5th
- Example C major: C + E + G
- Interval: 4 semitones (root to 3rd)
**Minor chord (sad sound):**
- Root + Minor 3rd + Perfect 5th
- Example C minor: C + Eb + G
- Interval: 3 semitones (root to 3rd)
**On piano:**
- Major: Play root, skip 2 white keys, play next (C-E-G)
- Minor: Play root, skip 1 white key, play next (C-Eb-G)
**In chord symbols:**
- C = C major
- Cm or C- = C minor
- Cmin = C minor
**Why it sounds different:**
The 3rd determines the chord's quality. Major 3rd = bright, minor 3rd = dark.
**Practice:** Play C major and C minor back-to-back, listen to the difference!"""
def _gen_key_signature_answer(self) -> str:
"""Generate key signature explanation."""
return """The key signature tells you which notes are sharp or flat throughout a piece.
**Where to find it:**
- At the beginning of each staff (after clef)
- Before the time signature
- Applies to ALL octaves
**Reading it:**
- Sharps: ♯ on lines (F#, C#, G#, D#, A#, E#, B#)
- Flats: ♭ on lines (Bb, Eb, Ab, Db, Gb, Cb, Fb)
- Order of sharps: FCGDAEB
- Order of flats: BEADGCF
**Example:**
- 1 sharp (F#) = key of G major or E minor
- 2 flats (Bb, Eb) = key of Bb major or G minor
**Why it matters:**
- Tells you what key the music is in
- Which notes to play sharp/flat automatically
- Helps with sight-reading
**Relative minor:** Same key signature as its relative major (6th degree)
**Practice:** Look at sheet music, identify the key from the signature!"""
def _gen_rhythm_vs_beat_answer(self) -> str:
"""Generate rhythm vs beat explanation."""
return """**Beat:** The steady pulse of music — what you tap your foot to.
- Measured in BPM (beats per minute)
- Regular, consistent
- The "heartbeat" of the song
**Rhythm:** How notes are arranged in time — the pattern of long and short sounds.
- Can be regular or syncopated
- The "melody" of durations
**Example:**
- Beat: 1 2 3 4 (steady)
- Rhythm: ♩ ♩ ♫ ♩ (quarter, quarter, eighth-eighth, quarter)
**Analogy:**
- Beat = ticking of a clock
- Rhythm = pattern of when you do things throughout the day
**In music:**
- Drums often keep the beat (kick/snare)
- Melody/instruments create rhythm
- Together they make groove
**Practice:** Tap foot to steady beat, clap different rhythms over it!"""
def _gen_time_signature_answer(self) -> str:
"""Generate time signature explanation."""
return """Time signature tells you how beats are grouped in a measure.
**Format:** Two numbers stacked (e.g., 4/4, 3/4, 6/8)
**Top number:** How many beats per measure
**Bottom number:** What note gets 1 beat
- 4 = quarter note
- 8 = eighth note
- 2 = half note
**Common time signatures:**
**4/4 (common time):**
- 4 beats per measure
- Quarter note = 1 beat
- Most pop/rock
**3/4 (waltz time):**
- 3 beats per measure
- Quarter note = 1 beat
- ONE-two-three, ONE-two-three
**6/8:**
- 6 beats per measure
- Eighth note = 1 beat
- Often felt as 2 groups of 3 (1-2-3, 4-5-6)
**What it means:**
- Measures (bars) have fixed number of beats
- Note durations must add up to that number
- Conducting pattern depends on time signature
**Practice:** Count out loud while listening to songs!"""
def _gen_scale_answer(self) -> str:
"""Generate scale explanation."""
return """A scale is a sequence of notes in ascending or descending order, typically within one octave.
**Why scales matter:**
- Foundation for melodies and harmonies
- Build technique and finger strength
- Understand keys and tonality
**Major scale (the "do-re-mi" scale):**
Pattern: W-W-H-W-W-W-H (W=whole step, H=half step)
C major: C D E F G A B C
**Minor scale (natural minor):**
Pattern: W-H-W-W-H-W-W
A minor: A B C D E F G A
**How to practice:**
1. Start with C major (no sharps/flats)
2. Use correct fingering
3. Play hands separately, then together
4. Use metronome, start slow
5. Gradually increase speed
**Common scales to learn:**
- C major (foundation)
- G major (1 sharp)
- F major (1 flat)
- D minor (1 flat)
- A minor (relative of C)
**Pro tip:** Learn the pattern, not just the notes!"""
def _gen_intervals_answer(self) -> str:
"""Generate intervals explanation."""
return """An interval is the distance between two notes.
**Naming intervals:**
1. **Number:** Count lines/spaces from first to second note (including both)
- C to D = 2nd
- C to E = 3rd
- C to G = 5th
2. **Quality:** Major, minor, perfect, augmented, diminished
- 2nds, 3rds, 6ths, 7ths: major or minor
- 4ths, 5ths, octaves: perfect, augmented, or diminished
- Unison (same note) and octave (8th) are perfect
**Common intervals:**
- **Unison (P1):** Same note
- **Major 2nd (M2):** 2 semitones (C to D)
- **Major 3rd (M3):** 4 semitones (C to E)
- **Perfect 4th (P4):** 5 semitones (C to F)
- **Perfect 5th (P5):** 7 semitones (C to G)
- **Octave (P8):** 12 semitones (C to next C)
**Why learn intervals?**
- Build chords (stack 3rds)
- Recognize melodies
- Transpose music
- Ear training
**Practice:** Play intervals on piano, listen to their character!"""
def _gen_chord_progression_answer(self) -> str:
"""Generate chord progression explanation."""
return """A chord progression is a series of chords played in sequence.
**Why progressions matter:**
- Create harmony and movement
- Define the key
- Evoke emotions
- Foundation for songs
**Common progressions:**
**I-IV-V-I** (classic, strong resolution)
- C - F - G - C
- Used in countless songs
**I-V-vi-IV** (modern pop)
- C - G - Am - F
- "Let It Be", "Someone Like You"
**ii-V-I** (jazz standard)
- Dm - G - C
- Smooth voice leading
**12-bar blues:**
- I - I - I - I
- IV - IV - I - I
- V - IV - I - V
**Roman numerals:**
- I = 1st degree of scale
- ii = 2nd degree (minor in major key)
- iii = 3rd (minor)
- IV = 4th (major)
- V = 5th (major)
- vi = 6th (minor)
- vii° = 7th (diminished)
**Practice:** Play these in different keys!"""
def _gen_syncopation_answer(self) -> str:
"""Generate syncopation explanation."""
return """Syncopation is rhythmic emphasis on normally weak beats or off-beats.
**What it is:**
- Accenting between the beats
- Playing "in the cracks"
- Creates groove, swing, tension
**Examples:**
- Emphasizing the "and" of 2: 1 & 2 & 3 & 4 &
- Rest on beat 1, accent on "e" of 1
- Anticipating the next beat
**In notation:**
- Staccato dots, ties across bar lines
- Syncopated rhythms often have dotted notes
**Genres that use syncopation:**
- Jazz (swing feel)
- Funk (ghost notes, off-beat hits)
- Reggae (skank on off-beat)
- Latin (clave patterns)
**How to practice:**
1. Count steady beats out loud
2. Clap syncopated rhythm while counting
3. Start simple: accent "and" of 2 and 4
4. Gradually increase complexity
**Listen to:** Stevie Wonder, James Brown, Dave Brubeck for syncopation mastery!"""
def _gen_ear_improvement_answer(self) -> str:
"""Generate ear improvement explanation."""
return """Improving your ear (aural skills) takes consistent practice.
**Daily exercises:**
**1. Pitch matching (5 min):**
- Play a note, sing it back
- Use piano or tuner app
- Start with C, D, E, F, G
**2. Interval identification (5 min):**
- Play two notes, identify the interval
- Start with 2nds, 3rds, 4ths, 5ths
- Use apps like "Functional Ear Trainer"
**3. Chord quality (5 min):**
- Play major, minor, diminished chords
- Learn to distinguish by ear
- Major = happy, minor = sad, dim = tense
**4. Melodic dictation (5 min):**
- Listen to a short melody (3-5 notes)
- Try to play/sing it back
- Check accuracy
**5. Active listening:**
- Listen to songs, focus on bass line
- Identify chord changes
- Hum along with melody
**Tools:**
- Ear training apps (Functional Ear Trainer, Tenuto)
- Online quizzes
- Piano/keyboard essential
**Consistency:** 15-20 minutes daily beats 2 hours weekly!"""
def _gen_perfect_fifth_answer(self) -> str:
"""Generate perfect fifth description."""
return """A perfect fifth is 7 semitones — a very consonant, stable interval.
**How it sounds:**
- Strong, grounded, complete
- Like a "musical home"
- Used in power chords (guitar) and many harmonies
**Famous examples:**
- **Star Wars theme opening:** "da-da-da-DAAAA" — that's a perfect 5th!
- **"Twinkle Twinkle Little Star":** First two notes (C to G)
- **"My Country 'Tis of Thee":** Opening interval
- **Power chords on guitar:** E5 = E + B (perfect 5th)
**On piano:**
- C to G (skip 6 keys/7 semitones)
- Any note to the next key that's 7 semitones up
**Why it's important:**
- Forms the basis of chords and harmony
- Used in tuning (Pythagorean)
- Very stable, doesn't need resolution
**Practice:** Play C and G together — hear that rich, open sound? That's a perfect fifth!"""
def _gen_chord_quality_ear_answer(self) -> str:
"""Generate chord quality ear training explanation."""
return """Learning to identify chords by ear is a superpower. Here's how:
**Chord qualities and their "characters":**
**Major:** Bright, happy, stable
- Examples: "Happy Birthday" opening
- Sound: 😊
**Minor:** Sad, dark, melancholic
- Examples: "House of the Rising Sun", "Greensleeves"
- Sound: 😢
**Diminished:** Tense, unstable, spooky
- Examples: "The Simpsons theme" (tritone subset)
- Sound: 👻
**Dominant 7:** Bluesy, tense, wants to resolve
- Examples: Blues progressions, "Purple Haze"
- Sound: 🎸
**Major 7:** Smooth, jazzy, dreamy
- Examples: "Something" (Beatles), "So What" (Miles Davis)
- Sound: ✨
**Practice method:**
1. Play each chord type on piano/guitar
2. Listen to the character
3. Have a friend play random chords, guess
4. Use apps (Functional Ear Trainer, Tenuto)
5. Listen to songs, identify chords
**Start with:** Major vs minor (easiest distinction)
**Then add:** Diminished, dominant 7
**Advanced:** Major 7, minor 7, suspended
**Daily 10 minutes = huge progress in 3 months!"""
def _gen_relative_pitch_answer(self) -> str:
"""Generate relative pitch explanation."""
return """Relative pitch is identifying intervals and relationships between notes, not absolute pitches.
**What it is:**
- "That note is a 5th above that one"
- "The melody goes up a major 3rd"
- Not "that's an A" (that's absolute pitch)
**Why it's useful:**
- Transcribe melodies
- Play by ear
- Improvise
- Understand music structure
**How to develop it:**
**1. Interval training:**
- Learn to recognize 2nds, 3rds, 4ths, 5ths, octaves
- Associate with songs (P5 = Star Wars)
- Practice daily with apps
**2. Scale degree ear training:**
- In key of C, identify which scale degree each note is
- "That's the 3rd (mi) of the scale"
- Use solfege (do-re-mi)
**3. Melodic dictation:**
- Listen to short melody
- Write down intervals
- Reconstruct on instrument
**4. Chord progressions:**
- Identify I-IV-V, ii-V-I by ear
- Transcribe songs
**Apps:** Functional Ear Trainer, Earmaster, Teoria
**Reality:** Anyone can develop relative pitch with practice!"""
def _gen_pop_progressions_answer(self) -> str:
"""Generate pop chord progressions explanation."""
return """Pop music loves certain chord progressions. Here are the classics:
**The 4-chord loop (I-V-vi-IV):**
- C - G - Am - F (in C)
- Used in: "Let It Be", "Someone Like You", "With or Without You"
- Emotional, satisfying resolution
**Variations:**
- vi-IV-I-V (A minor - F - C - G) — more melancholic
- I-vi-IV-V (C - Am - F - G) — 50s progression
- IV-V-I (F - G - C) — plagal cadence
**3-chord songs:**
- I-IV-V (C-F-G) — blues/rock
- I-V-vi (C-G-Am) — modern pop
- I-vi-IV (C-Am-F) — ballad
**Why these work:**
- Strong root movement (5ths, stepwise)
- Tension and resolution (V → I)
- Familiar, comfortable to ears
**To use:**
1. Pick a key (C, G, D, A are common)
2. Apply progression
3. Write melody over it
4. Add lyrics
**Example in C:**
```
Verse: C - G - Am - F
Chorus: F - G - C - G
```
**Tip:** Don't overthink — these progressions are everywhere for a reason!"""
def _gen_chorus_writing_answer(self) -> str:
"""Generate chorus writing explanation."""
return """The chorus is the emotional and melodic climax of your song. Make it memorable!
**Characteristics of a great chorus:**
- **Higher energy** than verse
- **Catchy melody** (easy to remember)
- **Emotional peak** (main message)
- **Repetition** (same lyrics each time)
- **Simple chord progression** (often 4 chords)
**How to write:**
**1. Start with the hook:**
- What's the 1-2 line that sums up the song?
- Make it singable, memorable
- Example: "Let it be" — simple, repeatable
**2. Build melody:**
- Higher range than verse
- Strong rhythms
- Repetition is key
**3. Choose chords:**
- Often I-V-vi-IV or similar
- Strong resolution to tonic
- Keep it simple
**4. Write lyrics:**
- Emotional core of the song
- Broad, relatable statements
- Repeat the hook
**Structure:**
```
[Pre-chorus] (builds tension)
[CHORUS] (release, big moment)
```
**Example:**
Verse: "When I find myself in times of trouble..."
Pre-chorus: "And my mother comes to me..."
Chorus: "Let it be, let it be, let it be, let it be"
**Tip:** Write the chorus FIRST — it's the heart of the song!"""
def _gen_hook_answer(self) -> str:
"""Generate hook explanation."""
return """A hook is the catchiest, most memorable part of a song — the part that gets stuck in your head!
**Types of hooks:**
**Melodic hook:** A short, catchy melody
- Example: "Yesterday" (Beatles) opening
- Simple, singable, repeats
**Lyrical hook:** Memorable phrase
- Example: "I can't get no satisfaction"
- Often the chorus or tagline
**Rhythmic hook:** Distinctive rhythm pattern
- Example: "We Will Rock You" stomp-stomp-clap
- Instantly recognizable
**Sonic hook:** Unique sound/texture
- Example: The opening synth in "Billie Jean"
- Production effect that defines the track
**How to create a hook:**
1. **Keep it simple** — 3-5 notes/words
2. **Repeat it** — multiple times in song
3. **Make it singable** — comfortable range
4. **Emotional resonance** — connects to song's theme
5. **Contrast** — different from verses
**Where hooks appear:**
- Chorus (most common)
- Intro
- Post-chorus
- Outro
**Famous hooks:**
- "I wanna dance with somebody" (melodic)
- "I will survive" (lyrical)
- "We will, we will rock you" (rhythmic)
**Test:** Can you hum it after 1 listen? If yes, it's a hook!"""
def _gen_lyric_writing_answer(self) -> str:
"""Generate lyric writing explanation."""
return """Writing lyrics is about storytelling and emotion. Here's how:
**1. Start with a theme:**
- What's the song about? (love, loss, hope, rebellion)
- One central idea
**2. Structure:**
- Verse: Details, story development
- Chorus: Main message, emotional peak
- Bridge: Contrast, new perspective
**3. Show, don't tell:**
- ❌ "I'm sad"
- ✅ "Rain on my window, empty room, your ghost remains"
**4. Rhyme schemes:**
- AABB: Couplets (easy, common)
- ABAB: Alternating (more sophisticated)
- ABCB: Ballad (focus on last line)
**5. Rhyme families:**
- Use rhyme dictionaries
- Near rhymes work too (sound/round)
- Don't force bad rhymes!
**6. Meter/rhythm:**
- Count syllables
- Aim for consistent pattern
- Read aloud — does it flow?
**7. Imagery:**
- Use sensory details (sight, sound, touch)
- Metaphors and similes
- Specific > general
**Process:**
1. Brainstorm words/phrases related to theme
2. Write chorus first (the hook)
3. Write verses that support chorus
4. Edit, edit, edit
**Read lyrics** of songs you admire — study their craft!"""
def _gen_song_structure_answer(self) -> str:
"""Generate song structure explanation."""
return """Song structure is the blueprint — how sections are organized.
**Common structures:**
**Verse-Chorus (most popular):**
Intro → Verse → Chorus → Verse → Chorus → Bridge → Chorus → Outro
**AABA (standard/jazz):**
A (theme) → A (repeat) → B (bridge/contrast) → A (return) → Outro
**Through-composed:**
No repeats, each section new (common in progressive music)
**12-bar blues:**
12 measures repeating: I-I-I-I / IV-IV-I-I / V-IV-I-V
**Section purposes:**
**Intro:** Set mood, instrumental, no vocals usually
**Verse:** Story development, lyrics change each time
**Pre-chorus:** Builds tension to chorus
**Chorus:** Main message, repeated lyrics, emotional peak
**Bridge:** Contrast, new perspective, often different chords
**Outro:** Ending, fade or final statement
**How to choose:**
- Pop/rock: Verse-chorus (familiar)
- Jazz: AABA
- Blues: 12-bar
- Singer-songwriter: Verse-chorus or AABA
**Tip:** Map structure of songs you like! Understand how they build and release tension."""
def _gen_house_bpm_answer(self) -> str:
"""Generate house BPM explanation."""
return """House music typically ranges from 118-130 BPM (beats per minute).
**Subgenres:**
- **Deep house:** 120-122 BPM, soulful, atmospheric
- **Tech house:** 125-130 BPM, minimal, percussive
- **Progressive house:** 128-132 BPM, melodic, builds
- **Future house:** 120-126 BPM, modern bass
- **Disco house:** 118-122 BPM, funky, samples
**The classic "four-on-the-floor":**
- Kick drum on every beat (1, 2, 3, 4)
- Creates driving, danceable pulse
- Hi-hats on eighth or sixteenth notes
**Why that BPM range?**
- 120-130 is optimal for dancing
- Not too fast, not too slow
- Matches natural human movement
**Famous examples:**
- Daft Punk: 120-124 BPM
- Swedish House Mafia: 128 BPM
- Frankie Knuckles: 118-122 BPM
**Production tip:** Sidechain kick to bass/ pads for that "pumping" house feel!"""
def _gen_sidechain_answer(self) -> str:
"""Generate sidechain compression explanation."""
return """Sidechain compression makes one sound "duck" when another plays — essential in dance music.
**What it does:**
- Kick hits → bass/pads temporarily lower in volume
- Creates "pumping" rhythm
- Makes kick cut through mix
**How it works:**
1. Compressor on bass track
2. Kick track fed into compressor's sidechain input
3. When kick hits, compressor reduces bass volume
4. Bass comes back up between kicks
**Classic settings (4/4, 128 BPM):**
- Threshold: -20 to -15 dB
- Ratio: 4:1 to 6:1
- Attack: 0-5 ms (instant)
- Release: 200-400 ms (until next kick)
- Lookahead: 1-5 ms (optional, prevents transients)
**Uses beyond kick+bass:**
- Vocal ducking when talking over music
- Guitar ducking during solos
- Any time you need space
**Famous examples:**
- Daft Punk "One More Time"
- Swedish House Mafia
- Most EDM
**DAW shortcuts:**
- Ableton: Compressor → Sidechain → External
- FL Studio: Fruity Limiter or Compressor sidechain
- Logic: Compressor → Sidechain → Input"""
def _gen_beatmatch_answer(self) -> str:
"""Generate beatmatching explanation."""
return """Beatmatching is aligning two tracks' beats so they play in sync — essential DJ skill.
**The process:**
**1. Know your tracks:**
- Where is the downbeat (beat 1)?
- What's the BPM?
**2. Load track 2 on deck 2, track 1 playing on deck 1**
**3. Match tempos:**
- Find BPM of each (software shows it)
- Adjust pitch/tempo slider on deck 2 to match deck 1
- Or use sync button (but learn manual!)
**4. Align beats:**
- Cue up first beat of track 2 on headphones
- Release track 2 on the first beat of track 1
- Nudge if needed (jog wheel)
**5. Verify:**
- Listen to both tracks together
- Beats should be perfectly aligned (no phasing)
- Use headphones to check
**6. Crossfade:**
- Once aligned, blend from deck 1 to deck 2
**Tips:**
- Use beatgrids (modern DJ software auto-detects)
- Watch waveforms visually
- Practice with same BPM tracks first
- Learn to nudge by ear, not just eyes
**Modern DJing:** Most software has sync, but understanding beatmatching helps when things go wrong!"""
def _gen_daw_answer(self) -> str:
"""Generate DAW explanation."""
return """DAW = Digital Audio Workstation — your music production software.
**What a DAW does:**
- Record audio/MIDI
- Edit and arrange tracks
- Mix (EQ, compression, effects)
- Master final track
- Export to MP3/WAV
**Popular DAWs:**
- **Ableton Live:** Electronic/loop-based, great for live performance
- **FL Studio:** Beat-making, EDM, intuitive
- **Logic Pro:** Mac only, all-around, great for songwriting
- **Pro Tools:** Industry standard for recording
- **Reaper:** Cheap, powerful, customizable
- **Cubase:** Traditional, MIDI strong
**Basic workflow:**
1. **Create project** → set tempo, key
2. **Add tracks** → audio (record) or MIDI (virtual instruments)
3. **Arrange** → put sections in order
4. **Mix** → balance levels, add effects
5. **Master** → final polish, loudness
6. **Export** → share your music
**Getting started:**
- Many have free trials
- YouTube tutorials for your chosen DAW
- Start simple — one instrument, one effect
**You can make professional music with ANY DAW!** It's about skill, not tools."""
def _gen_eq_answer(self) -> str:
"""Generate EQ explanation."""
return """EQ (equalization) adjusts volume of specific frequency ranges.
**What it does:**
- Boost or cut bass/mids/treble
- Shape tone of instruments
- Make space in mix for each element
**Frequency ranges:**
- **Sub-bass (20-60 Hz):** Deep bass, kick drum fundamental
- **Bass (60-250 Hz):** Kick body, bass guitar
- **Low-mids (250-500 Hz):** Body, warmth (can get muddy)
- **Mids (500 Hz - 2 kHz):** Clarity, presence (vocals live here)
- **High-mids (2-6 kHz):** Detail, attack (snare, guitar)
- **Highs (6-20 kHz):** Air, sparkle, cymbals
**Types of EQ:**
- **Shelving:** Boost/cut all above/below a frequency
- **Peaking:** Boost/cut around a frequency
- **High-pass/low-pass:** Remove below/above
**Common uses:**
- **High-pass on everything except kick/bass** (remove sub)
- **Cut 200-400 Hz on vocals** (reduce mud)
- **Boost 2-5 kHz on snare** (more crack)
- **Cut 1-2 kHz on guitars** (make space for vocals)
**Golden rule:** Cut before boost. Small adjustments (2-4 dB) often enough.
**Practice:** Solo a track, sweep frequency, listen for "bad" areas to cut."""
def _gen_mixing_answer(self) -> str:
"""Generate mixing explanation."""
return """Mixing is balancing all elements of a song to sound good on all speakers.
**The mixing process:**
**1. Organization:**
- Color code tracks
- Group similar tracks (drums, vocals, guitars)
- Label clearly
**2. Gain staging:**
- Set initial levels so nothing clips (red)
- Aim for -6 dB headroom on master
**3. EQ:**
- Carve space for each instrument
- Remove unwanted frequencies
- Make elements distinct
**4. Compression:**
- Control dynamics (loud/quiet differences)
- Make things punchy or smooth
- Glue tracks together
**5. Effects:**
- Reverb: space/depth
- Delay: echoes, width
- Modulation: chorus, phaser, flanger
**6. Automation:**
- Change levels/effects over time
- Build intensity
- Highlight important moments
**Mixing tips:**
- **Reference tracks:** Compare to professional mixes
- **Take breaks:** Ears fatigue
- **Mono compatibility:** Check in mono!
- **Multiple systems:** Test on headphones, car, phone
**Order:** There's no right order — do what works. Many mix in this order: gain → EQ → compression → effects → automation.
**Remember:** Mixing serves the song. Make it emotional, clear, and powerful!"""
def _gen_frustrated_chord_answer(self) -> str:
"""Generate response to frustrated chord learner."""
return """I hear you — barre chords are notoriously difficult! That frustration is completely normal. Even Eric Clapton struggled with them at first.
**Let's make this easier:**
**1. Start with partial barres:**
Instead of all 6 strings, try barring just 2-3 strings:
[TAB]
F major (simplified):
e|--1--|
B|--1--|
G|--2--|
D|--3--|
A|--x--|
E|--1--|
[/TAB]
Index finger bars only top 3 strings.
**2. Build strength gradually:**
- Practice barre on 5th fret (easier, less tension)
- Hold for 5 seconds, release, repeat
- Do this for 2 minutes daily
**3. Check your technique:**
- Thumb behind neck, roughly middle
- Index finger close to fret (not on top)
- Elbow angle: not too tucked, not too flared
**4. Try a capo:**
Capo on 3rd fret + open C shape = sounds as Eb, but no barre!
**Remember:** This takes weeks to months to master. Every day you practice, your fingers get stronger. You've got this! 💪"""
def _gen_finger_pain_answer(self) -> str:
"""Generate response to finger pain."""
return """Ouch, yes! Guitar fingers are a rite of passage. That pain means you're building calluses — the badge of honor for guitarists!
**What's happening:**
- Your fingertips are soft (new to pressure)
- Pressing strings creates friction and pressure
- Skin will thicken into calluses (good!)
**How to manage:**
**1. Don't overdo it:**
- 15-20 minutes of focused practice is better than 2 hours of pain
- Take breaks every 10-15 minutes
- Stop if sharp pain (not just soreness)
**2. Light gauge strings:**
- .009-.042 or .010-.046 are easier than .011+
- Ask at music store for "light gauge"
**3. Lower action:**
- Action = string height from fretboard
- Too high = more pressure needed
- Music store can adjust (truss rod, saddle)
**4. Finger exercises:**
- Press each fret individually, hold 5 sec
- Spider exercises (1-2-3-4 across strings)
**5. It gets better:**
- First 2-3 weeks: tender
- 1 month: calluses form, pain subsides
- 2 months: comfortable
**Hang in there!** Every guitarist has been exactly where you are. The pain is temporary, the music is forever."""
def _gen_never_able_answer(self) -> str:
"""Generate response to "I'll never be able to play this"."""
return """I know that feeling — it's so discouraging when something feels impossible. Let me tell you something important:
**Every single musician felt that way.**
The guitarist you admire? They thought they'd never master barre chords. The pianist who plays beautifully? They once couldn't play a C major scale. This is part of the journey.
**A few truths:**
1. **Progress is slow and non-linear.** You might practice for weeks and feel stuck, then suddenly "get it." That's normal.
2. **Comparison is the thief of joy.** Don't compare your Chapter 1 to someone's Chapter 20.
3. **Small wins matter.** Celebrate the tiny victories — that chord that sounded clean, that scale that flowed.
4. **Learning music is a marathon, not a sprint.** It's a lifelong journey. You have decades to improve.
**What to do right now:**
- Take a break if you're frustrated
- Play something you enjoy and can do
- Remember why you started — the joy of making music
**You can do this.** Not today, maybe not this week, but with consistent practice, you will improve. I believe in you. Keep going. 🌟"""
def _gen_quit_answer(self) -> str:
"""Generate response to wanting to quit."""
return """I hear you, and it's okay to feel like quitting when things get hard. Many of us have been there.
**Before you make a decision:**
**1. Is it the instrument or the approach?**
- Maybe guitar isn't your instrument — try piano, ukulele, singing?
- Maybe your learning method isn't working — try a different teacher/resource
**2. Give yourself permission to rest:**
- Take a week off
- Come back with fresh ears
- Often the break rekindles passion
**3. Reconnect with why you started:**
- What drew you to music?
- What song made you think "I want to play that"?
- Hold onto that feeling
**4. Lower the bar:**
- You don't have to be a virtuoso
- Playing 3 chords for your family is enough
- Music is for joy, not perfection
**5. Try a different genre:**
- Classical too rigid? Try blues
- Rock too loud? Try folk
- Find what resonates with YOU
**It's okay to take a break or even quit.** But don't quit on a bad day. Quit when you're truly at peace with the decision.
**Most importantly:** Your worth is not tied to your musical ability. You're valuable regardless.
**I'm here to help however I can.** What specifically feels overwhelming?"""
def _gen_confused_theory_answer(self) -> str:
"""Generate response to confused theory learner."""
return """Music theory can absolutely feel overwhelming at first — so many terms, rules, exceptions. Let's simplify.
**First: Theory is a DESCRIPTION, not a RULE.**
It explains what composers already did. You can break it (once you know it).
**Start with these 3 things:**
**1. The major scale (C major):**
C D E F G A B C
That's your reference point. Everything else relates to this.
**2. Chords are built by stacking 3rds:**
- C + E + G = C major (1-3-5 of scale)
- D + F + A = D minor (1-3-5 of D scale)
That's it. That's 80% of chords.
**3. Roman numerals = chord functions:**
I = tonic (home)
IV = subdominant (prepares)
V = dominant (tension, wants to resolve to I)
**Forget the rest for now.**
No modes, no modal interchange, no secondary dominants yet.
**Practice:**
- Play C major scale
- Build chords on each degree (C, Dm, Em, F, G, Am, Bdim)
- Play I-IV-V-I in C (C-F-G-C)
- Hear how V→I feels like home
**You'll learn more as you need it.** Don't try to memorize everything at once.
**What specific theory concept is confusing you? Let's tackle that one thing."""
def _gen_losing_beat_answer(self) -> str:
"""Generate response to losing beat."""
return """Losing the beat is incredibly common — even pros struggle with timing sometimes!
**Why it happens:**
- Not listening to the metronome/other players
- Focusing too hard on technique
- Rushing or dragging unconsciously
- Complex rhythms
**How to fix it:**
**1. Internalize the beat:**
- Tap foot, nod head, count out loud
- "1 e & a 2 e & a 3 e & a 4 e & a"
- Physical movement helps
**2. Use a metronome ALWAYS:**
- Start SLOW (50-60 BPM)
- Play along, focus on hitting EXACTLY on the beat
- Record yourself, check timing
**3. Subdivide:**
- Think eighth notes or sixteenths
- "1 & 2 & 3 & 4 &" keeps you between beats
- Prevents rushing
**4. Play with backing tracks:**
- YouTube has backing tracks in any genre/BPM
- Forces you to stay in time
**5. Record and listen:**
- Record your practice
- Listen back — were you early/late?
- Adjust
**6. Relax!**
- Tension = bad timing
- Take deep breaths
- It's okay to be imperfect
**Exercise:** Set metronome to 80 BPM. Play quarter notes. Record 30 seconds. Listen. Do this daily for a week.
**You'll get there.** Timing is a skill, not a gift. Practice it like anything else!"""
def generate_qa_pair(
self,
category: Optional[str] = None,
skill_level: str = "beginner",
include_context: bool = True,
) -> Dict[str, str]:
"""
Generate a single QA pair.
Args:
category: Optional specific category (if None, random)
skill_level: Target skill level (beginner/intermediate/advanced)
include_context: Include instrument/level context tags
Returns:
Dictionary with "messages" field containing chat format
"""
# Select category
if category is None or category not in self.qa_categories:
category = random.choice(list(self.qa_categories.keys()))
# Filter by skill level if possible
category_questions = self.qa_categories[category]
matching = [q for q in category_questions if skill_level.lower() in q["context"].lower()]
if not matching:
matching = category_questions
# Select random question
qa = random.choice(matching)
# Generate answer
answer = qa["answer"]()
# Build context
context = qa["context"]
if skill_level and skill_level.upper() not in context:
context = context.replace("[BEGINNER]", f"[{skill_level.upper()}]")
if f"[{skill_level.upper()}]" not in context:
context = f"[{skill_level.upper()}]{context}"
# Build messages
messages = [
{"role": "system", "content": self.system_prompt},
{
"role": "user",
"content": f"{context if include_context else ''} {qa['question']}".strip(),
},
{"role": "assistant", "content": answer},
]
return {
"category": category,
"skill_level": skill_level,
"messages": messages,
}
def generate_dataset(
self,
num_samples: int = 1000,
output_path: Optional[str] = None,
categories: Optional[List[str]] = None,
skill_levels: Optional[List[str]] = None,
) -> List[Dict]:
"""
Generate full dataset.
Args:
num_samples: Number of QA pairs
output_path: Optional path to save JSONL
categories: Optional specific categories to include
skill_levels: Optional skill levels to include
Returns:
List of QA dictionaries
"""
if categories:
# Filter categories
filtered_categories = {}
for cat in categories:
if cat in self.qa_categories:
filtered_categories[cat] = self.qa_categories[cat]
self.qa_categories = filtered_categories
if skill_levels is None:
skill_levels = ["beginner", "intermediate", "advanced"]
dataset = []
for i in range(num_samples):
skill_level = random.choice(skill_levels)
qa_pair = self.generate_qa_pair(skill_level=skill_level)
dataset.append(qa_pair)
if (i + 1) % 100 == 0:
print(f"Generated {i + 1}/{num_samples} samples")
# Save if path provided
if output_path:
output_path = Path(output_path)
output_path.parent.mkdir(parents=True, exist_ok=True)
with open(output_path, "w") as f:
for item in dataset:
f.write(json.dumps(item) + "\n")
print(f"Dataset saved to {output_path} ({num_samples} samples)")
return dataset
def test_generator():
"""Test the MusicQAGenerator."""
generator = MusicQAGenerator(seed=42)
print("Generating sample QA pairs...\n")
# Generate one from each category
categories = list(generator.qa_categories.keys())
for category in categories[:3]: # Test first 3
qa = generator.generate_qa_pair(category=category)
print(f"=== Category: {category} ===")
print(f"User: {qa['messages'][1]['content'][:100]}...")
print(f"Assistant: {qa['messages'][2]['content'][:150]}...")
print()
# Generate small dataset
print("Generating small dataset (10 samples)...")
dataset = generator.generate_dataset(num_samples=10)
print(f"Dataset size: {len(dataset)}")
print(f"Sample structure: {list(dataset[0].keys())}")
print("\nMusicQAGenerator test complete!")
if __name__ == "__main__":
test_generator()