Pular para o conteúdo Dados de AniList , MusicBrainz , IGDB , Open Library , Google Books , Hardcover , Wikidata e TMDB . Este produto usa a API do TMDB, mas não é endossado nem certificado pelo TMDB.
Leitura de partitura no piano · Jardim de Lucas Bispo
Da IA · Claude · 19 de nov. de 2026 Nota na pauta
Nota na pauta Nota na tecla Qual é a figura? Quantos tempos? Compasso e tempos Nota alterada na tecla Armadura de clave Intervalo entre duas notas Ler a partir da nota anterior title "Intervalo entre duas notas"
control cartoes = title "Ler a partir da nota anterior"
control cartoes =
10
1..30
"Cartões por rodada"
control nivel = 1 1..3 "Até o intervalo (1: 2ª e 3ª, 2: até 5ª, 3: até 8ª)"
control clave = Sol | Fá | Ambas "Clave"
---
import { practice , draw , setting } from "zukan" ;
const GRAU = [ "Dó" , "Ré" , "Mi" , "Fá" , "Sol" , "Lá" , "Si" ];
const BASE = { "Sol" : 30 , "Fá" : 18 };
const YB = 125 ;
const TINTA = "stroke:var(--ink);stroke-width:2.6;fill:none;stroke-linecap:round" ;
const CHEIO = "fill:var(--ink)" ;
const SOL = "M 44 116 C 36 118 32 108 40 104 C 50 100 56 110 50 120 C 44 128 28 126 28 112 C 28 98 44 90 50 80 C 56 70 54 58 48 58 C 42 58 40 68 42 80 L 48 140 C 49 148 40 150 38 143" ;
function pauta (f , clave) {
for ( let k = 0 ; k < 5 ; k ++ ) f .line ( 20 , YB - 12 * k , 280 , YB - 12 * k , "z-line" );
if (clave === "Sol" ) {
f .raw ( "path" , { d : SOL , style : TINTA });
f .raw ( "circle" , { cx : 39 , cy : 142 , r : 3.5 , style : CHEIO });
} else {
f .raw ( "circle" , { cx : 32 , cy : 89 , r : 5 , style : CHEIO });
f .raw ( "path" , { d : "M 32 89 C 30 76 54 72 57 88 C 59 104 42 118 26 128" , style : TINTA });
f .raw ( "circle" , { cx : 66 , cy : 83 , r : 3 , style : CHEIO });
f .raw ( "circle" , { cx : 66 , cy : 95 , r : 3 , style : CHEIO });
}
}
function nota (f , x , p) {
if (p <= - 2 ) for ( let q = - 2 ; q >= p; q -= 2 ) f .line (x - 15 , YB - 6 * q , x + 15 , YB - 6 * q , "z-line" );
if (p >= 10 ) for ( let q = 10 ; q <= p; q += 2 ) f .line (x - 15 , YB - 6 * q , x + 15 , YB - 6 * q , "z-line" );
f .raw ( "ellipse" , { cx : x , cy : YB - 6 * p , rx : 9 , ry : 6.5 , fill : "none" , style : "stroke:var(--ink);stroke-width:2.5" });
}
practice ({
title : "Intervalo entre duas notas" ,
rounds : Number ( setting ( "cartoes" , 10 )) || 10 ,
card (c) {
const nivel = Number ( setting ( "nivel" , 1 ));
const cl = setting ( "clave" , "Sol" );
const clave = cl === "Ambas" ? ( Math .random () < 0.5 ? "Sol" : "Fá" ) : cl;
const max = nivel === 1 ? 3 : nivel === 2 ? 5 : 8 ;
const n = draw ( Array .from ({ length : max - 1 } , (_ , i) => i + 2 ) , { key : (x) => ` ${ x } ª` });
const sobe = Math .random () < 0.5 ;
const d = n - 1 ;
const min = sobe ? - 1 : - 1 + d , top = sobe ? 9 - d : 9 ;
const p1 = min + Math .floor ( Math .random () * (top - min + 1 ));
const p2 = p1 + (sobe ? d : - d);
const nome = (p) => GRAU [( BASE [clave] + p) % 7 ];
c .text ( `Clave de ${ clave } : qual é o intervalo entre estas duas notas?` );
const f = c .figure ({ width : 300 , height : 180 });
pauta (f , clave);
nota (f , 150 , p1);
nota (f , 215 , p2);
c .choices ( Array .from ({ length : max - 1 } , (_ , i) => ` ${ i + 2 } ª` ) , ` ${ n } ª` , {
item : ` ${ n } ª` ,
why : `De ${ nome (p1) } para ${ nome (p2) } : ${ n } ª ${ sobe ? "acima" : "abaixo" } . Conte linhas e espaços, com a primeira nota valendo 1.` ,
});
} ,
});
10
1..30
"Cartões por rodada"
control nivel = 1 1..3 "Até o intervalo (1: 2ª e 3ª, 2: até 5ª, 3: até 8ª)"
control clave = Sol | Fá | Ambas "Clave"
---
import { practice , draw , setting } from "zukan" ;
const GRAU = [ "Dó" , "Ré" , "Mi" , "Fá" , "Sol" , "Lá" , "Si" ];
const BASE = { "Sol" : 30 , "Fá" : 18 };
const YB = 125 ;
const TINTA = "stroke:var(--ink);stroke-width:2.6;fill:none;stroke-linecap:round" ;
const CHEIO = "fill:var(--ink)" ;
const SOL = "M 44 116 C 36 118 32 108 40 104 C 50 100 56 110 50 120 C 44 128 28 126 28 112 C 28 98 44 90 50 80 C 56 70 54 58 48 58 C 42 58 40 68 42 80 L 48 140 C 49 148 40 150 38 143" ;
function pauta (f , clave) {
for ( let k = 0 ; k < 5 ; k ++ ) f .line ( 20 , YB - 12 * k , 280 , YB - 12 * k , "z-line" );
if (clave === "Sol" ) {
f .raw ( "path" , { d : SOL , style : TINTA });
f .raw ( "circle" , { cx : 39 , cy : 142 , r : 3.5 , style : CHEIO });
} else {
f .raw ( "circle" , { cx : 32 , cy : 89 , r : 5 , style : CHEIO });
f .raw ( "path" , { d : "M 32 89 C 30 76 54 72 57 88 C 59 104 42 118 26 128" , style : TINTA });
f .raw ( "circle" , { cx : 66 , cy : 83 , r : 3 , style : CHEIO });
f .raw ( "circle" , { cx : 66 , cy : 95 , r : 3 , style : CHEIO });
}
}
function nota (f , x , p) {
if (p <= - 2 ) for ( let q = - 2 ; q >= p; q -= 2 ) f .line (x - 15 , YB - 6 * q , x + 15 , YB - 6 * q , "z-line" );
if (p >= 10 ) for ( let q = 10 ; q <= p; q += 2 ) f .line (x - 15 , YB - 6 * q , x + 15 , YB - 6 * q , "z-line" );
f .raw ( "ellipse" , { cx : x , cy : YB - 6 * p , rx : 9 , ry : 6.5 , fill : "none" , style : "stroke:var(--ink);stroke-width:2.5" });
}
practice ({
title : "Ler a partir da nota anterior" ,
rounds : Number ( setting ( "cartoes" , 10 )) || 10 ,
card (c) {
const nivel = Number ( setting ( "nivel" , 1 ));
const cl = setting ( "clave" , "Sol" );
const clave = cl === "Ambas" ? ( Math .random () < 0.5 ? "Sol" : "Fá" ) : cl;
const max = nivel === 1 ? 3 : nivel === 2 ? 5 : 8 ;
const n = draw ( Array .from ({ length : max - 1 } , (_ , i) => i + 2 ) , { key : (x) => ` ${ x } ª` });
const sobe = Math .random () < 0.5 ;
const d = n - 1 ;
const min = sobe ? - 1 : - 1 + d , top = sobe ? 9 - d : 9 ;
const p1 = min + Math .floor ( Math .random () * (top - min + 1 ));
const p2 = p1 + (sobe ? d : - d);
const nome = (p) => GRAU [( BASE [clave] + p) % 7 ];
c .text ( `Clave de ${ clave } : a primeira nota é ${ nome (p1) } . Qual é a segunda?` );
const f = c .figure ({ width : 300 , height : 180 });
pauta (f , clave);
nota (f , 150 , p1);
nota (f , 215 , p2);
c .choices ( GRAU , nome (p2) , {
item : ` ${ n } ª ${ sobe ? "acima" : "abaixo" } ` ,
why : `Uma ${ n } ª ${ sobe ? "acima" : "abaixo" } de ${ nome (p1) } : ${ nome (p2) } . Conte linhas e espaços, com a primeira nota valendo 1.` ,
});
} ,
});
title "Nota na pauta"
control cartoes = 10 1..30 "Cartões por rodada"
control nivel = 1 1..3 "Até o nível (1 Sol, 2 + Fá, 3 + linhas suplementares)"
control clave = Ambas | Sol | Fá "Clave"
control nomes = solfejo | cifra "Nomes (solfejo = Dó Ré Mi, cifra = C D E)"
---
import { practice , draw , setting title "Nota na tecla"
control cartoes = 10 1..30 "Cartões por rodada"
control nivel = 1 1..3 "Até o nível (1 Sol, 2 + Fá, 3 + linhas suplementares)"
control clave = Ambas | Sol | Fá "Clave"
control nomes = solfejo | cifra "Nomes (solfejo = Dó Ré Mi, cifra = C D E)"
---
import { practice , draw , setting } title "Nome da figura"
control cartoes = 10 1..30 "Cartões por rodada"
control nivel = 1 1..3 "Até o nível (1 notas, 2 + pausas, 3 + pontuadas)"
---
import { practice , draw , setting , sound , ui } from "zukan" ;
const FIGURAS = [
[ title "Quantos tempos"
control cartoes = 10 1..30 "Cartões por rodada"
control nivel = 1 1..3 "Até o nível (1 notas, 2 + pausas, 3 + pontuadas)"
---
import { practice , draw , setting } from "zukan" ;
const FIGURAS = [
[ "semibreve" , "nao" , title "Compasso e tempos"
control cartoes = 10 1..30 "Cartões por rodada"
control nivel = 1 1..2 "Até o nível (1 fórmula de compasso, 2 + figura que falta)"
---
import { practice , draw , setting } from "zukan" ;
const COMPASSOS = [
{ compasso : "2/4" , title "Nota alterada na tecla"
control cartoes = 10 1..30 "Cartões por rodada"
control clave = Ambas | Sol | Fá "Clave"
---
import { practice , draw , setting } from "zukan" ;
const GRAU = [ "Dó" , "Ré" , title "Armadura de clave"
control cartoes = 10 1..30 "Cartões por rodada"
control nivel = 1 1..2 "Até o nível (1 até 3 alterações, 2 até 5)"
---
import { practice , draw , setting } from "zukan" ;
const YB = 125 ;
const TINTA ,
sound
,
ui }
from
"zukan"
;
const GRAU = [ "Dó" , "Ré" , "Mi" , "Fá" , "Sol" , "Lá" , "Si" ];
const CIFRA = [ "C" , "D" , "E" , "F" , "G" , "A" , "B" ];
const SEMI = [ 0 , 2 , 4 , 5 , 7 , 9 , 11 ];
const BASE = { "Sol" : 30 , "Fá" : 18 };
const YB = 125 ;
const TINTA = "stroke:var(--ink);stroke-width:2.6;fill:none;stroke-linecap:round" ;
const CHEIO = "fill:var(--ink)" ;
const SOL = "M 44 116 C 36 118 32 108 40 104 C 50 100 56 110 50 120 C 44 128 28 126 28 112 C 28 98 44 90 50 80 C 56 70 54 58 48 58 C 42 58 40 68 42 80 L 48 140 C 49 148 40 150 38 143" ;
const NOTAS = [
[ "Sol" , "Mi" , 4 , 1 ] , [ "Sol" , "Fá" , 4 , 1 ] , [ "Sol" , "Sol" , 4 , 1 ] , [ "Sol" , "Lá" , 4 , 1 ] , [ "Sol" , "Si" , 4 , 1 ] , [ "Sol" , "Dó" , 5 , 1 ] , [ "Sol" , "Ré" , 5 , 1 ] , [ "Sol" , "Mi" , 5 , 1 ] , [ "Sol" , "Fá" , 5 , 1 ] ,
[ "Fá" , "Sol" , 2 , 2 ] , [ "Fá" , "Lá" , 2 , 2 ] , [ "Fá" , "Si" , 2 , 2 ] , [ "Fá" , "Dó" , 3 , 2 ] , [ "Fá" , "Ré" , 3 , 2 ] , [ "Fá" , "Mi" , 3 , 2 ] , [ "Fá" , "Fá" , 3 , 2 ] , [ "Fá" , "Sol" , 3 , 2 ] , [ "Fá" , "Lá" , 3 , 2 ] ,
[ "Sol" , "Dó" , 4 , 3 ] , [ "Sol" , "Ré" , 4 , 3 ] , [ "Sol" , "Sol" , 5 , 3 ] , [ "Sol" , "Lá" , 5 , 3 ] , [ "Fá" , "Mi" , 2 , 3 ] , [ "Fá" , "Fá" , 2 , 3 ] , [ "Fá" , "Si" , 3 , 3 ] , [ "Fá" , "Dó" , 4 , 3 ] ,
] .map (([clave , nota , oitava , nivel]) => ({ clave , nota , oitava , nivel }));
const nomes = () => ( setting ( "nomes" , "solfejo" ) === "cifra" ? CIFRA : GRAU );
function pauta (f , clave) {
for ( let k = 0 ; k < 5 ; k ++ ) f .line ( 20 , YB - 12 * k , 280 , YB - 12 * k , "z-line" );
if (clave === "Sol" ) {
f .raw ( "path" , { d : SOL , style : TINTA });
f .raw ( "circle" , { cx : 39 , cy : 142 , r : 3.5 , style : CHEIO });
} else {
f .raw ( "circle" , { cx : 32 , cy : 89 , r : 5 , style : CHEIO });
f .raw ( "path" , { d : "M 32 89 C 30 76 54 72 57 88 C 59 104 42 118 26 128" , style : TINTA });
f .raw ( "circle" , { cx : 66 , cy : 83 , r : 3 , style : CHEIO });
f .raw ( "circle" , { cx : 66 , cy : 95 , r : 3 , style : CHEIO });
}
}
function nota (f , x , p) {
if (p <= - 2 ) for ( let q = - 2 ; q >= p; q -= 2 ) f .line (x - 15 , YB - 6 * q , x + 15 , YB - 6 * q , "z-line" );
if (p >= 10 ) for ( let q = 10 ; q <= p; q += 2 ) f .line (x - 15 , YB - 6 * q , x + 15 , YB - 6 * q , "z-line" );
f .raw ( "ellipse" , { cx : x , cy : YB - 6 * p , rx : 9 , ry : 6.5 , fill : "none" , style : "stroke:var(--ink);stroke-width:2.5" });
}
function onde (p) {
if (p >= 0 && p <= 8 ) return p % 2 === 0 ? ` ${ p / 2 + 1 } ª linha` : ` ${ (p + 1 ) / 2 } º espaço` ;
if (p < 0 ) return p % 2 === 0 ? "linha suplementar abaixo da pauta" : "logo abaixo da 1ª linha" ;
return p % 2 === 0 ? "linha suplementar acima da pauta" : "logo acima da 5ª linha" ;
}
practice ({
title : "Nota na pauta" ,
rounds : Number ( setting ( "cartoes" , 10 )) || 10 ,
card (c) {
const nivel = Number ( setting ( "nivel" , 1 ));
const cl = setting ( "clave" , "Ambas" );
const pool = NOTAS .filter ((r) => r .nivel <= nivel && (cl === "Ambas" || r .clave === cl));
const lista = pool . length ? pool : NOTAS .filter ((r) => r .nivel === 1 );
const alvo = draw (lista , { key : (r) => ` ${ r .clave } ${ r .nota }${ r .oitava } ` });
const g = GRAU .indexOf ( alvo .nota);
const p = alvo .oitava * 7 + g - BASE [ alvo .clave];
const midi = 12 * ( alvo .oitava + 1 ) + SEMI [g];
const central = alvo .nota === "Dó" && alvo .oitava === 4 ? " (Dó central)" : "" ;
c .text ( `Clave de ${ alvo .clave } : qual é esta nota?` );
const f = c .figure ({ width : 300 , height : 180 });
pauta (f , alvo .clave);
nota (f , 175 , p);
c .add ( ui .button ( "Ouvir" , () => sound .note (midi)));
c .choices ( nomes () , nomes ()[g] , {
item : ` ${ alvo .clave } ${ alvo .nota }${ alvo .oitava } ` ,
why : ` ${ onde (p) } na clave de ${ alvo .clave } : ${ nomes ()[g] }${ alvo .oitava }${ central } .` ,
});
} ,
});
from
"zukan"
;
const GRAU = [ "Dó" , "Ré" , "Mi" , "Fá" , "Sol" , "Lá" , "Si" ];
const CIFRA = [ "C" , "D" , "E" , "F" , "G" , "A" , "B" ];
const SEMI = [ 0 , 2 , 4 , 5 , 7 , 9 , 11 ];
const BASE = { "Sol" : 30 , "Fá" : 18 };
const YB = 125 ;
const TINTA = "stroke:var(--ink);stroke-width:2.6;fill:none;stroke-linecap:round" ;
const CHEIO = "fill:var(--ink)" ;
const SOL = "M 44 116 C 36 118 32 108 40 104 C 50 100 56 110 50 120 C 44 128 28 126 28 112 C 28 98 44 90 50 80 C 56 70 54 58 48 58 C 42 58 40 68 42 80 L 48 140 C 49 148 40 150 38 143" ;
const NOTAS = [
[ "Sol" , "Mi" , 4 , 1 ] , [ "Sol" , "Fá" , 4 , 1 ] , [ "Sol" , "Sol" , 4 , 1 ] , [ "Sol" , "Lá" , 4 , 1 ] , [ "Sol" , "Si" , 4 , 1 ] , [ "Sol" , "Dó" , 5 , 1 ] , [ "Sol" , "Ré" , 5 , 1 ] , [ "Sol" , "Mi" , 5 , 1 ] , [ "Sol" , "Fá" , 5 , 1 ] ,
[ "Fá" , "Sol" , 2 , 2 ] , [ "Fá" , "Lá" , 2 , 2 ] , [ "Fá" , "Si" , 2 , 2 ] , [ "Fá" , "Dó" , 3 , 2 ] , [ "Fá" , "Ré" , 3 , 2 ] , [ "Fá" , "Mi" , 3 , 2 ] , [ "Fá" , "Fá" , 3 , 2 ] , [ "Fá" , "Sol" , 3 , 2 ] , [ "Fá" , "Lá" , 3 , 2 ] ,
[ "Sol" , "Dó" , 4 , 3 ] , [ "Sol" , "Ré" , 4 , 3 ] , [ "Sol" , "Sol" , 5 , 3 ] , [ "Sol" , "Lá" , 5 , 3 ] , [ "Fá" , "Mi" , 2 , 3 ] , [ "Fá" , "Fá" , 2 , 3 ] , [ "Fá" , "Si" , 3 , 3 ] , [ "Fá" , "Dó" , 4 , 3 ] ,
] .map (([clave , nota , oitava , nivel]) => ({ clave , nota , oitava , nivel }));
const nomes = () => ( setting ( "nomes" , "solfejo" ) === "cifra" ? CIFRA : GRAU );
function pauta (f , clave) {
for ( let k = 0 ; k < 5 ; k ++ ) f .line ( 20 , YB - 12 * k , 280 , YB - 12 * k , "z-line" );
if (clave === "Sol" ) {
f .raw ( "path" , { d : SOL , style : TINTA });
f .raw ( "circle" , { cx : 39 , cy : 142 , r : 3.5 , style : CHEIO });
} else {
f .raw ( "circle" , { cx : 32 , cy : 89 , r : 5 , style : CHEIO });
f .raw ( "path" , { d : "M 32 89 C 30 76 54 72 57 88 C 59 104 42 118 26 128" , style : TINTA });
f .raw ( "circle" , { cx : 66 , cy : 83 , r : 3 , style : CHEIO });
f .raw ( "circle" , { cx : 66 , cy : 95 , r : 3 , style : CHEIO });
}
}
function nota (f , x , p) {
if (p <= - 2 ) for ( let q = - 2 ; q >= p; q -= 2 ) f .line (x - 15 , YB - 6 * q , x + 15 , YB - 6 * q , "z-line" );
if (p >= 10 ) for ( let q = 10 ; q <= p; q += 2 ) f .line (x - 15 , YB - 6 * q , x + 15 , YB - 6 * q , "z-line" );
f .raw ( "ellipse" , { cx : x , cy : YB - 6 * p , rx : 9 , ry : 6.5 , fill : "none" , style : "stroke:var(--ink);stroke-width:2.5" });
}
function teclado (c , inicio , aoEscolher) {
const f = c .figure ({ width : 300 , height : 120 });
const w = 20 , x0 = 10 , y0 = 8 , alt = 100 ;
const teclas = new Map ();
let escolhida = null ;
const pinta = (t , sel) =>
t . el .setAttribute ( "style" , `fill: ${ sel ? "var(--accent)" : t .preta ? "var(--ink)" : "var(--raised)" } ;stroke:var(--ink);stroke-width:1.5;cursor:pointer` );
const escolher = (m) => {
if (escolhida !== null ) pinta ( teclas .get (escolhida) , false );
escolhida = m;
pinta ( teclas .get (m) , true );
aoEscolher (m);
};
for ( let i = 0 ; i < 14 ; i ++ ) {
const oit = inicio + Math .floor (i / 7 ) , g = i % 7 ;
const m = 12 * (oit + 1 ) + SEMI [g];
const el = f .raw ( "rect" , { x : x0 + i * w , y : y0 , width : w , height : alt });
const t = { el , preta : false };
teclas .set (m , t);
pinta (t , false );
el .addEventListener ( "click" , () => escolher (m));
if (g === 0 ) {
const tx = f .raw ( "text" , { x : x0 + i * w + w / 2 , y : y0 + alt - 6 , style : "fill:var(--muted);font-size:9px;text-anchor:middle;pointer-events:none" });
tx .textContent = ` ${ nomes ()[ 0 ] }${ oit } ` ;
}
}
for ( let i = 0 ; i < 14 ; i ++ ) {
const g = i % 7 ;
if ( ! [ 0 , 1 , 3 , 4 , 5 ] .includes (g)) continue ;
const oit = inicio + Math .floor (i / 7 );
const m = 12 * (oit + 1 ) + SEMI [g] + 1 ;
const el = f .raw ( "rect" , { x : x0 + (i + 1 ) * w - 6 , y : y0 , width : 12 , height : 60 });
const t = { el , preta : true };
teclas .set (m , t);
pinta (t , false );
el .addEventListener ( "click" , () => escolher (m));
}
}
practice ({
title : "Nota na tecla" ,
rounds : Number ( setting ( "cartoes" , 10 )) || 10 ,
card (c) {
const nivel = Number ( setting ( "nivel" , 1 ));
const cl = setting ( "clave" , "Ambas" );
const pool = NOTAS .filter ((r) => r .nivel <= nivel && (cl === "Ambas" || r .clave === cl));
const lista = pool . length ? pool : NOTAS .filter ((r) => r .nivel === 1 );
const alvo = draw (lista , { key : (r) => ` ${ r .clave } ${ r .nota }${ r .oitava } ` });
const g = GRAU .indexOf ( alvo .nota);
const p = alvo .oitava * 7 + g - BASE [ alvo .clave];
const midi = 12 * ( alvo .oitava + 1 ) + SEMI [g];
c .text ( `Clave de ${ alvo .clave } : toque a tecla desta nota e confira.` );
const f = c .figure ({ width : 300 , height : 180 });
pauta (f , alvo .clave);
nota (f , 175 , p);
const inicio = alvo .oitava - ( Math .random () < 0.5 ? 0 : 1 );
let escolhida = null ;
teclado (c , inicio , (m) => { escolhida = m; });
c .submit ( "Conferir" , () => ({
correct : escolhida === midi ,
expected : ` ${ nomes ()[g] }${ alvo .oitava } ` ,
why : `Esta nota é ${ nomes ()[g] }${ alvo .oitava } .` ,
}) , { item : ` ${ alvo .clave } ${ alvo .nota }${ alvo .oitava } ` });
} ,
});
"semibreve"
,
"nao"
,
"nota"
,
"semibreve"
,
"4"
,
1
]
,
[
"minima"
,
"nao"
,
"nota"
,
"mínima"
,
"2"
,
1
]
,
[
"seminima"
,
"nao"
,
"nota"
,
"semínima"
,
"1"
,
1
]
,
[ "colcheia" , "nao" , "nota" , "colcheia" , "1/2" , 1 ] , [ "semicolcheia" , "nao" , "nota" , "semicolcheia" , "1/4" , 1 ] ,
[ "semibreve" , "nao" , "pausa" , "semibreve" , "4" , 2 ] , [ "minima" , "nao" , "pausa" , "mínima" , "2" , 2 ] , [ "seminima" , "nao" , "pausa" , "semínima" , "1" , 2 ] ,
[ "colcheia" , "nao" , "pausa" , "colcheia" , "1/2" , 2 ] , [ "semicolcheia" , "nao" , "pausa" , "semicolcheia" , "1/4" , 2 ] ,
[ "minima" , "sim" , "nota" , "mínima pontuada" , "3" , 3 ] , [ "seminima" , "sim" , "nota" , "semínima pontuada" , "1,5" , 3 ] , [ "colcheia" , "sim" , "nota" , "colcheia pontuada" , "3/4" , 3 ] ,
] .map (([figura , pontuada , tipo , nome , tempos , nivel]) => ({ figura , pontuada , tipo , nome , tempos , nivel }));
const val = (t) => ( t .includes ( "/" ) ? t .split ( "/" ) .map (Number) .reduce ((a , b) => a / b) : Number ( t .replace ( "," , "." )));
function desenha (c , r) {
const f = c .figure ({ width : 300 , height : 150 });
const yb = 110 , cx = 150 ;
for ( let k = 0 ; k < 5 ; k ++ ) f .line ( 20 , yb - 12 * k , 280 , yb - 12 * k , "z-line" );
const tinta = "stroke:var(--ink);stroke-width:2.5;fill:none" ;
const cheio = "stroke:var(--ink);stroke-width:2;fill:var(--ink)" ;
const sx = cx + 8 ;
if ( r .tipo === "nota" ) {
const cy = 98 ;
const oco = r .figura === "semibreve" || r .figura === "minima" ;
f .raw ( "ellipse" , { cx , cy , rx : 9 , ry : 6.5 , transform : `rotate(-20 ${ cx } ${ cy } )` , style : oco ? tinta : cheio });
if ( r .figura !== "semibreve" ) f .raw ( "path" , { d : `M ${ sx } ${ cy } L ${ sx } ${ cy - 42 } ` , style : tinta });
const bandeiras = r .figura === "colcheia" ? 1 : r .figura === "semicolcheia" ? 2 : 0 ;
for ( let i = 0 ; i < bandeiras; i ++ ) f .raw ( "path" , { d : `M ${ sx } ${ cy - 42 + i * 9 } c 0 8 14 12 13 26` , style : tinta });
if ( r .pontuada === "sim" ) f .raw ( "circle" , { cx : cx + 19 , cy : cy - 6 , r : 2.8 , style : cheio });
} else {
if ( r .figura === "semibreve" ) f .raw ( "rect" , { x : cx - 10 , y : 74 , width : 20 , height : 6 , style : cheio });
if ( r .figura === "minima" ) f .raw ( "rect" , { x : cx - 10 , y : 80 , width : 20 , height : 6 , style : cheio });
if ( r .figura === "seminima" ) f .raw ( "path" , { d : `M ${ cx - 4 } 64 L ${ cx + 5 } 76 L ${ cx - 5 } 88 L ${ cx + 4 } 98 Q ${ cx - 6 } 98 ${ cx - 3 } 108` , style : tinta });
if ( r .figura === "colcheia" ) {
f .raw ( "circle" , { cx : cx - 5 , cy : 80 , r : 3.5 , style : cheio });
f .raw ( "path" , { d : `M ${ cx - 5 } 83 Q ${ cx + 6 } 83 ${ cx + 8 } 72 L ${ cx - 4 } 102` , style : tinta });
}
if ( r .figura === "semicolcheia" ) {
f .raw ( "circle" , { cx : cx - 5 , cy : 78 , r : 3.5 , style : cheio });
f .raw ( "circle" , { cx : cx - 9 , cy : 90 , r : 3.5 , style : cheio });
f .raw ( "path" , { d : `M ${ cx - 5 } 81 Q ${ cx + 6 } 81 ${ cx + 10 } 68 L ${ cx - 6 } 104` , style : tinta });
f .raw ( "path" , { d : `M ${ cx - 9 } 93 Q ${ cx + 2 } 93 ${ cx + 5 } 82` , style : tinta });
}
}
}
practice ({
title : "Nome da figura" ,
rounds : Number ( setting ( "cartoes" , 10 )) || 10 ,
card (c) {
const nivel = Number ( setting ( "nivel" , 1 ));
const lista = FIGURAS .filter ((r) => r .nivel <= nivel);
const alvo = draw (lista , { key : (r) => ` ${ r .tipo } ${ r .nome } ` });
const v = val ( alvo .tempos);
c .text ( alvo .tipo === "nota" ? "Que nota é esta?" : "Que pausa é esta?" );
desenha (c , alvo);
c .add ( ui .button ( "Ouvir (60 bpm)" , () => {
[ 0 , 1 , 2 , 3 ] .forEach ((i) => setTimeout (() => sound .click () , i * 1000 ));
if ( alvo .tipo === "nota" ) sound .note ( 67 , { dur : v });
}));
const opcoes = lista .filter ((r) => r .tipo === alvo .tipo) .map ((r) => r .nome);
c .choices ( draw .shuffle (opcoes) , alvo .nome , {
item : ` ${ alvo .tipo } ${ alvo .nome } ` ,
why : ` ${ alvo .tipo === "pausa" ? "Pausa de " : "" }${ alvo .nome } : ${ alvo .tempos } ${ v <= 1 ? "tempo" : "tempos" } .` ,
});
} ,
});
"nota"
,
"semibreve"
,
"4"
,
1
]
,
[
"minima"
,
"nao"
,
"nota"
,
"mínima"
,
"2"
,
1
]
,
[
"seminima"
,
"nao"
,
"nota"
,
"semínima"
,
"1"
,
1
]
,
[ "colcheia" , "nao" , "nota" , "colcheia" , "1/2" , 1 ] , [ "semicolcheia" , "nao" , "nota" , "semicolcheia" , "1/4" , 1 ] ,
[ "semibreve" , "nao" , "pausa" , "semibreve" , "4" , 2 ] , [ "minima" , "nao" , "pausa" , "mínima" , "2" , 2 ] , [ "seminima" , "nao" , "pausa" , "semínima" , "1" , 2 ] ,
[ "colcheia" , "nao" , "pausa" , "colcheia" , "1/2" , 2 ] , [ "semicolcheia" , "nao" , "pausa" , "semicolcheia" , "1/4" , 2 ] ,
[ "minima" , "sim" , "nota" , "mínima pontuada" , "3" , 3 ] , [ "seminima" , "sim" , "nota" , "semínima pontuada" , "1,5" , 3 ] , [ "colcheia" , "sim" , "nota" , "colcheia pontuada" , "3/4" , 3 ] ,
] .map (([figura , pontuada , tipo , nome , tempos , nivel]) => ({ figura , pontuada , tipo , nome , tempos , nivel }));
const val = (t) => ( t .includes ( "/" ) ? t .split ( "/" ) .map (Number) .reduce ((a , b) => a / b) : Number ( t .replace ( "," , "." )));
function desenha (c , r) {
const f = c .figure ({ width : 300 , height : 150 });
const yb = 110 , cx = 150 ;
for ( let k = 0 ; k < 5 ; k ++ ) f .line ( 20 , yb - 12 * k , 280 , yb - 12 * k , "z-line" );
const tinta = "stroke:var(--ink);stroke-width:2.5;fill:none" ;
const cheio = "stroke:var(--ink);stroke-width:2;fill:var(--ink)" ;
const sx = cx + 8 ;
if ( r .tipo === "nota" ) {
const cy = 98 ;
const oco = r .figura === "semibreve" || r .figura === "minima" ;
f .raw ( "ellipse" , { cx , cy , rx : 9 , ry : 6.5 , transform : `rotate(-20 ${ cx } ${ cy } )` , style : oco ? tinta : cheio });
if ( r .figura !== "semibreve" ) f .raw ( "path" , { d : `M ${ sx } ${ cy } L ${ sx } ${ cy - 42 } ` , style : tinta });
const bandeiras = r .figura === "colcheia" ? 1 : r .figura === "semicolcheia" ? 2 : 0 ;
for ( let i = 0 ; i < bandeiras; i ++ ) f .raw ( "path" , { d : `M ${ sx } ${ cy - 42 + i * 9 } c 0 8 14 12 13 26` , style : tinta });
if ( r .pontuada === "sim" ) f .raw ( "circle" , { cx : cx + 19 , cy : cy - 6 , r : 2.8 , style : cheio });
} else {
if ( r .figura === "semibreve" ) f .raw ( "rect" , { x : cx - 10 , y : 74 , width : 20 , height : 6 , style : cheio });
if ( r .figura === "minima" ) f .raw ( "rect" , { x : cx - 10 , y : 80 , width : 20 , height : 6 , style : cheio });
if ( r .figura === "seminima" ) f .raw ( "path" , { d : `M ${ cx - 4 } 64 L ${ cx + 5 } 76 L ${ cx - 5 } 88 L ${ cx + 4 } 98 Q ${ cx - 6 } 98 ${ cx - 3 } 108` , style : tinta });
if ( r .figura === "colcheia" ) {
f .raw ( "circle" , { cx : cx - 5 , cy : 80 , r : 3.5 , style : cheio });
f .raw ( "path" , { d : `M ${ cx - 5 } 83 Q ${ cx + 6 } 83 ${ cx + 8 } 72 L ${ cx - 4 } 102` , style : tinta });
}
if ( r .figura === "semicolcheia" ) {
f .raw ( "circle" , { cx : cx - 5 , cy : 78 , r : 3.5 , style : cheio });
f .raw ( "circle" , { cx : cx - 9 , cy : 90 , r : 3.5 , style : cheio });
f .raw ( "path" , { d : `M ${ cx - 5 } 81 Q ${ cx + 6 } 81 ${ cx + 10 } 68 L ${ cx - 6 } 104` , style : tinta });
f .raw ( "path" , { d : `M ${ cx - 9 } 93 Q ${ cx + 2 } 93 ${ cx + 5 } 82` , style : tinta });
}
}
}
practice ({
title : "Quantos tempos" ,
rounds : Number ( setting ( "cartoes" , 10 )) || 10 ,
card (c) {
const nivel = Number ( setting ( "nivel" , 1 ));
const lista = FIGURAS .filter ((r) => r .nivel <= nivel);
const alvo = draw (lista , { key : (r) => ` ${ r .tipo } ${ r .nome } ` });
const v = val ( alvo .tempos);
c .text ( alvo .tipo === "nota" ? "Quantos tempos dura esta nota? (4/4, semínima = 1)" : "Quantos tempos dura esta pausa? (4/4, semínima = 1)" );
desenha (c , alvo);
const vistos = new Map ();
lista .forEach ((r) => vistos .set ( r .tempos , val ( r .tempos)));
const opcoes = [ ... vistos .entries ()] .sort ((a , b) => b[ 1 ] - a[ 1 ]) .map ((e) => e[ 0 ]);
const regra = alvo .pontuada === "sim" ? "O ponto soma metade do valor da figura." : "Cada figura vale a metade da anterior: 4, 2, 1, 1/2, 1/4." ;
c .choices (opcoes , alvo .tempos , {
item : ` ${ alvo .tipo } ${ alvo .nome } ` ,
why : ` ${ alvo .tipo === "pausa" ? "Pausa de " : "" }${ alvo .nome } : ${ alvo .tempos } ${ v <= 1 ? "tempo" : "tempos" } . ${ regra } ` ,
});
} ,
});
tempos
:
2
,
dica
:
"2 tempos por compasso (marcha)"
}
,
{ compasso : "3/4" , tempos : 3 , dica : "3 tempos por compasso (valsa)" } ,
{ compasso : "4/4" , tempos : 4 , dica : "4 tempos por compasso, o mais comum" } ,
];
const tinta = "stroke:var(--ink);stroke-width:2.2;fill:none" ;
const cheio = "stroke:var(--ink);stroke-width:2;fill:var(--ink)" ;
const fmt = (v) => String (v) .replace ( "." , "," );
const nome = (v) => (v === 3 ? "mínima pontuada" : v === 2 ? "mínima" : v === 1 ? "semínima" : "colcheia" );
function figura (f , cx , v) {
const cy = 76 ;
f .raw ( "ellipse" , { cx , cy , rx : 8.5 , ry : 6 , transform : `rotate(-20 ${ cx } ${ cy } )` , style : v >= 2 ? tinta : cheio });
f .raw ( "path" , { d : `M ${ cx + 8 } ${ cy } L ${ cx + 8 } ${ cy - 36 } ` , style : tinta });
if (v === 0.5 ) f .raw ( "path" , { d : `M ${ cx + 8 } ${ cy - 36 } c 0 8 12 12 11 24` , style : tinta });
}
function compasso (c , formula , itens , falta) {
const f = c .figure ({ width : 300 , height : 130 });
const yb = 100 ;
for ( let k = 0 ; k < 5 ; k ++ ) f .line ( 15 , yb - 12 * k , 285 , yb - 12 * k , "z-line" );
f .line ( 285 , yb - 48 , 285 , yb , "z-line" );
const [ a , b ] = formula .split ( "/" );
[[a , 74 ] , [b , 98 ]] .forEach (([t , y]) => {
const e = f .raw ( "text" , { x : 44 , y , style : "fill:var(--ink);font-size:27px;font-weight:700;text-anchor:middle" });
e .textContent = t;
});
const ini = 70 , fim = 275 ;
const n = itens . length + (falta ? 1 : 0 ) || 1 ;
const passo = (fim - ini) / n;
itens .forEach ((v , i) => figura (f , ini + passo * (i + 0.5 ) , v));
if (falta) {
const x = ini + passo * ( itens . length + 0.5 );
f .raw ( "rect" , { x : x - 14 , y : 40 , width : 28 , height : 66 , style : "stroke:var(--muted);stroke-width:2;stroke-dasharray:4 3;fill:none" });
const q = f .raw ( "text" , { x , y : 84 , style : "fill:var(--muted);font-size:26px;text-anchor:middle" });
q .textContent = "?" ;
}
}
const combos = [];
COMPASSOS .forEach ((r) => [ 3 , 2 , 1 , 0.5 ] .forEach ((m) => { if (m < r .tempos) combos .push ({ compasso : r .compasso , n : r .tempos , m }); }));
practice ({
title : "Compasso e tempos" ,
rounds : Number ( setting ( "cartoes" , 10 )) || 10 ,
card (c) {
const nivel = Number ( setting ( "nivel" , 1 ));
if (nivel >= 2 && Math .random () < 0.7 ) {
const k = draw (combos , { key : (x) => ` ${ x .compasso } falta ${ nome ( x .m) } ` });
let seq = [];
for ( let t = 0 ; t < 30 ; t ++ ) {
let r = k .n - k .m;
seq = [];
while (r > 0 ) {
const ops = [ 2 , 1 , 0.5 ] .filter ((v) => v <= r);
const v = ops[ Math .floor ( Math .random () * ops . length )];
seq .push (v);
r -= v;
}
if ( seq . length <= 5 ) break ;
}
c .text ( `Compasso ${ k .compasso } : qual figura completa o compasso?` );
compasso (c , k .compasso , seq , true );
c .choices ([ "mínima pontuada" , "mínima" , "semínima" , "colcheia" ] , nome ( k .m) , {
item : ` ${ k .compasso } falta ${ nome ( k .m) } ` ,
why : ` ${ seq .map (fmt) .join ( " + " ) } = ${ fmt ( k .n - k .m) } ; faltam ${ fmt ( k .m) } para chegar a ${ k .n } : ${ nome ( k .m) } .` ,
});
} else {
const r = draw ( COMPASSOS , { key : (x) => x .compasso });
c .text ( "Quantos tempos tem cada compasso?" );
compasso (c , r .compasso , [] , false );
c .choices ([ "2" , "3" , "4" ] , String ( r .tempos) , {
item : ` ${ r .compasso } tempos` ,
why : ` ${ r .compasso } : ${ r .dica } . O número de cima diz quantos tempos; o 4 embaixo diz que a semínima vale 1 tempo.` ,
});
}
} ,
});
"Mi"
,
"Fá"
,
"Sol"
,
"Lá"
,
"Si"
];
const SEMI = [ 0 , 2 , 4 , 5 , 7 , 9 , 11 ];
const BASE = { "Sol" : 30 , "Fá" : 18 };
const YB = 125 ;
const TINTA = "stroke:var(--ink);stroke-width:2.6;fill:none;stroke-linecap:round" ;
const CHEIO = "fill:var(--ink)" ;
const SOL = "M 44 116 C 36 118 32 108 40 104 C 50 100 56 110 50 120 C 44 128 28 126 28 112 C 28 98 44 90 50 80 C 56 70 54 58 48 58 C 42 58 40 68 42 80 L 48 140 C 49 148 40 150 38 143" ;
const ALTERADAS = [
[ "Sol" , "Fá" , "sust" , 4 ] , [ "Sol" , "Sol" , "sust" , 4 ] , [ "Sol" , "Si" , "bemol" , 4 ] , [ "Sol" , "Lá" , "bemol" , 4 ] , [ "Sol" , "Dó" , "sust" , 5 ] , [ "Sol" , "Ré" , "sust" , 5 ] , [ "Sol" , "Mi" , "bemol" , 5 ] , [ "Sol" , "Fá" , "sust" , 5 ] ,
[ "Fá" , "Si" , "bemol" , 2 ] , [ "Fá" , "Dó" , "sust" , 3 ] , [ "Fá" , "Mi" , "bemol" , 3 ] , [ "Fá" , "Fá" , "sust" , 3 ] , [ "Fá" , "Sol" , "sust" , 3 ] , [ "Fá" , "Lá" , "bemol" , 3 ] ,
] .map (([clave , nota , acid , oitava]) => ({ clave , nota , acid , oitava }));
function pauta (f , clave) {
for ( let k = 0 ; k < 5 ; k ++ ) f .line ( 20 , YB - 12 * k , 280 , YB - 12 * k , "z-line" );
if (clave === "Sol" ) {
f .raw ( "path" , { d : SOL , style : TINTA });
f .raw ( "circle" , { cx : 39 , cy : 142 , r : 3.5 , style : CHEIO });
} else {
f .raw ( "circle" , { cx : 32 , cy : 89 , r : 5 , style : CHEIO });
f .raw ( "path" , { d : "M 32 89 C 30 76 54 72 57 88 C 59 104 42 118 26 128" , style : TINTA });
f .raw ( "circle" , { cx : 66 , cy : 83 , r : 3 , style : CHEIO });
f .raw ( "circle" , { cx : 66 , cy : 95 , r : 3 , style : CHEIO });
}
}
function sustenido (f , x , y) {
f .raw ( "path" , { d : `M ${ x - 2.5 } ${ y - 11 } L ${ x - 2.5 } ${ y + 11 } M ${ x + 2.5 } ${ y - 12 } L ${ x + 2.5 } ${ y + 10 } ` , style : "stroke:var(--ink);stroke-width:1.5;fill:none" });
f .raw ( "path" , { d : `M ${ x - 6 } ${ y - 2 } L ${ x + 6 } ${ y - 5 } M ${ x - 6 } ${ y + 5 } L ${ x + 6 } ${ y + 2 } ` , style : TINTA });
}
function bemol (f , x , y) {
f .raw ( "path" , { d : `M ${ x - 3 } ${ y - 16 } L ${ x - 3 } ${ y + 4 } ` , style : "stroke:var(--ink);stroke-width:1.8;fill:none" });
f .raw ( "path" , { d : `M ${ x - 3 } ${ y + 4 } C ${ x + 8 } ${ y - 2 } ${ x + 7 } ${ y - 10 } ${ x - 3 } ${ y - 5 } ` , style : "stroke:var(--ink);stroke-width:2;fill:none" });
}
function nota (f , x , p , acid) {
if (p <= - 2 ) for ( let q = - 2 ; q >= p; q -= 2 ) f .line (x - 15 , YB - 6 * q , x + 15 , YB - 6 * q , "z-line" );
if (p >= 10 ) for ( let q = 10 ; q <= p; q += 2 ) f .line (x - 15 , YB - 6 * q , x + 15 , YB - 6 * q , "z-line" );
f .raw ( "ellipse" , { cx : x , cy : YB - 6 * p , rx : 9 , ry : 6.5 , fill : "none" , style : "stroke:var(--ink);stroke-width:2.5" });
(acid === "sust" ? sustenido : bemol)(f , x - 24 , YB - 6 * p);
}
function teclado (c , inicio , aoEscolher) {
const f = c .figure ({ width : 300 , height : 120 });
const w = 20 , x0 = 10 , y0 = 8 , alt = 100 ;
const teclas = new Map ();
let escolhida = null ;
const pinta = (t , sel) =>
t . el .setAttribute ( "style" , `fill: ${ sel ? "var(--accent)" : t .preta ? "var(--ink)" : "var(--raised)" } ;stroke:var(--ink);stroke-width:1.5;cursor:pointer` );
const escolher = (m) => {
if (escolhida !== null ) pinta ( teclas .get (escolhida) , false );
escolhida = m;
pinta ( teclas .get (m) , true );
aoEscolher (m);
};
for ( let i = 0 ; i < 14 ; i ++ ) {
const oit = inicio + Math .floor (i / 7 ) , g = i % 7 ;
const m = 12 * (oit + 1 ) + SEMI [g];
const el = f .raw ( "rect" , { x : x0 + i * w , y : y0 , width : w , height : alt });
const t = { el , preta : false };
teclas .set (m , t);
pinta (t , false );
el .addEventListener ( "click" , () => escolher (m));
if (g === 0 ) {
const tx = f .raw ( "text" , { x : x0 + i * w + w / 2 , y : y0 + alt - 6 , style : "fill:var(--muted);font-size:9px;text-anchor:middle;pointer-events:none" });
tx .textContent = `Dó ${ oit } ` ;
}
}
for ( let i = 0 ; i < 14 ; i ++ ) {
const g = i % 7 ;
if ( ! [ 0 , 1 , 3 , 4 , 5 ] .includes (g)) continue ;
const oit = inicio + Math .floor (i / 7 );
const m = 12 * (oit + 1 ) + SEMI [g] + 1 ;
const el = f .raw ( "rect" , { x : x0 + (i + 1 ) * w - 6 , y : y0 , width : 12 , height : 60 });
const t = { el , preta : true };
teclas .set (m , t);
pinta (t , false );
el .addEventListener ( "click" , () => escolher (m));
}
}
practice ({
title : "Nota alterada na tecla" ,
rounds : Number ( setting ( "cartoes" , 10 )) || 10 ,
card (c) {
const cl = setting ( "clave" , "Ambas" );
const pool = ALTERADAS .filter ((r) => cl === "Ambas" || r .clave === cl);
const lista = pool . length ? pool : ALTERADAS ;
const alvo = draw (lista , { key : (r) => ` ${ r .clave } ${ r .nota }${ r .acid === "sust" ? "#" : "b" }${ r .oitava } ` });
const g = GRAU .indexOf ( alvo .nota);
const sust = alvo .acid === "sust" ;
const p = alvo .oitava * 7 + g - BASE [ alvo .clave];
const midi = 12 * ( alvo .oitava + 1 ) + SEMI [g] + (sust ? 1 : - 1 );
const sinal = sust ? "♯" : "♭" ;
c .text ( `Clave de ${ alvo .clave } : toque a tecla desta nota e confira.` );
const f = c .figure ({ width : 300 , height : 180 });
pauta (f , alvo .clave);
nota (f , 175 , p , alvo .acid);
const inicio = alvo .oitava - ( Math .random () < 0.5 ? 0 : 1 );
let escolhida = null ;
teclado (c , inicio , (m) => { escolhida = m; });
c .submit ( "Conferir" , () => ({
correct : escolhida === midi ,
expected : ` ${ alvo .nota }${ sinal }${ alvo .oitava } ` ,
why : ` ${ alvo .nota }${ sinal }${ alvo .oitava } : tecla logo à ${ sust ? "direita" : "esquerda" } do ${ alvo .nota } . ${ sust ? "O sustenido sobe meio tom." : "O bemol desce meio tom." } ` ,
}) , { item : ` ${ alvo .clave } ${ alvo .nota }${ sinal }${ alvo .oitava } ` });
} ,
});
=
"stroke:var(--ink);stroke-width:2.6;fill:none;stroke-linecap:round"
;
const CHEIO = "fill:var(--ink)" ;
const SOL = "M 44 116 C 36 118 32 108 40 104 C 50 100 56 110 50 120 C 44 128 28 126 28 112 C 28 98 44 90 50 80 C 56 70 54 58 48 58 C 42 58 40 68 42 80 L 48 140 C 49 148 40 150 38 143" ;
const SUST_P = [ 8 , 5 , 9 , 6 , 3 , 7 , 4 ];
const BEM_P = [ 4 , 7 , 3 , 6 , 2 , 5 , 1 ];
const SUST_N = [ "Fá" , "Dó" , "Sol" , "Ré" , "Lá" , "Mi" , "Si" ];
const BEM_N = [ "Si" , "Mi" , "Lá" , "Ré" , "Sol" , "Dó" , "Fá" ];
const ARMADURAS = [
[ "Dó maior" , "nenhum" , 0 , 1 ] , [ "Sol maior" , "sust" , 1 , 1 ] , [ "Ré maior" , "sust" , 2 , 1 ] , [ "Lá maior" , "sust" , 3 , 1 ] ,
[ "Fá maior" , "bemol" , 1 , 1 ] , [ "Si♭ maior" , "bemol" , 2 , 1 ] , [ "Mi♭ maior" , "bemol" , 3 , 1 ] ,
[ "Mi maior" , "sust" , 4 , 2 ] , [ "Si maior" , "sust" , 5 , 2 ] , [ "Lá♭ maior" , "bemol" , 4 , 2 ] , [ "Ré♭ maior" , "bemol" , 5 , 2 ] ,
] .map (([tonalidade , tipo , n , nivel]) => ({ tonalidade , tipo , n , nivel }));
function sustenido (f , x , y) {
f .raw ( "path" , { d : `M ${ x - 2.5 } ${ y - 11 } L ${ x - 2.5 } ${ y + 11 } M ${ x + 2.5 } ${ y - 12 } L ${ x + 2.5 } ${ y + 10 } ` , style : "stroke:var(--ink);stroke-width:1.5;fill:none" });
f .raw ( "path" , { d : `M ${ x - 6 } ${ y - 2 } L ${ x + 6 } ${ y - 5 } M ${ x - 6 } ${ y + 5 } L ${ x + 6 } ${ y + 2 } ` , style : TINTA });
}
function bemol (f , x , y) {
f .raw ( "path" , { d : `M ${ x - 3 } ${ y - 16 } L ${ x - 3 } ${ y + 4 } ` , style : "stroke:var(--ink);stroke-width:1.8;fill:none" });
f .raw ( "path" , { d : `M ${ x - 3 } ${ y + 4 } C ${ x + 8 } ${ y - 2 } ${ x + 7 } ${ y - 10 } ${ x - 3 } ${ y - 5 } ` , style : "stroke:var(--ink);stroke-width:2;fill:none" });
}
practice ({
title : "Armadura de clave" ,
rounds : Number ( setting ( "cartoes" , 10 )) || 10 ,
card (c) {
const nivel = Number ( setting ( "nivel" , 1 ));
const lista = ARMADURAS .filter ((r) => r .nivel <= nivel);
const alvo = draw (lista , { key : (r) => r .tonalidade });
const sust = alvo .tipo === "sust" ;
c .text ( "Que tonalidade maior tem esta armadura de clave?" );
const f = c .figure ({ width : 300 , height : 180 });
for ( let k = 0 ; k < 5 ; k ++ ) f .line ( 20 , YB - 12 * k , 280 , YB - 12 * k , "z-line" );
f .raw ( "path" , { d : SOL , style : TINTA });
f .raw ( "circle" , { cx : 39 , cy : 142 , r : 3.5 , style : CHEIO });
for ( let i = 0 ; i < alvo .n; i ++ ) (sust ? sustenido : bemol)(f , 84 + i * 16 , YB - 6 * (sust ? SUST_P [i] : BEM_P [i]));
let why;
if ( alvo .n === 0 ) why = "Sem sustenidos nem bemóis: Dó maior." ;
else if (sust) why = ` ${ alvo .n } sustenido ${ alvo .n > 1 ? "s" : "" } ( ${ SUST_N .slice ( 0 , alvo .n) .map ((x) => x + "♯" ) .join ( ", " ) } ). A tonalidade é meio tom acima do último sustenido.` ;
else why = ` ${ alvo .n } ${ alvo .n > 1 ? "bemóis" : "bemol" } ( ${ BEM_N .slice ( 0 , alvo .n) .map ((x) => x + "♭" ) .join ( ", " ) } ). ${ alvo .n === 1 ? "Com um bemol só, é Fá maior." : "A tonalidade é o penúltimo bemol." } ` ;
c .choices ( draw .shuffle ( lista .map ((r) => r .tonalidade)) , alvo .tonalidade , { item : alvo .tonalidade , why });
} ,
});