Two notes can occupy the same staff position yet last for different amounts of time. A written gap can also take time without producing a sound. Reading music requires both coordinates: pitch from position, duration from the symbol and its context.
A note value is a relative duration, not a fixed number of seconds. A rest occupies time just as deliberately as a note. This lesson connects the beat grids you have heard to conventional notation. Allow fifteen minutes and count aloud when possible.
Read the head, stem, and flag together
For our first examples, a quarter note is one beat and the time signature is 4/4. A whole note has an open head with no stem. A half note has an open head and a stem. A quarter note has a filled head and a stem. An eighth note adds a flag; several eighths are often joined by a beam instead of separate flags. A beam groups notes visually and does not itself change their values.
Symbol name Quarter-note units here At quarter note = 90 BPM
Whole note 4 About 2.67 seconds
Half note 2 About 1.33 seconds
Quarter note 1 About 0.67 seconds
Eighth note ½ About 0.33 seconds
Dotted quarter note 1½ 1 second
Stem direction helps keep the page readable. In a simple single voice, notes at or above the middle line usually have downward stems. Turning the stem down does not change duration or pitch. Read the head and any flag or beam, not the direction, to identify the value. Duration symbols
Hear the difference between holding and resting
Choose a whole note, then a quarter note. Both demonstrations run for four beats, with a quiet reference pulse. The longer note continues through more pulses; the shorter one leaves the remaining time empty. Now choose a quarter rest: the reference pulse continues but the melody tone is absent.
Preparing the visual Try again
Read a duration, then hear it In this 4/4 example, whole = 4 quarter-note beats, half = 2, quarter = 1, eighth = 1/2, dotted quarter = 1 1/2. Rests use the same durations but produce no melody tone.
{"id":"music-rhythm-symbols","title":"Read a duration, then hear it","summary":"In this 4/4 example, whole = 4 quarter-note beats, half = 2, quarter = 1, eighth = 1/2, dotted quarter = 1 1/2. Rests use the same durations but produce no melody tone.","height":800,"html":"<h2 data-i18n=\"heading\"></h2><p class=\"mf-intro\" data-i18n=\"intro\"></p>\n<div id=\"controls\" class=\"mf-controls\"></div><div id=\"sheet\"></div><p id=\"meta\" class=\"mf-meta\"></p>\n<div id=\"answers\" class=\"mf-answers\" role=\"group\" data-i18n-label=\"question\"></div><div id=\"quiz-actions\" class=\"mf-actions\"></div>\n<p id=\"feedback\" class=\"mf-feedback\" role=\"status\" aria-live=\"polite\"></p>\n<div class=\"mf-actions\"><button id=\"play\" data-i18n=\"play\"></button><button id=\"stop\" data-i18n=\"stop\" disabled></button></div><p id=\"status\" class=\"mf-meta\" role=\"status\" data-i18n=\"idle\"></p>\n<label class=\"mf-volume\"><span data-i18n=\"volume\"></span><input id=\"volume\" type=\"range\" min=\"0\" max=\"100\" value=\"65\"></label>\n","css":"body{padding:24px}h2{font-size:22px;line-height:1.4}p{line-height:1.75}.mf-intro{color:var(--muted);margin:10px 0 18px}.mf-staff{display:block;width:100%;height:auto;max-height:270px;color:var(--ink);background:var(--surface);border:1px solid var(--rule);border-radius:8px;margin:16px 0}.mf-controls,.mf-actions,.mf-answers{display:flex;flex-wrap:wrap;gap:8px;margin:14px 0}button,select{min-height:46px;font-size:16px}button{white-space:normal;line-height:1.5}.mf-controls button,.mf-answers button{flex:1 1 64px}.mf-actions button{flex:1 1 110px}label{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:16px;margin:12px 0}select{max-width:100%;background:var(--paper);color:var(--ink);border:1px solid var(--rule);padding:8px;border-radius:6px}.mf-feedback{border-left:3px solid var(--accent);padding:12px;background:var(--surface);min-height:3.5em;margin:14px 0;font-size:16px}.mf-meta{font-size:14px;color:var(--muted);margin:10px 0}.mf-staff [data-current=true]{color:var(--accent);filter:drop-shadow(0 0 1px currentColor)}.mf-staff [data-current=true] path{fill:currentColor}.mf-queue{display:flex;flex-wrap:wrap;gap:8px}.mf-queue button{min-width:50px}.mf-queue button[aria-pressed=true]{border-color:var(--accent);background:var(--accent-soft)}.mf-score{font-variant-numeric:tabular-nums}.mf-volume{display:flex;gap:12px;align-items:center;font-size:14px;border-top:1px solid var(--rule);padding-top:12px}.mf-volume input{min-width:80px;max-width:180px}.mf-answer-note{color:var(--muted);font-size:14px}button[aria-pressed=true]{background:var(--accent-soft);border-color:var(--accent)}[hidden]{display:none!important}@media(max-width:420px){body{padding:20px 14px}h2{font-size:20px}.mf-controls button{flex-basis:75px}}\n\n.mf-answers button{border:1px solid var(--rule);background:var(--surface);border-radius:8px;min-height:52px;padding:10px 14px;cursor:pointer}.mf-answers button:not(:disabled):hover{border-color:var(--accent);background:var(--accent-soft)}.mf-answers button:focus-visible{outline:2px solid var(--accent);outline-offset:3px}.mf-answers button[aria-pressed=true]{border:2px solid var(--accent);background:var(--accent-soft);font-weight:600}.mf-answers button:disabled{cursor:default}\n","js":"const GLYPHS = {\"treble\":\"M376 415C374 427 376 428 382 434C398 449 419 470 438 491C522 583 572 702 572 815C572 902 548 988 507 1048C492 1070 466 1098 455 1098C441 1098 410 1072 390 1050C316 968 292 843 292 739C292 681 299 616 306 575C308 563 309 561 297 551C233 498 164 437 112 373C43 287 0 194 0 87C0 -87 119 -252 364 -252C387 -252 413 -250 433 -246C444 -244 446 -243 448 -255C460 -322 475 -409 475 -456C475 -604 375 -622 316 -622C262 -622 236 -606 236 -593C236 -586 245 -583 268 -576C299 -567 335 -540 335 -482C335 -427 300 -380 239 -380C172 -380 132 -433 132 -495C132 -560 171 -658 322 -658C389 -658 519 -628 519 -458C519 -401 501 -306 490 -244C488 -232 489 -233 503 -227C604 -187 671 -102 671 11C671 139 577 252 430 252C404 252 404 252 401 270ZM470 943C503 943 530 916 530 861C530 792 497 728 419 650C403 634 379 611 356 591C349 585 345 586 343 599C339 625 337 659 337 691C337 847 409 943 470 943ZM361 262C364 243 364 244 346 238C258 208 201 129 201 44C201 -46 248 -110 316 -133C324 -136 336 -139 343 -139C351 -139 355 -134 355 -128C355 -121 347 -118 340 -115C298 -97 268 -54 268 -8C268 49 307 92 368 109C384 113 386 112 388 101L438 -197C440 -208 439 -208 424 -211C408 -214 388 -216 368 -216C193 -216 80 -119 80 20C80 79 90 158 173 252C233 319 279 356 326 394C336 402 338 401 340 390ZM430 103C428 115 429 118 441 117C522 110 589 42 589 -46C589 -109 551 -160 495 -188C483 -194 481 -194 479 -182Z\",\"bass\":\"M252 262C78 262 0 135 0 39C0 -41 42 -110 123 -110C186 -110 229 -66 229 -4C229 60 182 100 133 100C106 100 96 93 83 93C70 93 67 101 67 111C67 151 127 224 229 224C335 224 381 120 381 -37C381 -140 359 -260 297 -356C237 -449 134 -534 10 -605C1 -610 -5 -615 -5 -623C-5 -629 -1 -635 8 -635C13 -635 19 -633 25 -630C158 -565 286 -489 392 -375C479 -281 531 -159 531 -28C531 146 425 262 252 262ZM629 180C598 180 574 156 574 125C574 94 598 70 629 70C660 70 684 94 684 125C684 156 660 180 629 180ZM630 -71C599 -71 576 -94 576 -125C576 -156 599 -179 630 -179C661 -179 684 -156 684 -125C684 -94 661 -71 630 -71Z\",\"black\":\"M97 -125C186 -125 295 -43 295 42C295 93 255 125 198 125C88 125 0 44 0 -42C0 -94 43 -125 97 -125Z\",\"half\":\"M97 -125C262 -125 295 9 295 42C295 93 254 125 196 125C47 125 0 10 0 -42C0 -95 42 -125 97 -125ZM173 -46C128 -76 97 -87 75 -87C54 -87 42 -76 35 -64C32 -58 29 -51 29 -44C29 -22 51 5 120 45C170 74 201 84 221 84C240 84 251 75 258 63C261 57 264 51 264 44C264 24 243 0 173 -46Z\",\"whole\":\"M216 125C83 125 0 70 0 2C0 -65 57 -125 206 -125C370 -125 422 -68 422 2C422 73 309 125 216 125ZM111 63C122 98 159 103 190 103C259 103 314 29 314 -31C314 -38 313 -44 312 -50C307 -75 293 -92 268 -98C258 -101 247 -102 237 -102C228 -102 220 -101 211 -98C194 -93 178 -84 164 -72C156 -65 149 -58 143 -50C123 -27 108 7 108 39C108 47 109 55 111 63Z\",\"flag\":\"M238 -790C238 -790 264 -695 264 -617C264 -492 212 -374 149 -274C98 -195 56 -109 40 -13C37 3 29 9 19 9C8 9 0 6 0 -6V-245C66 -257 161 -393 197 -478C212 -512 221 -569 221 -628C221 -673 214 -720 197 -765C195 -771 194 -776 194 -780C194 -796 204 -805 210 -809C211 -810 213 -810 215 -810C222 -810 234 -804 238 -790Z\",\"quarterRest\":\"M78 -38C94 -58 108 -77 121 -98C123 -102 127 -110 127 -112C127 -113 127 -115 126 -116C124 -120 120 -121 115 -121C111 -121 103 -119 99 -118C94 -118 88 -115 83 -115C40 -115 1 -158 1 -211C1 -261 44 -310 117 -366C125 -372 135 -375 143 -375C150 -375 157 -373 158 -369C159 -366 160 -364 160 -362C160 -353 152 -345 144 -338C131 -338 120 -311 118 -302C115 -294 114 -285 114 -276C114 -245 129 -210 161 -204C166 -203 171 -203 177 -203C206 -203 239 -214 255 -220C256 -220 257 -221 258 -221C261 -222 263 -222 265 -222C268 -222 270 -221 270 -218C270 -206 244 -173 233 -161C195 -115 164 -78 164 -22C164 -18 165 -13 165 -9C169 49 205 97 231 138C234 143 235 148 235 153C235 163 231 172 231 172C231 172 83 348 66 365C61 370 54 373 48 373C38 373 28 366 28 352C28 347 29 342 32 336C36 325 93 274 93 202C93 165 78 122 33 75C23 65 19 54 19 46C19 32 29 22 29 22Z\",\"eighthRest\":\"M134 107C134 144 104 174 67 174C30 174 0 144 0 107C0 86 12 68 27 56C36 50 45 45 55 43C63 41 72 39 81 39C95 39 109 42 120 46C134 50 143 54 156 61C158 62 160 62 161 62C165 62 166 58 166 53C166 50 166 46 165 42C162 27 90 -172 72 -238C72 -250 95 -251 101 -251C112 -251 126 -249 136 -241C139 -239 237 112 237 112C241 130 246 146 247 151C247 161 237 166 235 167C233 167 230 167 224 163C217 157 167 97 134 97Z\",\"halfRest\":\"M282 24V116C282 131 270 142 256 142H26C11 142 0 131 0 116V24C0 10 11 -2 26 -2H256C270 -2 282 10 282 24Z\",\"wholeRest\":\"M282 -109V-17C282 -2 270 9 256 9H26C11 9 0 -2 0 -17V-109C0 -123 11 -135 26 -135H256C270 -135 282 -123 282 -109Z\",\"sharp\":\"M237 118C244 121 249 129 249 135V206C249 211 246 214 242 214C240 214 239 214 237 213C237 213 217 205 212 204C205 204 198 209 198 217V339C198 345 192 350 184 350C174 350 168 345 168 339V209C167 199 164 186 155 180C143 173 109 159 92 155C83 155 80 167 80 175V295C80 301 73 306 66 306C56 306 50 301 50 295V160C50 146 44 136 38 133C32 130 12 122 12 122C5 120 0 112 0 106V35C0 29 3 26 8 26C9 26 11 27 12 27C12 27 27 33 34 37C35 37 36 38 37 38C44 38 50 28 50 20V-79C50 -90 45 -99 39 -102C33 -104 12 -113 12 -113C5 -115 0 -123 0 -129V-200C0 -206 3 -209 8 -209C9 -209 11 -208 12 -208C12 -208 26 -202 35 -199C36 -198 37 -198 38 -198C45 -198 50 -209 50 -214V-337C50 -343 56 -348 63 -348C73 -348 80 -343 80 -337V-198C80 -185 85 -178 90 -176L151 -151C152 -151 154 -150 155 -150C163 -150 168 -162 168 -168V-293C168 -299 174 -304 181 -304C192 -304 198 -299 198 -293V-151C198 -143 202 -131 209 -128C216 -125 237 -117 237 -117C244 -114 249 -106 249 -100V-29C249 -24 246 -21 242 -21C240 -21 239 -21 237 -22L211 -32C205 -32 198 -26 198 -14V79C198 86 203 105 211 108ZM168 -45C162 -65 115 -85 92 -85C86 -85 81 -83 80 -80C78 -76 77 -54 77 -30C77 1 78 36 80 44C82 61 128 82 153 82C160 82 166 80 168 76C170 71 172 46 172 19C172 -8 170 -36 168 -45Z\",\"flat\":\"M12 -170C15 -174 18 -175 21 -175C24 -175 27 -173 27 -173C57 -156 81 -129 106 -112C195 -50 226 11 226 57C226 114 182 150 136 153C129 153 122 152 115 150C104 147 92 143 81 136C75 131 64 122 59 122C57 122 56 122 54 123C47 126 43 133 43 140C44 162 50 402 50 422C50 433 41 439 31 439C17 439 1 429 0 411C0 411 4 -160 12 -170ZM47 -81C47 -81 44 -21 44 19C44 35 45 47 46 51C50 63 76 85 90 93C99 98 108 100 116 100C126 100 135 96 141 89C151 78 157 61 157 42C157 24 152 3 140 -18C127 -42 98 -74 68 -93C64 -95 61 -96 58 -96C49 -96 47 -86 47 -81Z\",\"natural\":\"M141 181C139 181 138 180 137 180C137 180 73 157 47 157C41 157 37 158 37 162V329C37 336 31 341 25 341H12C5 341 0 336 0 329V-186C0 -192 3 -195 8 -195C9 -195 11 -194 12 -194C12 -194 14 -194 15 -193C29 -187 85 -163 114 -163C124 -163 131 -166 131 -174V-323C131 -330 136 -335 143 -335H156C162 -335 168 -330 168 -323V179C168 184 164 187 160 187C159 187 157 187 156 186ZM37 39C37 53 98 79 122 79C128 79 131 78 131 74V-29C131 -47 74 -70 49 -70C42 -70 37 -68 37 -64Z\",\"flagDown\":\"M240 760C254 718 261 668 261 623C261 564 236 480 221 446C184 362 134 281 0 236V1C0 -9 8 -14 16 -14C25 -14 38 -8 40 8C57 103 131 190 182 269C245 368 306 487 306 612C306 690 286 761 278 793C275 804 269 808 262 808C250 808 237 796 237 777C237 772 238 766 240 760Z\"};\n// Small SVG engraver for the deliberately limited notation taught in this course.\n// Bravura outlines: Steinberg, SIL OFL 1.1; see engraving/OFL.txt.\nconst MusicStaff=(()=>{\n const ns='http://www.w3.org/2000/svg',letters=['C','D','E','F','G','A','B'],pcs=[0,2,4,5,7,9,11];\n const el=(tag,attrs={})=>{const n=document.createElementNS(ns,tag);for(const [k,v] of Object.entries(attrs))n.setAttribute(k,v);return n;};\n const parse=p=>{const m=p.match(/^([A-G])([♯♭♮]?)([0-8])$/);if(!m)throw Error('invalid written pitch');const letter=letters.indexOf(m[1]),oct=+m[3],alter=m[2]==='♯'?1:m[2]==='♭'?-1:0;return {step:oct*7+letter,midi:(oct+1)*12+pcs[letter]+alter,alter,sign:m[2],name:p};};\n const fromStep=(step,alter=0)=>letters[((step%7)+7)%7]+(alter>0?'♯':alter<0?'♭':'')+Math.floor(step/7);\n const fromMidi=(m,flat=false)=>{const names=flat?['C','D♭','D','E♭','E','F','G♭','G','A♭','A','B♭','B']:['C','C♯','D','D♯','E','F','F♯','G','G♯','A','A♯','B'];return names[m%12]+(Math.floor(m/12)-1);};\n function glyph(parent,name,x,y,gap){parent.append(el('path',{d:GLYPHS[name],transform:`translate(${x} ${y}) scale(${gap/250} ${-gap/250})`,fill:'currentColor'}));}\n function render({clef='treble',notes=[],meter=null,key=null,labels=false,small=false,answerLabel='',barEnds=[]}={}){\n const gap=small?12:16,bottom=small?92:114,width=Math.max(300,Math.min(660,110+notes.length*66)),height=small?158:196;\n const svg=el('svg',{viewBox:`0 0 ${width} ${height}`,class:'mf-staff',role:'img','aria-label':answerLabel||viz.t('staff_description')});\n const line=(x1,y1,x2,y2,w=1)=>svg.append(el('line',{x1,y1,x2,y2,stroke:'currentColor','stroke-width':w,opacity:.7}));\n for(let i=0;i<5;i++)line(12,bottom-i*gap,width-12,bottom-i*gap);\n glyph(svg,clef,24,clef==='treble'?bottom-gap:bottom-3*gap,gap);\n let left=80;\n if(key==='G'){glyph(svg,'sharp',left,bottom-4*gap,gap);left+=32;}\n if(meter){const [n,d]=meter.split('/');for(const [v,y] of [[n,bottom-2.65*gap],[d,bottom-.7*gap]]){const t=el('text',{x:left,y,'font-size':gap*1.9,'font-weight':700,'text-anchor':'middle',fill:'currentColor'});t.textContent=v;svg.append(t);}left+=30;}\n const base=clef==='treble'?30:18,positions=[];\n notes.forEach((n,i)=>{\n const x=left+(i+.5)*(width-24-left)/Math.max(1,notes.length),group=el('g',{'data-note-index':i});svg.append(group);positions.push(x);\n if(n.blank){group.append(el('rect',{x:x-11,y:bottom-2*gap-13,width:22,height:26,fill:'var(--paper)',stroke:'currentColor','stroke-dasharray':'3 2'}));}\n else if(n.rest){glyph(group,({4:'wholeRest',2:'halfRest',1:'quarterRest','0.5':'eighthRest'})[n.value]||'quarterRest',x-6,bottom-(n.value===4?3:2)*gap,gap);}\n else{\n const pitches=n.chord||[n.pitch];\n for(const pitch of pitches){const p=parse(pitch),pos=p.step-base,y=bottom-pos*gap/2;\n for(let k=-2;k>=pos;k-=2)line(x-14,bottom-k*gap/2,x+14,bottom-k*gap/2,1.4);\n for(let k=10;k<=pos;k+=2)line(x-14,bottom-k*gap/2,x+14,bottom-k*gap/2,1.4);\n glyph(group,n.value===4?'whole':n.value===2?'half':'black',x-gap*.59,y,gap);\n if(p.sign)glyph(group,p.sign==='♯'?'sharp':p.sign==='♭'?'flat':'natural',x-gap*1.7,y,gap);\n if(n.dot)group.append(el('circle',{cx:x+gap*.95,cy:y-(pos%2===0?gap/2:0),r:gap*.13,fill:'currentColor'}));\n }\n const ps=pitches.map(parse).map(p=>p.step-base),highest=Math.max(...ps),lowest=Math.min(...ps),down=(highest+lowest)/2>=4;\n if(n.value!==4){const stemx=x+(down?-gap*.55:gap*.55),from=bottom-(down?highest:lowest)*gap/2,to=bottom-(down?lowest:highest)*gap/2+(down?gap*3.5:-gap*3.5);group.append(el('line',{x1:stemx,x2:stemx,y1:from,y2:to,stroke:'currentColor','stroke-width':1.5}));\n if(n.value===.5){glyph(group,down?'flagDown':'flag',stemx,to,gap);}\n }\n }\n if(labels){const text=el('text',{x,y:height-15,'font-size':14,'text-anchor':'middle',fill:'currentColor'});text.textContent=n.rest?viz.t('rest'):(n.chord||[n.pitch]).join(' ');svg.append(text);}\n if(n.barAfter||barEnds.includes(i))line(x+(width-24-left)/notes.length*.48,bottom,x+(width-24-left)/notes.length*.48,bottom-4*gap,1.5);\n });\n for(let i=0;i<notes.length-1;i++)if(notes[i].tie){const x=positions[i],x2=positions[i+1],pos=parse(notes[i].pitch).step-base,direction=pos>=4?-1:1,y=bottom-pos*gap/2+direction*gap;svg.append(el('path',{d:`M ${x} ${y} Q ${(x+x2)/2} ${y+direction*gap} ${x2} ${y}`,fill:'none',stroke:'currentColor','stroke-width':1.5}));}\n line(width-12,bottom,width-12,bottom-4*gap,1.5);return svg;\n }\n function score(notes,bpm=90){let beat=0;const events=[];notes.forEach(n=>{const length=n.value*(n.dot?1.5:1);if(!n.rest){if(n.continueTie){const last=events[events.length-1];last.duration+=length*60/bpm;}else for(const p of n.chord||[n.pitch])events.push({beat,hz:440*2**((parse(p).midi-69)/12),duration:length*60/bpm*.94,gain:.8,wave:'triangle',hold:true});}beat+=length;});return {bpm,beats:beat,events};}\n return {render,parse,fromStep,fromMidi,score};\n})();\n\nconst PRACTICE = {\"kind\": \"symbols\"};\nconst $=s=>document.querySelector(s),t=viz.t;\nfunction make(tag,attrs={},text=''){const e=document.createElement(tag);for(const [k,v]of Object.entries(attrs))e.setAttribute(k,v);e.textContent=text;return e;}\nfunction button(parent,key,fn,attrs={}){const b=make('button',{type:'button',...attrs},t(key));b.onclick=fn;parent.append(b);return b;}\nfunction select(parent,key,items,fn,id){const label=make('label',{},t(key)),s=make('select',{id});for(const [value,k]of items)s.append(make('option',{value},t(k)));s.onchange=()=>{player.stop();fn(s.value);};label.append(s);parent.append(label);return s;}\nlet tickAction=()=>{},currentScore=null;\nconst player=viz.audio({onState(s){document.body.dataset.audioState=s;$('#status').textContent=t(s==='idle'?'idle':s==='starting'?'starting':'playing');$('#stop').disabled=s==='idle';},onTick:b=>tickAction(b),onError:()=>$('#status').textContent=t('error')});\n$('#stop').onclick=()=>player.stop();$('#volume').oninput=e=>player.setVolume(+e.target.value/100);\n$('#play').onclick=()=>{if(currentScore)player.play(currentScore);};document.body.dataset.audioState='idle';\nconst controls=$('#controls'),answers=$('#answers'),feedback=$('#feedback'),sheet=$('#sheet'),meta=$('#meta');\nconst staff=(notes,extra={})=>{sheet.replaceChildren(MusicStaff.render({notes,...extra}));};\nconst note=pitch=>({pitch,value:1});\nfunction highlight(beat,notes){let at=0;for(const [i,n]of notes.entries()){const end=at+n.value*(n.dot?1.5:1);const g=sheet.querySelector(`[data-note-index=\"${i}\"]`);g?.setAttribute('data-current',String(beat>=at&&beat<end));at=end;}}\nconst shuffle=a=>{a=[...a];for(let i=a.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[a[i],a[j]]=[a[j],a[i]];}return a;};\nif(PRACTICE.kind==='map'){\n let clef='treble',step=32,alter=0;\n select(controls,'clef',[['treble','treble'],['bass','bass']],v=>{clef=v;step=v==='treble'?32:24;draw();},'clef');\n const row=make('div',{class:'mf-controls'});controls.append(row);\n button(row,'down',()=>{player.stop();step=Math.max(clef==='treble'?28:16,step-1);draw();},{id:'pitch-down'});\n button(row,'up',()=>{player.stop();step=Math.min(clef==='treble'?39:28,step+1);draw();},{id:'pitch-up'});\n select(controls,'accidental',[['0','natural'],['1','sharp'],['-1','flat']],v=>{alter=+v;draw();},'accidental');\n function draw(){const pitch=MusicStaff.fromStep(step,alter),notes=[note(pitch)];staff(notes,{clef,labels:true});feedback.textContent=pitch+' · '+t('position')+' '+(step-(clef==='treble'?30:18));meta.textContent=t('anchor_'+clef)+(step<(clef==='treble'?30:18)||step>(clef==='treble'?38:26)?' '+t('ledger'):'');currentScore=MusicStaff.score(notes);tickAction=b=>highlight(b,notes);}\n draw();\n}else if(['pitchQuiz','rhythmQuiz','keyQuiz'].includes(PRACTICE.kind)){\n let clefMode='treble',altered=false,deck=[],index=0,choice=null,answered=false,usedHint=false,assisted=0,correct=0;\n const stats=make('p',{class:'mf-meta mf-score',id:'round-score'});controls.append(stats);\n if(PRACTICE.kind==='pitchQuiz'){\n select(controls,'clef',[['treble','treble'],['bass','bass'],['mixed','mixed']],v=>{clefMode=v;start();},'clef');\n select(controls,'difficulty',[['plain','plain'],['altered','altered']],v=>{altered=v==='altered';start();},'difficulty');\n }\n const action=make('div',{class:'mf-actions'});$('#quiz-actions').append(action);\n const check=button(action,'check',()=>finish(false),{id:'check',disabled:''});\n const hint=button(action,'hint',()=>{if(!answered)usedHint=true;meta.textContent=hintText();},{id:'hint'});\n const reveal=button(action,'reveal',()=>finish(true),{id:'reveal'});\n const next=button(action,'next',()=>{if(index<deck.length-1){index++;draw();}else{feedback.textContent=t('finished');next.disabled=true;}},{id:'next',disabled:''});\n button(action,'restart',start,{id:'restart'});\n function bank(){\n if(PRACTICE.kind==='pitchQuiz'){\n const clefs=clefMode==='mixed'?['treble','bass']:[clefMode],qs=[];\n for(const clef of clefs)for(let step=clef==='treble'?28:16;step<=(clef==='treble'?39:28);step++){const alter=altered?[0,1,-1][Math.floor(Math.random()*3)]:0,pitch=MusicStaff.fromStep(step,alter);qs.push({clef,step,pitch,answer:pitch,notes:[note(pitch)]});}\n return shuffle(qs).slice(0,12);\n }\n if(PRACTICE.kind==='rhythmQuiz')return shuffle([\n ['4/4',[note('C5'),{rest:true,value:1},{pitch:'C5',value:.5},{pitch:'C5',value:.5}],1],\n ['3/4',[note('C5'),note('C5')],1],['4/4',[{pitch:'C5',value:2},note('C5')],1],\n ['3/4',[{pitch:'C5',value:1,dot:true},{pitch:'C5',value:.5}],1],\n ['4/4',[{rest:true,value:2}],2],['6/8',[{pitch:'C5',value:1,dot:true},note('C5')],.5],\n ['6/8',[{pitch:'C5',value:.5},{rest:true,value:.5},note('C5')],1],\n ['4/4',[{pitch:'C5',value:1,dot:true},note('C5')],1.5],['3/4',[note('C5')],2],\n ['4/4',[{rest:true,value:1}],3],['3/4',[{rest:true,value:.5},note('C5')],1.5],['6/8',[{pitch:'C5',value:.5},{pitch:'C5',value:.5}],2]\n ].map(([meter,notes,missing])=>({meter,notes,missing,answer:String(missing),clef:'treble'})));\n return shuffle([\n {notes:[{pitch:'F4',value:4}],target:0,answer:'F♯4',sounds:['F♯4']},\n {notes:[note('F♮4'),note('F4'),note('G4'),note('A4')],target:1,answer:'F4',sounds:['F4','F4','G4','A4']},\n {notes:[{pitch:'F♮4',value:4,barAfter:true},{pitch:'F4',value:4}],target:1,answer:'F♯4',sounds:['F4','F♯4']},\n {notes:[{pitch:'F5',value:4}],target:0,answer:'F♯5',sounds:['F♯5']}\n ].map(q=>({...q,clef:'treble',key:'G',meter:'4/4'})));\n }\n function start(){player.stop();deck=bank();index=0;correct=0;assisted=0;draw();}\n function hintText(){const q=deck[index];if(PRACTICE.kind==='pitchQuiz')return t('anchor_'+q.clef)+' '+t('position')+' '+(q.step-(q.clef==='treble'?30:18));return t(PRACTICE.kind==='keyQuiz'?'key_hint':'bar_hint');}\n function draw(){player.stop();choice=null;answered=false;usedHint=false;check.disabled=true;next.disabled=true;reveal.disabled=false;hint.disabled=false;$('#play').disabled=PRACTICE.kind!=='pitchQuiz';feedback.textContent=t(PRACTICE.kind==='pitchQuiz'?'before':'before_check');meta.textContent=t(PRACTICE.kind==='pitchQuiz'?'question':PRACTICE.kind==='keyQuiz'?'key_prompt':'bar_prompt');answers.replaceChildren();\n const q=deck[index];let choices;\n if(PRACTICE.kind==='pitchQuiz'){const offsets=shuffle([-2,-1,1,2]).slice(0,2),accOther=MusicStaff.parse(q.pitch).alter===0?1:0;choices=shuffle([q.answer,...offsets.map(d=>MusicStaff.fromStep(q.step+d,MusicStaff.parse(q.pitch).alter)),MusicStaff.fromStep(q.step,accOther)]);staff(q.notes,{clef:q.clef});currentScore=MusicStaff.score(q.notes);}\n else if(PRACTICE.kind==='rhythmQuiz'){staff([...q.notes,{blank:true,value:q.missing}],{meter:q.meter});choices=['0.5','1','1.5','2','3','4'];currentScore=null;}\n else{staff(q.notes,{meter:q.meter,key:'G'});sheet.querySelector(`[data-note-index=\"${q.target}\"]`)?.setAttribute('data-current','true');meta.textContent+=' '+t('target_note')+' '+(q.target+1);choices=['F4','F♯4','F5','F♯5'];currentScore=MusicStaff.score(q.notes.map((n,i)=>({...n,pitch:q.sounds[i]})));}\n for(const c of choices){const b=make('button',{type:'button','data-answer':c,'aria-pressed':'false'},c==='0.5'?'½':c==='1.5'?'1½':c);b.onclick=()=>{if(answered)return;choice=c;check.disabled=false;[...answers.children].forEach(x=>x.setAttribute('aria-pressed',String(x===b)));};answers.append(b);}\n updateStats();tickAction=b=>highlight(b,q.notes);\n }\n function updateStats(){stats.textContent=t('round')+' '+(index+1)+' / '+deck.length+' · '+t('first_try')+' '+correct+' · '+t('assisted')+' '+assisted;}\n function finish(explicit){if(answered||(!explicit&&choice===null))return;player.stop();answered=true;if(explicit)usedHint=true;if(usedHint)assisted++;if(!usedHint&&choice===deck[index].answer)correct++;const q=deck[index];feedback.textContent=(explicit?'':t(choice===q.answer?'correct':'wrong')+' ')+t('answer')+' '+q.answer+'. '+hintText();\n if(PRACTICE.kind==='rhythmQuiz'){const missing=q.missing===3?{pitch:'C5',value:2,dot:true}:q.missing===1.5?{pitch:'C5',value:1,dot:true}:{pitch:'C5',value:q.missing};const ns=[...q.notes,missing];staff(ns,{meter:q.meter});currentScore=MusicStaff.score(ns);const sum=q.notes.reduce((a,n)=>a+n.value*(n.dot?1.5:1),0);feedback.textContent+=' '+t('bar_total')+' '+(sum+q.missing)+' − '+t('written')+' '+sum+' = '+q.missing;tickAction=b=>highlight(b,ns);}\n else if(PRACTICE.kind==='pitchQuiz')staff(q.notes,{clef:q.clef,labels:true});\n $('#play').disabled=false;check.disabled=true;reveal.disabled=true;hint.disabled=true;next.disabled=false;[...answers.children].forEach(b=>b.disabled=true);updateStats();}\n start();\n}else if(PRACTICE.kind==='symbols'){\n const kinds=[['whole',4,false,false],['half',2,false,false],['quarter',1,false,false],['eighth',.5,false,false],['dotted',1,false,true],['whole_rest',4,true,false],['half_rest',2,true,false],['quarter_rest',1,true,false],['eighth_rest',.5,true,false]];\n for(const [label,value,rest,dot] of kinds)button(controls,label,()=>draw(label,{pitch:'C5',value,rest,dot}));\n for(const tied of [true,false])button(controls,tied?'tied':'untied',()=>draw(tied?'tied':'untied',[{pitch:'C5',value:1,tie:tied},{pitch:'C5',value:1,continueTie:tied}]));\n function draw(label,n){player.stop();const notes=Array.isArray(n)?n:[n];staff(notes);feedback.textContent=t(label);meta.textContent=t('unit');const score=MusicStaff.score(notes);score.beats=4;for(let i=0;i<4;i++)score.events.push({beat:i,hz:1500,duration:.035,gain:.25});currentScore=score;tickAction=b=>highlight(b,notes);}\n draw('quarter',{pitch:'C5',value:1});\n}else if(PRACTICE.kind==='chord'){\n let root='C4',quality='major',inv=0;\n select(controls,'root',[['C4','C'],['D4','D'],['F4','F']],v=>{root=v;draw();},'root');\n select(controls,'quality',[['major','major'],['minor','minor']],v=>{quality=v;draw();},'quality');\n select(controls,'inversion',[['0','root_position'],['1','first_inversion'],['2','second_inversion']],v=>{inv=+v;draw();},'inversion');\n function draw(){const p=MusicStaff.parse(root),intervals=[0,quality==='major'?4:3,7],pitches=intervals.map((v,i)=>{const step=p.step+i*2,plain=MusicStaff.parse(MusicStaff.fromStep(step));return MusicStaff.fromStep(step,p.midi+v-plain.midi);});for(let i=0;i<inv;i++){const p=MusicStaff.parse(pitches.shift());pitches.push(MusicStaff.fromStep(p.step+7,p.alter));}const ns=[{chord:pitches,value:2}];staff(ns,{labels:false});feedback.textContent=t('root')+': '+root+' · '+t('quality')+': '+t(quality)+' · '+pitches.join(' – ');meta.textContent=t('chord_tip');currentScore=MusicStaff.score(ns);tickAction=b=>highlight(b,ns);}\n draw();\n}else if(PRACTICE.kind==='form'){\n const initial=PRACTICE.bars===8?['A','A','B','A','A','A′','B','A']:['A','A','B','A'];let order=[...initial],selected=0,melodyOnly=false;\n const material={A:['E4','G4','A4','G4'],'A′':['E4','G4','A4','C5'],B:['C5','B4','G4','D4']};\n const queue=make('div',{class:'mf-queue',id:'bar-queue'});controls.append(queue);\n const sel=select(controls,'material',[['A','A'],['A′','A′'],['B','B']],v=>{order[selected]=v;draw();},'material');\n const label=make('label'),box=make('input',{type:'checkbox',id:'melody-only'});label.append(box,make('span',{},t('melody_only')));controls.append(label);box.onchange=()=>{player.stop();melodyOnly=box.checked;draw();};\n button(controls,'reset',()=>{player.stop();order=[...initial];selected=0;draw();},{id:'reset'});\n button($('#quiz-actions'),'one_bar',()=>play(false),{id:'play-bar'});$('#play').textContent=t('full');$('#play').onclick=()=>play(true);\n function getScore(sequence){const s={bpm:100,beats:sequence.length*4,events:[]};sequence.forEach((name,bar)=>{const ns=material[name].map(note),m=MusicStaff.score(ns,100);s.events.push(...m.events.map(e=>({...e,beat:e.beat+bar*4})));if(!melodyOnly)for(const beat of [0,2])for(const midi of [36,48,52,55])s.events.push({beat:bar*4+beat,hz:440*2**((midi-69)/12),duration:.95,gain:midi===36?.65:.35,wave:'triangle'});});return s;}\n function draw(){queue.replaceChildren();order.forEach((m,i)=>{const b=make('button',{type:'button','data-bar':i,'aria-pressed':String(i===selected)},(i+1)+' · '+m);b.onclick=()=>{player.stop();selected=i;draw();};queue.append(b);});sel.value=order[selected];staff(material[order[selected]].map(note),{meter:'4/4'});feedback.textContent=order.join(' · ');meta.textContent=t('arrange_tip');}\n function play(all){const start=selected,sequence=all?order:[order[selected]];tickAction=beat=>{if(beat<0){highlight(-1,material[order[selected]].map(note));return;}const b=all?Math.min(order.length-1,Math.floor(beat/4)):start;if(b!==selected){selected=b;draw();}highlight(beat%4,material[order[selected]].map(note));};player.play(getScore(sequence));}\n draw();\n}\n","audio":true,"strings":{"accidental":"Accidental","altered":"Include accidentals","anchor_bass":"Anchor: the fourth line from the bottom, between the two dots, is F3.","anchor_treble":"Anchor: the second line from the bottom is G4. Move one letter for each neighboring line or space.","answer":"Answer:","arrange_tip":"Select a bar, replace its material, then listen. The staff shows that bar; during full playback it follows the current bar.","assisted":"Assisted questions","bar":"Bar","bar_hint":"First convert the time signature to quarter-note units. Add the written values, then subtract from the bar total.","bar_prompt":"Complete this bar. The box is the missing duration; choose its value in quarter-note beats.","bar_total":"Bar total","bass":"Bass clef","before":"Make your choice, then check the explanation.","before_check":"Choose an answer before checking or revealing the explanation.","check":"Check my answer","choose_p":"P is transposed","choose_q":"Q is transposed","chord_tip":"Read the stack from bottom to top. The root label stays fixed when you change the inversion.","clef":"Clef","compare_title":"Commit to an answer before revealing the diagram","comparison_correct":"P keeps every interval; Q changes one internal pitch. Compare the revealed distances.","correct":"Correct.","difficulty":"Pitch set","dotted":"Dotted quarter · 1½","down":"One staff position down","eighth":"Eighth note · ½","eighth_rest":"Eighth rest · ½","error":"Audio could not start. Retry or use the written explanation.","finished":"Round complete. Review the last explanation or start a new round.","first_inversion":"First inversion","first_try":"First-try correct","flat":"Flat ♭","full":"Play whole arrangement","half":"Half note · 2","half_rest":"Half rest · 2","heading":"Read a duration, then hear it","hint":"Show position hint","idle":"Sound starts only when you press Play. Edits stop playback.","intro":"Compare whole, half, quarter, eighth, and dotted-quarter notes with their rests. A soft quarter-note pulse is the reference.","inversion":"Bass position","key_hint":"One sharp in the key signature means every F is sharp unless a local accidental changes it. A barline resets local accidentals, not the key signature.","key_prompt":"Read the highlighted note using the key signature and any local accidental.","ledger":"A short ledger line extends the staff. It is counted just like a normal staff line.","major":"Major","material":"Material for selected bar","melody_only":"Melody only","minor":"Minor","missing":"Missing","mixed":"Mixed clefs","natural":"Natural ♮","next":"Next question","one_bar":"Play selected bar","plain":"Natural notes","play":"Play","playing":"Playing…","position":"Steps above the bottom line (each line-to-space move = 1):","pulse":"Reference pulse","quality":"Quality","quarter":"Quarter note · 1","quarter_rest":"Quarter rest · 1","question":"Read the note, including its octave and accidental. Choose an answer before checking.","reset":"Restore starting arrangement","rest":"rest","restart":"New round","reveal":"Reveal explanation","root":"Root","root_position":"Root position","round":"Round","second_inversion":"Second inversion","sharp":"Sharp ♯","staff_description":"Five-line music staff. Use the position description if you cannot see the notation.","starting":"Preparing audio…","stop":"Stop","symbols":"Note and rest values","target_note":"Read note","tied":"Two tied quarters · 2","treble":"Treble clef","unit":"Symbol excerpt, not a complete bar. Values use quarter-note units. Each audition lasts four beats; a soft pulse continues through rests.","untied":"Two separate quarters · 1 + 1","up":"One staff position up","volume":"Volume","whole":"Whole note · 4","whole_rest":"Whole rest · 4 here","written":"Already written","wrong":"Not yet. Compare your choice with the explanation."}}
A half rest sits on a line; a whole rest hangs below a line. The whole-rest symbol also commonly represents an entire silent bar even when that bar is not four quarter-note units long. Our symbol demonstration uses 4/4, where these meanings coincide. Do not transfer “whole rest equals four beats” unconditionally to every meter.
The synthesized sustained tone makes the duration easier to follow. Real instruments may naturally decay while a written note remains active, and performers shape releases. Notation gives the intended temporal organization, rather than a recording of the waveform.
Dots and ties extend time in different ways
A dot adds half the original value . A dotted half is 2 + 1 = 3 quarter-note units; a dotted quarter is 1 + ½ = 1½. The dot sits after the notehead. It is not another attack.
A tie connects two notes of the same pitch. Add their values and sustain through the join without striking again. Two tied quarters last two quarter-note units, like a half note. A tie can cross a barline; the barline does not create a new attack. A slur over different pitches is a different instruction and does not merge them into one pitch. Dots and ties
Try counting two quarters twice: first say “ta, ta,” then say one “taa” while counting through both beats. The time span matches; the number of onsets differs.
Use the “Two tied quarters” and “Two separate quarters” buttons in the duration player above to compare one sustained onset with two attacks.
Complete a bar from the notation
In 4/4, an ordinary complete bar totals four quarter-note units; in 3/4, three. In 6/8, it totals six eighths, equivalent to three quarter-note units. As the meter lesson showed, 6/8 is normally felt as two dotted-quarter beats. Adding durations and identifying the felt beat are different tasks.
Read the notes and rests below. The dashed box is a missing duration. Select its value in quarter-note units, check it, then listen to the completed bar.
Preparing the visual Try again
Complete the bar from notation These questions use quarter-note units even in 6/8, where a bar totals three quarter-note units but usually has two dotted-quarter beats. Answers stay hidden until checking or an explicit reveal.
{"id":"music-rhythm-fill","title":"Complete the bar from notation","summary":"These questions use quarter-note units even in 6/8, where a bar totals three quarter-note units but usually has two dotted-quarter beats. Answers stay hidden until checking or an explicit reveal.","height":800,"html":"<h2 data-i18n=\"heading\"></h2><p class=\"mf-intro\" data-i18n=\"intro\"></p>\n<div id=\"controls\" class=\"mf-controls\"></div><div id=\"sheet\"></div><p id=\"meta\" class=\"mf-meta\"></p>\n<div id=\"answers\" class=\"mf-answers\" role=\"group\" data-i18n-label=\"question\"></div><div id=\"quiz-actions\" class=\"mf-actions\"></div>\n<p id=\"feedback\" class=\"mf-feedback\" role=\"status\" aria-live=\"polite\"></p>\n<div class=\"mf-actions\"><button id=\"play\" data-i18n=\"play\"></button><button id=\"stop\" data-i18n=\"stop\" disabled></button></div><p id=\"status\" class=\"mf-meta\" role=\"status\" data-i18n=\"idle\"></p>\n<label class=\"mf-volume\"><span data-i18n=\"volume\"></span><input id=\"volume\" type=\"range\" min=\"0\" max=\"100\" value=\"65\"></label>\n","css":"body{padding:24px}h2{font-size:22px;line-height:1.4}p{line-height:1.75}.mf-intro{color:var(--muted);margin:10px 0 18px}.mf-staff{display:block;width:100%;height:auto;max-height:270px;color:var(--ink);background:var(--surface);border:1px solid var(--rule);border-radius:8px;margin:16px 0}.mf-controls,.mf-actions,.mf-answers{display:flex;flex-wrap:wrap;gap:8px;margin:14px 0}button,select{min-height:46px;font-size:16px}button{white-space:normal;line-height:1.5}.mf-controls button,.mf-answers button{flex:1 1 64px}.mf-actions button{flex:1 1 110px}label{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:16px;margin:12px 0}select{max-width:100%;background:var(--paper);color:var(--ink);border:1px solid var(--rule);padding:8px;border-radius:6px}.mf-feedback{border-left:3px solid var(--accent);padding:12px;background:var(--surface);min-height:3.5em;margin:14px 0;font-size:16px}.mf-meta{font-size:14px;color:var(--muted);margin:10px 0}.mf-staff [data-current=true]{color:var(--accent);filter:drop-shadow(0 0 1px currentColor)}.mf-staff [data-current=true] path{fill:currentColor}.mf-queue{display:flex;flex-wrap:wrap;gap:8px}.mf-queue button{min-width:50px}.mf-queue button[aria-pressed=true]{border-color:var(--accent);background:var(--accent-soft)}.mf-score{font-variant-numeric:tabular-nums}.mf-volume{display:flex;gap:12px;align-items:center;font-size:14px;border-top:1px solid var(--rule);padding-top:12px}.mf-volume input{min-width:80px;max-width:180px}.mf-answer-note{color:var(--muted);font-size:14px}button[aria-pressed=true]{background:var(--accent-soft);border-color:var(--accent)}[hidden]{display:none!important}@media(max-width:420px){body{padding:20px 14px}h2{font-size:20px}.mf-controls button{flex-basis:75px}}\n\n.mf-answers button{border:1px solid var(--rule);background:var(--surface);border-radius:8px;min-height:52px;padding:10px 14px;cursor:pointer}.mf-answers button:not(:disabled):hover{border-color:var(--accent);background:var(--accent-soft)}.mf-answers button:focus-visible{outline:2px solid var(--accent);outline-offset:3px}.mf-answers button[aria-pressed=true]{border:2px solid var(--accent);background:var(--accent-soft);font-weight:600}.mf-answers button:disabled{cursor:default}\n","js":"const GLYPHS = {\"treble\":\"M376 415C374 427 376 428 382 434C398 449 419 470 438 491C522 583 572 702 572 815C572 902 548 988 507 1048C492 1070 466 1098 455 1098C441 1098 410 1072 390 1050C316 968 292 843 292 739C292 681 299 616 306 575C308 563 309 561 297 551C233 498 164 437 112 373C43 287 0 194 0 87C0 -87 119 -252 364 -252C387 -252 413 -250 433 -246C444 -244 446 -243 448 -255C460 -322 475 -409 475 -456C475 -604 375 -622 316 -622C262 -622 236 -606 236 -593C236 -586 245 -583 268 -576C299 -567 335 -540 335 -482C335 -427 300 -380 239 -380C172 -380 132 -433 132 -495C132 -560 171 -658 322 -658C389 -658 519 -628 519 -458C519 -401 501 -306 490 -244C488 -232 489 -233 503 -227C604 -187 671 -102 671 11C671 139 577 252 430 252C404 252 404 252 401 270ZM470 943C503 943 530 916 530 861C530 792 497 728 419 650C403 634 379 611 356 591C349 585 345 586 343 599C339 625 337 659 337 691C337 847 409 943 470 943ZM361 262C364 243 364 244 346 238C258 208 201 129 201 44C201 -46 248 -110 316 -133C324 -136 336 -139 343 -139C351 -139 355 -134 355 -128C355 -121 347 -118 340 -115C298 -97 268 -54 268 -8C268 49 307 92 368 109C384 113 386 112 388 101L438 -197C440 -208 439 -208 424 -211C408 -214 388 -216 368 -216C193 -216 80 -119 80 20C80 79 90 158 173 252C233 319 279 356 326 394C336 402 338 401 340 390ZM430 103C428 115 429 118 441 117C522 110 589 42 589 -46C589 -109 551 -160 495 -188C483 -194 481 -194 479 -182Z\",\"bass\":\"M252 262C78 262 0 135 0 39C0 -41 42 -110 123 -110C186 -110 229 -66 229 -4C229 60 182 100 133 100C106 100 96 93 83 93C70 93 67 101 67 111C67 151 127 224 229 224C335 224 381 120 381 -37C381 -140 359 -260 297 -356C237 -449 134 -534 10 -605C1 -610 -5 -615 -5 -623C-5 -629 -1 -635 8 -635C13 -635 19 -633 25 -630C158 -565 286 -489 392 -375C479 -281 531 -159 531 -28C531 146 425 262 252 262ZM629 180C598 180 574 156 574 125C574 94 598 70 629 70C660 70 684 94 684 125C684 156 660 180 629 180ZM630 -71C599 -71 576 -94 576 -125C576 -156 599 -179 630 -179C661 -179 684 -156 684 -125C684 -94 661 -71 630 -71Z\",\"black\":\"M97 -125C186 -125 295 -43 295 42C295 93 255 125 198 125C88 125 0 44 0 -42C0 -94 43 -125 97 -125Z\",\"half\":\"M97 -125C262 -125 295 9 295 42C295 93 254 125 196 125C47 125 0 10 0 -42C0 -95 42 -125 97 -125ZM173 -46C128 -76 97 -87 75 -87C54 -87 42 -76 35 -64C32 -58 29 -51 29 -44C29 -22 51 5 120 45C170 74 201 84 221 84C240 84 251 75 258 63C261 57 264 51 264 44C264 24 243 0 173 -46Z\",\"whole\":\"M216 125C83 125 0 70 0 2C0 -65 57 -125 206 -125C370 -125 422 -68 422 2C422 73 309 125 216 125ZM111 63C122 98 159 103 190 103C259 103 314 29 314 -31C314 -38 313 -44 312 -50C307 -75 293 -92 268 -98C258 -101 247 -102 237 -102C228 -102 220 -101 211 -98C194 -93 178 -84 164 -72C156 -65 149 -58 143 -50C123 -27 108 7 108 39C108 47 109 55 111 63Z\",\"flag\":\"M238 -790C238 -790 264 -695 264 -617C264 -492 212 -374 149 -274C98 -195 56 -109 40 -13C37 3 29 9 19 9C8 9 0 6 0 -6V-245C66 -257 161 -393 197 -478C212 -512 221 -569 221 -628C221 -673 214 -720 197 -765C195 -771 194 -776 194 -780C194 -796 204 -805 210 -809C211 -810 213 -810 215 -810C222 -810 234 -804 238 -790Z\",\"quarterRest\":\"M78 -38C94 -58 108 -77 121 -98C123 -102 127 -110 127 -112C127 -113 127 -115 126 -116C124 -120 120 -121 115 -121C111 -121 103 -119 99 -118C94 -118 88 -115 83 -115C40 -115 1 -158 1 -211C1 -261 44 -310 117 -366C125 -372 135 -375 143 -375C150 -375 157 -373 158 -369C159 -366 160 -364 160 -362C160 -353 152 -345 144 -338C131 -338 120 -311 118 -302C115 -294 114 -285 114 -276C114 -245 129 -210 161 -204C166 -203 171 -203 177 -203C206 -203 239 -214 255 -220C256 -220 257 -221 258 -221C261 -222 263 -222 265 -222C268 -222 270 -221 270 -218C270 -206 244 -173 233 -161C195 -115 164 -78 164 -22C164 -18 165 -13 165 -9C169 49 205 97 231 138C234 143 235 148 235 153C235 163 231 172 231 172C231 172 83 348 66 365C61 370 54 373 48 373C38 373 28 366 28 352C28 347 29 342 32 336C36 325 93 274 93 202C93 165 78 122 33 75C23 65 19 54 19 46C19 32 29 22 29 22Z\",\"eighthRest\":\"M134 107C134 144 104 174 67 174C30 174 0 144 0 107C0 86 12 68 27 56C36 50 45 45 55 43C63 41 72 39 81 39C95 39 109 42 120 46C134 50 143 54 156 61C158 62 160 62 161 62C165 62 166 58 166 53C166 50 166 46 165 42C162 27 90 -172 72 -238C72 -250 95 -251 101 -251C112 -251 126 -249 136 -241C139 -239 237 112 237 112C241 130 246 146 247 151C247 161 237 166 235 167C233 167 230 167 224 163C217 157 167 97 134 97Z\",\"halfRest\":\"M282 24V116C282 131 270 142 256 142H26C11 142 0 131 0 116V24C0 10 11 -2 26 -2H256C270 -2 282 10 282 24Z\",\"wholeRest\":\"M282 -109V-17C282 -2 270 9 256 9H26C11 9 0 -2 0 -17V-109C0 -123 11 -135 26 -135H256C270 -135 282 -123 282 -109Z\",\"sharp\":\"M237 118C244 121 249 129 249 135V206C249 211 246 214 242 214C240 214 239 214 237 213C237 213 217 205 212 204C205 204 198 209 198 217V339C198 345 192 350 184 350C174 350 168 345 168 339V209C167 199 164 186 155 180C143 173 109 159 92 155C83 155 80 167 80 175V295C80 301 73 306 66 306C56 306 50 301 50 295V160C50 146 44 136 38 133C32 130 12 122 12 122C5 120 0 112 0 106V35C0 29 3 26 8 26C9 26 11 27 12 27C12 27 27 33 34 37C35 37 36 38 37 38C44 38 50 28 50 20V-79C50 -90 45 -99 39 -102C33 -104 12 -113 12 -113C5 -115 0 -123 0 -129V-200C0 -206 3 -209 8 -209C9 -209 11 -208 12 -208C12 -208 26 -202 35 -199C36 -198 37 -198 38 -198C45 -198 50 -209 50 -214V-337C50 -343 56 -348 63 -348C73 -348 80 -343 80 -337V-198C80 -185 85 -178 90 -176L151 -151C152 -151 154 -150 155 -150C163 -150 168 -162 168 -168V-293C168 -299 174 -304 181 -304C192 -304 198 -299 198 -293V-151C198 -143 202 -131 209 -128C216 -125 237 -117 237 -117C244 -114 249 -106 249 -100V-29C249 -24 246 -21 242 -21C240 -21 239 -21 237 -22L211 -32C205 -32 198 -26 198 -14V79C198 86 203 105 211 108ZM168 -45C162 -65 115 -85 92 -85C86 -85 81 -83 80 -80C78 -76 77 -54 77 -30C77 1 78 36 80 44C82 61 128 82 153 82C160 82 166 80 168 76C170 71 172 46 172 19C172 -8 170 -36 168 -45Z\",\"flat\":\"M12 -170C15 -174 18 -175 21 -175C24 -175 27 -173 27 -173C57 -156 81 -129 106 -112C195 -50 226 11 226 57C226 114 182 150 136 153C129 153 122 152 115 150C104 147 92 143 81 136C75 131 64 122 59 122C57 122 56 122 54 123C47 126 43 133 43 140C44 162 50 402 50 422C50 433 41 439 31 439C17 439 1 429 0 411C0 411 4 -160 12 -170ZM47 -81C47 -81 44 -21 44 19C44 35 45 47 46 51C50 63 76 85 90 93C99 98 108 100 116 100C126 100 135 96 141 89C151 78 157 61 157 42C157 24 152 3 140 -18C127 -42 98 -74 68 -93C64 -95 61 -96 58 -96C49 -96 47 -86 47 -81Z\",\"natural\":\"M141 181C139 181 138 180 137 180C137 180 73 157 47 157C41 157 37 158 37 162V329C37 336 31 341 25 341H12C5 341 0 336 0 329V-186C0 -192 3 -195 8 -195C9 -195 11 -194 12 -194C12 -194 14 -194 15 -193C29 -187 85 -163 114 -163C124 -163 131 -166 131 -174V-323C131 -330 136 -335 143 -335H156C162 -335 168 -330 168 -323V179C168 184 164 187 160 187C159 187 157 187 156 186ZM37 39C37 53 98 79 122 79C128 79 131 78 131 74V-29C131 -47 74 -70 49 -70C42 -70 37 -68 37 -64Z\",\"flagDown\":\"M240 760C254 718 261 668 261 623C261 564 236 480 221 446C184 362 134 281 0 236V1C0 -9 8 -14 16 -14C25 -14 38 -8 40 8C57 103 131 190 182 269C245 368 306 487 306 612C306 690 286 761 278 793C275 804 269 808 262 808C250 808 237 796 237 777C237 772 238 766 240 760Z\"};\n// Small SVG engraver for the deliberately limited notation taught in this course.\n// Bravura outlines: Steinberg, SIL OFL 1.1; see engraving/OFL.txt.\nconst MusicStaff=(()=>{\n const ns='http://www.w3.org/2000/svg',letters=['C','D','E','F','G','A','B'],pcs=[0,2,4,5,7,9,11];\n const el=(tag,attrs={})=>{const n=document.createElementNS(ns,tag);for(const [k,v] of Object.entries(attrs))n.setAttribute(k,v);return n;};\n const parse=p=>{const m=p.match(/^([A-G])([♯♭♮]?)([0-8])$/);if(!m)throw Error('invalid written pitch');const letter=letters.indexOf(m[1]),oct=+m[3],alter=m[2]==='♯'?1:m[2]==='♭'?-1:0;return {step:oct*7+letter,midi:(oct+1)*12+pcs[letter]+alter,alter,sign:m[2],name:p};};\n const fromStep=(step,alter=0)=>letters[((step%7)+7)%7]+(alter>0?'♯':alter<0?'♭':'')+Math.floor(step/7);\n const fromMidi=(m,flat=false)=>{const names=flat?['C','D♭','D','E♭','E','F','G♭','G','A♭','A','B♭','B']:['C','C♯','D','D♯','E','F','F♯','G','G♯','A','A♯','B'];return names[m%12]+(Math.floor(m/12)-1);};\n function glyph(parent,name,x,y,gap){parent.append(el('path',{d:GLYPHS[name],transform:`translate(${x} ${y}) scale(${gap/250} ${-gap/250})`,fill:'currentColor'}));}\n function render({clef='treble',notes=[],meter=null,key=null,labels=false,small=false,answerLabel='',barEnds=[]}={}){\n const gap=small?12:16,bottom=small?92:114,width=Math.max(300,Math.min(660,110+notes.length*66)),height=small?158:196;\n const svg=el('svg',{viewBox:`0 0 ${width} ${height}`,class:'mf-staff',role:'img','aria-label':answerLabel||viz.t('staff_description')});\n const line=(x1,y1,x2,y2,w=1)=>svg.append(el('line',{x1,y1,x2,y2,stroke:'currentColor','stroke-width':w,opacity:.7}));\n for(let i=0;i<5;i++)line(12,bottom-i*gap,width-12,bottom-i*gap);\n glyph(svg,clef,24,clef==='treble'?bottom-gap:bottom-3*gap,gap);\n let left=80;\n if(key==='G'){glyph(svg,'sharp',left,bottom-4*gap,gap);left+=32;}\n if(meter){const [n,d]=meter.split('/');for(const [v,y] of [[n,bottom-2.65*gap],[d,bottom-.7*gap]]){const t=el('text',{x:left,y,'font-size':gap*1.9,'font-weight':700,'text-anchor':'middle',fill:'currentColor'});t.textContent=v;svg.append(t);}left+=30;}\n const base=clef==='treble'?30:18,positions=[];\n notes.forEach((n,i)=>{\n const x=left+(i+.5)*(width-24-left)/Math.max(1,notes.length),group=el('g',{'data-note-index':i});svg.append(group);positions.push(x);\n if(n.blank){group.append(el('rect',{x:x-11,y:bottom-2*gap-13,width:22,height:26,fill:'var(--paper)',stroke:'currentColor','stroke-dasharray':'3 2'}));}\n else if(n.rest){glyph(group,({4:'wholeRest',2:'halfRest',1:'quarterRest','0.5':'eighthRest'})[n.value]||'quarterRest',x-6,bottom-(n.value===4?3:2)*gap,gap);}\n else{\n const pitches=n.chord||[n.pitch];\n for(const pitch of pitches){const p=parse(pitch),pos=p.step-base,y=bottom-pos*gap/2;\n for(let k=-2;k>=pos;k-=2)line(x-14,bottom-k*gap/2,x+14,bottom-k*gap/2,1.4);\n for(let k=10;k<=pos;k+=2)line(x-14,bottom-k*gap/2,x+14,bottom-k*gap/2,1.4);\n glyph(group,n.value===4?'whole':n.value===2?'half':'black',x-gap*.59,y,gap);\n if(p.sign)glyph(group,p.sign==='♯'?'sharp':p.sign==='♭'?'flat':'natural',x-gap*1.7,y,gap);\n if(n.dot)group.append(el('circle',{cx:x+gap*.95,cy:y-(pos%2===0?gap/2:0),r:gap*.13,fill:'currentColor'}));\n }\n const ps=pitches.map(parse).map(p=>p.step-base),highest=Math.max(...ps),lowest=Math.min(...ps),down=(highest+lowest)/2>=4;\n if(n.value!==4){const stemx=x+(down?-gap*.55:gap*.55),from=bottom-(down?highest:lowest)*gap/2,to=bottom-(down?lowest:highest)*gap/2+(down?gap*3.5:-gap*3.5);group.append(el('line',{x1:stemx,x2:stemx,y1:from,y2:to,stroke:'currentColor','stroke-width':1.5}));\n if(n.value===.5){glyph(group,down?'flagDown':'flag',stemx,to,gap);}\n }\n }\n if(labels){const text=el('text',{x,y:height-15,'font-size':14,'text-anchor':'middle',fill:'currentColor'});text.textContent=n.rest?viz.t('rest'):(n.chord||[n.pitch]).join(' ');svg.append(text);}\n if(n.barAfter||barEnds.includes(i))line(x+(width-24-left)/notes.length*.48,bottom,x+(width-24-left)/notes.length*.48,bottom-4*gap,1.5);\n });\n for(let i=0;i<notes.length-1;i++)if(notes[i].tie){const x=positions[i],x2=positions[i+1],pos=parse(notes[i].pitch).step-base,direction=pos>=4?-1:1,y=bottom-pos*gap/2+direction*gap;svg.append(el('path',{d:`M ${x} ${y} Q ${(x+x2)/2} ${y+direction*gap} ${x2} ${y}`,fill:'none',stroke:'currentColor','stroke-width':1.5}));}\n line(width-12,bottom,width-12,bottom-4*gap,1.5);return svg;\n }\n function score(notes,bpm=90){let beat=0;const events=[];notes.forEach(n=>{const length=n.value*(n.dot?1.5:1);if(!n.rest){if(n.continueTie){const last=events[events.length-1];last.duration+=length*60/bpm;}else for(const p of n.chord||[n.pitch])events.push({beat,hz:440*2**((parse(p).midi-69)/12),duration:length*60/bpm*.94,gain:.8,wave:'triangle',hold:true});}beat+=length;});return {bpm,beats:beat,events};}\n return {render,parse,fromStep,fromMidi,score};\n})();\n\nconst PRACTICE = {\"kind\": \"rhythmQuiz\"};\nconst $=s=>document.querySelector(s),t=viz.t;\nfunction make(tag,attrs={},text=''){const e=document.createElement(tag);for(const [k,v]of Object.entries(attrs))e.setAttribute(k,v);e.textContent=text;return e;}\nfunction button(parent,key,fn,attrs={}){const b=make('button',{type:'button',...attrs},t(key));b.onclick=fn;parent.append(b);return b;}\nfunction select(parent,key,items,fn,id){const label=make('label',{},t(key)),s=make('select',{id});for(const [value,k]of items)s.append(make('option',{value},t(k)));s.onchange=()=>{player.stop();fn(s.value);};label.append(s);parent.append(label);return s;}\nlet tickAction=()=>{},currentScore=null;\nconst player=viz.audio({onState(s){document.body.dataset.audioState=s;$('#status').textContent=t(s==='idle'?'idle':s==='starting'?'starting':'playing');$('#stop').disabled=s==='idle';},onTick:b=>tickAction(b),onError:()=>$('#status').textContent=t('error')});\n$('#stop').onclick=()=>player.stop();$('#volume').oninput=e=>player.setVolume(+e.target.value/100);\n$('#play').onclick=()=>{if(currentScore)player.play(currentScore);};document.body.dataset.audioState='idle';\nconst controls=$('#controls'),answers=$('#answers'),feedback=$('#feedback'),sheet=$('#sheet'),meta=$('#meta');\nconst staff=(notes,extra={})=>{sheet.replaceChildren(MusicStaff.render({notes,...extra}));};\nconst note=pitch=>({pitch,value:1});\nfunction highlight(beat,notes){let at=0;for(const [i,n]of notes.entries()){const end=at+n.value*(n.dot?1.5:1);const g=sheet.querySelector(`[data-note-index=\"${i}\"]`);g?.setAttribute('data-current',String(beat>=at&&beat<end));at=end;}}\nconst shuffle=a=>{a=[...a];for(let i=a.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[a[i],a[j]]=[a[j],a[i]];}return a;};\nif(PRACTICE.kind==='map'){\n let clef='treble',step=32,alter=0;\n select(controls,'clef',[['treble','treble'],['bass','bass']],v=>{clef=v;step=v==='treble'?32:24;draw();},'clef');\n const row=make('div',{class:'mf-controls'});controls.append(row);\n button(row,'down',()=>{player.stop();step=Math.max(clef==='treble'?28:16,step-1);draw();},{id:'pitch-down'});\n button(row,'up',()=>{player.stop();step=Math.min(clef==='treble'?39:28,step+1);draw();},{id:'pitch-up'});\n select(controls,'accidental',[['0','natural'],['1','sharp'],['-1','flat']],v=>{alter=+v;draw();},'accidental');\n function draw(){const pitch=MusicStaff.fromStep(step,alter),notes=[note(pitch)];staff(notes,{clef,labels:true});feedback.textContent=pitch+' · '+t('position')+' '+(step-(clef==='treble'?30:18));meta.textContent=t('anchor_'+clef)+(step<(clef==='treble'?30:18)||step>(clef==='treble'?38:26)?' '+t('ledger'):'');currentScore=MusicStaff.score(notes);tickAction=b=>highlight(b,notes);}\n draw();\n}else if(['pitchQuiz','rhythmQuiz','keyQuiz'].includes(PRACTICE.kind)){\n let clefMode='treble',altered=false,deck=[],index=0,choice=null,answered=false,usedHint=false,assisted=0,correct=0;\n const stats=make('p',{class:'mf-meta mf-score',id:'round-score'});controls.append(stats);\n if(PRACTICE.kind==='pitchQuiz'){\n select(controls,'clef',[['treble','treble'],['bass','bass'],['mixed','mixed']],v=>{clefMode=v;start();},'clef');\n select(controls,'difficulty',[['plain','plain'],['altered','altered']],v=>{altered=v==='altered';start();},'difficulty');\n }\n const action=make('div',{class:'mf-actions'});$('#quiz-actions').append(action);\n const check=button(action,'check',()=>finish(false),{id:'check',disabled:''});\n const hint=button(action,'hint',()=>{if(!answered)usedHint=true;meta.textContent=hintText();},{id:'hint'});\n const reveal=button(action,'reveal',()=>finish(true),{id:'reveal'});\n const next=button(action,'next',()=>{if(index<deck.length-1){index++;draw();}else{feedback.textContent=t('finished');next.disabled=true;}},{id:'next',disabled:''});\n button(action,'restart',start,{id:'restart'});\n function bank(){\n if(PRACTICE.kind==='pitchQuiz'){\n const clefs=clefMode==='mixed'?['treble','bass']:[clefMode],qs=[];\n for(const clef of clefs)for(let step=clef==='treble'?28:16;step<=(clef==='treble'?39:28);step++){const alter=altered?[0,1,-1][Math.floor(Math.random()*3)]:0,pitch=MusicStaff.fromStep(step,alter);qs.push({clef,step,pitch,answer:pitch,notes:[note(pitch)]});}\n return shuffle(qs).slice(0,12);\n }\n if(PRACTICE.kind==='rhythmQuiz')return shuffle([\n ['4/4',[note('C5'),{rest:true,value:1},{pitch:'C5',value:.5},{pitch:'C5',value:.5}],1],\n ['3/4',[note('C5'),note('C5')],1],['4/4',[{pitch:'C5',value:2},note('C5')],1],\n ['3/4',[{pitch:'C5',value:1,dot:true},{pitch:'C5',value:.5}],1],\n ['4/4',[{rest:true,value:2}],2],['6/8',[{pitch:'C5',value:1,dot:true},note('C5')],.5],\n ['6/8',[{pitch:'C5',value:.5},{rest:true,value:.5},note('C5')],1],\n ['4/4',[{pitch:'C5',value:1,dot:true},note('C5')],1.5],['3/4',[note('C5')],2],\n ['4/4',[{rest:true,value:1}],3],['3/4',[{rest:true,value:.5},note('C5')],1.5],['6/8',[{pitch:'C5',value:.5},{pitch:'C5',value:.5}],2]\n ].map(([meter,notes,missing])=>({meter,notes,missing,answer:String(missing),clef:'treble'})));\n return shuffle([\n {notes:[{pitch:'F4',value:4}],target:0,answer:'F♯4',sounds:['F♯4']},\n {notes:[note('F♮4'),note('F4'),note('G4'),note('A4')],target:1,answer:'F4',sounds:['F4','F4','G4','A4']},\n {notes:[{pitch:'F♮4',value:4,barAfter:true},{pitch:'F4',value:4}],target:1,answer:'F♯4',sounds:['F4','F♯4']},\n {notes:[{pitch:'F5',value:4}],target:0,answer:'F♯5',sounds:['F♯5']}\n ].map(q=>({...q,clef:'treble',key:'G',meter:'4/4'})));\n }\n function start(){player.stop();deck=bank();index=0;correct=0;assisted=0;draw();}\n function hintText(){const q=deck[index];if(PRACTICE.kind==='pitchQuiz')return t('anchor_'+q.clef)+' '+t('position')+' '+(q.step-(q.clef==='treble'?30:18));return t(PRACTICE.kind==='keyQuiz'?'key_hint':'bar_hint');}\n function draw(){player.stop();choice=null;answered=false;usedHint=false;check.disabled=true;next.disabled=true;reveal.disabled=false;hint.disabled=false;$('#play').disabled=PRACTICE.kind!=='pitchQuiz';feedback.textContent=t(PRACTICE.kind==='pitchQuiz'?'before':'before_check');meta.textContent=t(PRACTICE.kind==='pitchQuiz'?'question':PRACTICE.kind==='keyQuiz'?'key_prompt':'bar_prompt');answers.replaceChildren();\n const q=deck[index];let choices;\n if(PRACTICE.kind==='pitchQuiz'){const offsets=shuffle([-2,-1,1,2]).slice(0,2),accOther=MusicStaff.parse(q.pitch).alter===0?1:0;choices=shuffle([q.answer,...offsets.map(d=>MusicStaff.fromStep(q.step+d,MusicStaff.parse(q.pitch).alter)),MusicStaff.fromStep(q.step,accOther)]);staff(q.notes,{clef:q.clef});currentScore=MusicStaff.score(q.notes);}\n else if(PRACTICE.kind==='rhythmQuiz'){staff([...q.notes,{blank:true,value:q.missing}],{meter:q.meter});choices=['0.5','1','1.5','2','3','4'];currentScore=null;}\n else{staff(q.notes,{meter:q.meter,key:'G'});sheet.querySelector(`[data-note-index=\"${q.target}\"]`)?.setAttribute('data-current','true');meta.textContent+=' '+t('target_note')+' '+(q.target+1);choices=['F4','F♯4','F5','F♯5'];currentScore=MusicStaff.score(q.notes.map((n,i)=>({...n,pitch:q.sounds[i]})));}\n for(const c of choices){const b=make('button',{type:'button','data-answer':c,'aria-pressed':'false'},c==='0.5'?'½':c==='1.5'?'1½':c);b.onclick=()=>{if(answered)return;choice=c;check.disabled=false;[...answers.children].forEach(x=>x.setAttribute('aria-pressed',String(x===b)));};answers.append(b);}\n updateStats();tickAction=b=>highlight(b,q.notes);\n }\n function updateStats(){stats.textContent=t('round')+' '+(index+1)+' / '+deck.length+' · '+t('first_try')+' '+correct+' · '+t('assisted')+' '+assisted;}\n function finish(explicit){if(answered||(!explicit&&choice===null))return;player.stop();answered=true;if(explicit)usedHint=true;if(usedHint)assisted++;if(!usedHint&&choice===deck[index].answer)correct++;const q=deck[index];feedback.textContent=(explicit?'':t(choice===q.answer?'correct':'wrong')+' ')+t('answer')+' '+q.answer+'. '+hintText();\n if(PRACTICE.kind==='rhythmQuiz'){const missing=q.missing===3?{pitch:'C5',value:2,dot:true}:q.missing===1.5?{pitch:'C5',value:1,dot:true}:{pitch:'C5',value:q.missing};const ns=[...q.notes,missing];staff(ns,{meter:q.meter});currentScore=MusicStaff.score(ns);const sum=q.notes.reduce((a,n)=>a+n.value*(n.dot?1.5:1),0);feedback.textContent+=' '+t('bar_total')+' '+(sum+q.missing)+' − '+t('written')+' '+sum+' = '+q.missing;tickAction=b=>highlight(b,ns);}\n else if(PRACTICE.kind==='pitchQuiz')staff(q.notes,{clef:q.clef,labels:true});\n $('#play').disabled=false;check.disabled=true;reveal.disabled=true;hint.disabled=true;next.disabled=false;[...answers.children].forEach(b=>b.disabled=true);updateStats();}\n start();\n}else if(PRACTICE.kind==='symbols'){\n const kinds=[['whole',4,false,false],['half',2,false,false],['quarter',1,false,false],['eighth',.5,false,false],['dotted',1,false,true],['whole_rest',4,true,false],['half_rest',2,true,false],['quarter_rest',1,true,false],['eighth_rest',.5,true,false]];\n for(const [label,value,rest,dot] of kinds)button(controls,label,()=>draw(label,{pitch:'C5',value,rest,dot}));\n for(const tied of [true,false])button(controls,tied?'tied':'untied',()=>draw(tied?'tied':'untied',[{pitch:'C5',value:1,tie:tied},{pitch:'C5',value:1,continueTie:tied}]));\n function draw(label,n){player.stop();const notes=Array.isArray(n)?n:[n];staff(notes);feedback.textContent=t(label);meta.textContent=t('unit');const score=MusicStaff.score(notes);score.beats=4;for(let i=0;i<4;i++)score.events.push({beat:i,hz:1500,duration:.035,gain:.25});currentScore=score;tickAction=b=>highlight(b,notes);}\n draw('quarter',{pitch:'C5',value:1});\n}else if(PRACTICE.kind==='chord'){\n let root='C4',quality='major',inv=0;\n select(controls,'root',[['C4','C'],['D4','D'],['F4','F']],v=>{root=v;draw();},'root');\n select(controls,'quality',[['major','major'],['minor','minor']],v=>{quality=v;draw();},'quality');\n select(controls,'inversion',[['0','root_position'],['1','first_inversion'],['2','second_inversion']],v=>{inv=+v;draw();},'inversion');\n function draw(){const p=MusicStaff.parse(root),intervals=[0,quality==='major'?4:3,7],pitches=intervals.map((v,i)=>{const step=p.step+i*2,plain=MusicStaff.parse(MusicStaff.fromStep(step));return MusicStaff.fromStep(step,p.midi+v-plain.midi);});for(let i=0;i<inv;i++){const p=MusicStaff.parse(pitches.shift());pitches.push(MusicStaff.fromStep(p.step+7,p.alter));}const ns=[{chord:pitches,value:2}];staff(ns,{labels:false});feedback.textContent=t('root')+': '+root+' · '+t('quality')+': '+t(quality)+' · '+pitches.join(' – ');meta.textContent=t('chord_tip');currentScore=MusicStaff.score(ns);tickAction=b=>highlight(b,ns);}\n draw();\n}else if(PRACTICE.kind==='form'){\n const initial=PRACTICE.bars===8?['A','A','B','A','A','A′','B','A']:['A','A','B','A'];let order=[...initial],selected=0,melodyOnly=false;\n const material={A:['E4','G4','A4','G4'],'A′':['E4','G4','A4','C5'],B:['C5','B4','G4','D4']};\n const queue=make('div',{class:'mf-queue',id:'bar-queue'});controls.append(queue);\n const sel=select(controls,'material',[['A','A'],['A′','A′'],['B','B']],v=>{order[selected]=v;draw();},'material');\n const label=make('label'),box=make('input',{type:'checkbox',id:'melody-only'});label.append(box,make('span',{},t('melody_only')));controls.append(label);box.onchange=()=>{player.stop();melodyOnly=box.checked;draw();};\n button(controls,'reset',()=>{player.stop();order=[...initial];selected=0;draw();},{id:'reset'});\n button($('#quiz-actions'),'one_bar',()=>play(false),{id:'play-bar'});$('#play').textContent=t('full');$('#play').onclick=()=>play(true);\n function getScore(sequence){const s={bpm:100,beats:sequence.length*4,events:[]};sequence.forEach((name,bar)=>{const ns=material[name].map(note),m=MusicStaff.score(ns,100);s.events.push(...m.events.map(e=>({...e,beat:e.beat+bar*4})));if(!melodyOnly)for(const beat of [0,2])for(const midi of [36,48,52,55])s.events.push({beat:bar*4+beat,hz:440*2**((midi-69)/12),duration:.95,gain:midi===36?.65:.35,wave:'triangle'});});return s;}\n function draw(){queue.replaceChildren();order.forEach((m,i)=>{const b=make('button',{type:'button','data-bar':i,'aria-pressed':String(i===selected)},(i+1)+' · '+m);b.onclick=()=>{player.stop();selected=i;draw();};queue.append(b);});sel.value=order[selected];staff(material[order[selected]].map(note),{meter:'4/4'});feedback.textContent=order.join(' · ');meta.textContent=t('arrange_tip');}\n function play(all){const start=selected,sequence=all?order:[order[selected]];tickAction=beat=>{if(beat<0){highlight(-1,material[order[selected]].map(note));return;}const b=all?Math.min(order.length-1,Math.floor(beat/4)):start;if(b!==selected){selected=b;draw();}highlight(beat%4,material[order[selected]].map(note));};player.play(getScore(sequence));}\n draw();\n}\n","audio":true,"strings":{"accidental":"Accidental","altered":"Include accidentals","anchor_bass":"Anchor: the fourth line from the bottom, between the two dots, is F3.","anchor_treble":"Anchor: the second line from the bottom is G4. Move one letter for each neighboring line or space.","answer":"Answer:","arrange_tip":"Select a bar, replace its material, then listen. The staff shows that bar; during full playback it follows the current bar.","assisted":"Assisted questions","bar":"Bar","bar_hint":"First convert the time signature to quarter-note units. Add the written values, then subtract from the bar total.","bar_prompt":"Complete this bar. The box is the missing duration; choose its value in quarter-note beats.","bar_total":"Bar total","bass":"Bass clef","before":"Make your choice, then check the explanation.","before_check":"Choose an answer before checking or revealing the explanation.","check":"Check my answer","choose_p":"P is transposed","choose_q":"Q is transposed","chord_tip":"Read the stack from bottom to top. The root label stays fixed when you change the inversion.","clef":"Clef","compare_title":"Commit to an answer before revealing the diagram","comparison_correct":"P keeps every interval; Q changes one internal pitch. Compare the revealed distances.","correct":"Correct.","difficulty":"Pitch set","dotted":"Dotted quarter · 1½","down":"One staff position down","eighth":"Eighth note · ½","eighth_rest":"Eighth rest · ½","error":"Audio could not start. Retry or use the written explanation.","finished":"Round complete. Review the last explanation or start a new round.","first_inversion":"First inversion","first_try":"First-try correct","flat":"Flat ♭","full":"Play whole arrangement","half":"Half note · 2","half_rest":"Half rest · 2","heading":"Complete the bar from notation","hint":"Show position hint","idle":"Sound starts only when you press Play. Edits stop playback.","intro":"Count the written notes and rests. Submit the missing value, then play the completed bar. Include 3/4, 4/4, and 6/8.","inversion":"Bass position","key_hint":"One sharp in the key signature means every F is sharp unless a local accidental changes it. A barline resets local accidentals, not the key signature.","key_prompt":"Read the highlighted note using the key signature and any local accidental.","ledger":"A short ledger line extends the staff. It is counted just like a normal staff line.","major":"Major","material":"Material for selected bar","melody_only":"Melody only","minor":"Minor","missing":"Missing","mixed":"Mixed clefs","natural":"Natural ♮","next":"Next question","one_bar":"Play selected bar","plain":"Natural notes","play":"Play","playing":"Playing…","position":"Steps above the bottom line (each line-to-space move = 1):","pulse":"Reference pulse","quality":"Quality","quarter":"Quarter note · 1","quarter_rest":"Quarter rest · 1","question":"Read the note, including its octave and accidental. Choose an answer before checking.","reset":"Restore starting arrangement","rest":"rest","restart":"New round","reveal":"Reveal explanation","root":"Root","root_position":"Root position","round":"Round","second_inversion":"Second inversion","sharp":"Sharp ♯","staff_description":"Five-line music staff. Use the position description if you cannot see the notation.","starting":"Preparing audio…","stop":"Stop","symbols":"Note and rest values","target_note":"Read note","tied":"Two tied quarters · 2","treble":"Treble clef","unit":"Symbol excerpt, not a complete bar. Values use quarter-note units. Each audition lasts four beats; a soft pulse continues through rests.","untied":"Two separate quarters · 1 + 1","up":"One staff position up","volume":"Volume","whole":"Whole note · 4","whole_rest":"Whole rest · 4 here","written":"Already written","wrong":"Not yet. Compare your choice with the explanation."}}
Work a new example on paper, then check it
A 4/4 bar already contains a dotted quarter, an eighth rest, and a quarter note. What is missing?
The written total is 1½ + ½ + 1 = 3. One quarter-note unit remains. A quarter note or quarter rest would fill that duration, but they would sound different. The exercise asks for a duration, not a unique artistic choice of sound or silence.
A 6/8 bar with three eighth notes already written needs three more eighth-note units, equivalent to a dotted quarter. That is one larger beat in the usual two-beat reading of 6/8.
When reading a short score, find the clef and time signature first. Count one bar without playing, mark where the rests occur, then listen or clap it. In later lessons you will use this same reading process to inspect scales, chord stacks, and your own short arrangement.