tools:skalentrainer
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.
Beide Seiten, vorherige ÜberarbeitungVorherige ÜberarbeitungNächste Überarbeitung | Vorherige Überarbeitung | ||
tools:skalentrainer [15/05/2025 11:27] – Eric Weber | tools:skalentrainer [22/05/2025 16:31] (aktuell) – Eric Weber | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ====== Skalentrainer ====== | ||
- | |||
- | |||
< | < | ||
< | < | ||
Zeile 20: | Zeile 17: | ||
color: #2c3e50; | color: #2c3e50; | ||
text-align: center; | text-align: center; | ||
+ | } | ||
+ | .container { | ||
+ | background-color: | ||
+ | border-radius: | ||
+ | padding: 20px; | ||
+ | box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | ||
+ | margin-bottom: | ||
} | } | ||
.flex-row { | .flex-row { | ||
Zeile 106: | Zeile 110: | ||
# | # | ||
display: none; | display: none; | ||
+ | } | ||
+ | .practice-scales-container { | ||
+ | display: grid; | ||
+ | grid-template-columns: | ||
+ | gap: 15px; | ||
+ | margin: 20px 0; | ||
+ | } | ||
+ | .practice-scale-btn { | ||
+ | background-color: | ||
+ | color: #2c3e50; | ||
+ | border: 2px solid #bdc3c7; | ||
+ | padding: 15px; | ||
+ | border-radius: | ||
+ | cursor: pointer; | ||
+ | font-size: 16px; | ||
+ | font-weight: | ||
+ | text-align: center; | ||
+ | transition: all 0.2s; | ||
+ | } | ||
+ | .practice-scale-btn: | ||
+ | background-color: | ||
+ | transform: translateY(-2px); | ||
+ | box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); | ||
+ | } | ||
+ | .practice-scale-btn: | ||
+ | transform: translateY(0); | ||
+ | box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); | ||
+ | } | ||
+ | .practice-scale-btn.playing { | ||
+ | background-color: | ||
+ | color: black; | ||
+ | border-color: | ||
} | } | ||
.quiz-options { | .quiz-options { | ||
Zeile 201: | Zeile 237: | ||
</ | </ | ||
< | < | ||
+ | < | ||
| | ||
<div class=" | <div class=" | ||
Zeile 260: | Zeile 297: | ||
<div id=" | <div id=" | ||
< | < | ||
- | <div class=" | + | |
- | < | + | |
- | <span class=" | + | |
+ | <!-- Practice scale buttons will be generated here --> | ||
+ | | ||
+ | |||
+ | | ||
<button id=" | <button id=" | ||
</ | </ | ||
Zeile 299: | Zeile 340: | ||
let audioContext; | let audioContext; | ||
let currentMode = " | let currentMode = " | ||
- | let allScalesSelected = true; | + | let allScalesSelected = false; |
let quizInProgress = false; | let quizInProgress = false; | ||
let currentQuizQuestion = 0; | let currentQuizQuestion = 0; | ||
Zeile 307: | Zeile 348: | ||
let currentScale; | let currentScale; | ||
let questionAnswered = false; | let questionAnswered = false; | ||
+ | let currentlyPlayingScale = null; | ||
// Function to stop all audio | // Function to stop all audio | ||
Zeile 314: | Zeile 356: | ||
resetQuiz(); | resetQuiz(); | ||
} | } | ||
+ | | ||
+ | // Reset practice scale visual state | ||
+ | resetPracticeScaleButtons(); | ||
| | ||
// If audio context exists, cancel all scheduled sounds | // If audio context exists, cancel all scheduled sounds | ||
Zeile 338: | Zeile 383: | ||
document.getElementById(" | document.getElementById(" | ||
} | } | ||
+ | } | ||
+ | |||
+ | // Reset practice scale button visual states | ||
+ | function resetPracticeScaleButtons() { | ||
+ | document.querySelectorAll(" | ||
+ | btn.classList.remove(" | ||
+ | }); | ||
+ | currentlyPlayingScale = null; | ||
} | } | ||
Zeile 344: | Zeile 397: | ||
// Set up event listeners | // Set up event listeners | ||
document.getElementById(" | document.getElementById(" | ||
- | document.getElementById(" | ||
document.getElementById(" | document.getElementById(" | ||
document.getElementById(" | document.getElementById(" | ||
Zeile 356: | Zeile 408: | ||
setMode(this.dataset.mode); | setMode(this.dataset.mode); | ||
stopAllAudio(); | stopAllAudio(); | ||
+ | updatePracticeScales(); | ||
}); | }); | ||
}); | }); | ||
Zeile 361: | Zeile 414: | ||
// Add event listeners to stop audio when settings change | // Add event listeners to stop audio when settings change | ||
document.querySelectorAll(" | document.querySelectorAll(" | ||
- | checkbox.addEventListener(" | + | checkbox.addEventListener(" |
+ | | ||
+ | updatePracticeScales(); | ||
+ | }); | ||
}); | }); | ||
- | // Initialize progress markers | + | // Initialize progress markers |
initializeProgressMarkers(); | initializeProgressMarkers(); | ||
+ | updatePracticeScales(); | ||
}); | }); | ||
Zeile 378: | Zeile 435: | ||
| | ||
document.getElementById(" | document.getElementById(" | ||
+ | updatePracticeScales(); | ||
} | } | ||
Zeile 391: | Zeile 449: | ||
} | } | ||
}); | }); | ||
+ | } | ||
+ | |||
+ | // Update practice scales display | ||
+ | function updatePracticeScales() { | ||
+ | const container = document.getElementById(" | ||
+ | container.innerHTML = ""; | ||
| | ||
+ | const selectedScales = getSelectedScales(); | ||
+ | | ||
+ | if (selectedScales.length === 0) { | ||
+ | container.innerHTML = "<p style=' | ||
+ | return; | ||
+ | } | ||
+ | | ||
+ | selectedScales.forEach(scale => { | ||
+ | const button = document.createElement(" | ||
+ | button.className = " | ||
+ | button.textContent = getScaleName(scale); | ||
+ | button.dataset.scale = scale; | ||
+ | | ||
+ | button.addEventListener(" | ||
+ | playPracticeScale(scale, | ||
+ | }); | ||
+ | | ||
+ | container.appendChild(button); | ||
+ | }); | ||
+ | } | ||
+ | // Play a practice scale | ||
+ | function playPracticeScale(scale, | ||
+ | // Reset all button states | ||
+ | resetPracticeScaleButtons(); | ||
+ | | ||
+ | // Set current button as playing | ||
+ | buttonElement.classList.add(" | ||
+ | currentlyPlayingScale = scale; | ||
+ | | ||
+ | const startNote = getScaleStartNote(scale); | ||
+ | | ||
+ | playScale(scale, | ||
+ | // Remove playing state after scale finishes | ||
+ | if (currentlyPlayingScale === scale) { | ||
+ | buttonElement.classList.remove(" | ||
+ | currentlyPlayingScale = null; | ||
+ | } | ||
+ | }); | ||
} | } | ||
Zeile 572: | Zeile 674: | ||
setTimeout(callback, | setTimeout(callback, | ||
} | } | ||
- | } | ||
- | |||
- | // Practice all selected scales | ||
- | function startPractice() { | ||
- | if (!isAnyScaleSelected()) { | ||
- | alert(" | ||
- | return; | ||
- | } | ||
- | | ||
- | const scales = getSelectedScales(); | ||
- | initAudioContext(); | ||
- | | ||
- | let index = 0; | ||
- | const playNextScale = () => { | ||
- | if (index < scales.length) { | ||
- | const scale = scales[index]; | ||
- | const startNote = getScaleStartNote(scale); | ||
- | playScale(scale, | ||
- | index++; | ||
- | setTimeout(playNextScale, | ||
- | }); | ||
- | } | ||
- | }; | ||
- | | ||
- | playNextScale(); | ||
} | } | ||
tools/skalentrainer.1747301225.txt.gz · Zuletzt geändert: von Eric Weber