diff --git a/README.md b/README.md
index aa974a0..a775de9 100644
--- a/README.md
+++ b/README.md
@@ -50,6 +50,7 @@ OpenStand is an **early but usable** practice tool. What works today:
- **A real-looking lead sheet.** Chord symbols in a handwritten jazz hand (Petaluma), rehearsal marks, repeat signs, endings, segno and coda, correct flat/sharp spelling in every key, and the current bar marked with a highlighter stroke as it plays.
- **Practice controls:** tempo (40–300 BPM, changes instantly), transpose to any key while playing, number of choruses, and a count-in in the tune's meter (4/4 "1 . 2 . 1 2 3 4", 6/8 two pulses then six eighths). Keyboard shortcuts: Space to play/stop, ↑/↓ for ±5 BPM, →/← to transpose by a half step, and L to clear the loop. Shortcuts are inactive while editing a chart or focusing a form control.
- **Practice modes:** loop any bars or a rehearsal section, go round all 12 keys (or step up a half or whole tone each chorus), and speed up a few BPM every chorus.
+- **Switch a tune between major and minor (same tonic) with one click.**
- **Transposing instruments:** read the chart in Bb or Eb while the band plays in concert pitch.
- **Chord and scale helper:** keyboard, guitar diagrams and fitting scales for any chord.
- **Style lab:** change a style's drums (a main groove, a variation the band switches to, and a fill for the end of the form), bass line and chord rhythm on a grid (each with an optional second pattern the band switches to) and hear it while the band plays. Save your styles and pick them from the style menu, share one as a link, or send it to the project as a new style.
diff --git a/src/App.tsx b/src/App.tsx
index 4ab722d..416e5dc 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useEffect, useRef, useState } from 'react'
+import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { Player } from './audio/player'
import { arrange, BASE_BPM, CHANNELS, type Part } from './engine/arrange'
import { warmUpMidi } from './engine/warmup'
@@ -26,7 +26,8 @@ import { Popover } from './ui/Popover'
import { NO_PRACTICE, type PracticeSettings } from './music/practice'
import { Practice } from './ui/Practice'
import { StyleLab } from './ui/StyleLab'
-import { Transport, type Readiness } from './ui/Transport'
+import { switchMode } from './music/mode'
+import { Transport, type ModeOption, type Readiness } from './ui/Transport'
import { handlePracticeShortcut, type PracticeShortcuts } from './ui/shortcuts'
interface Position {
@@ -207,9 +208,14 @@ export default function App() {
const [draft, setDraft] = useState(null)
const [editBar, setEditBar] = useState(0)
const [irealState, setIrealState] = useState<'idle' | 'copied' | 'failed'>('idle')
+ const [mode, setMode] = useState('original')
const tune = tunes.find((t) => t.id === songId) ?? tunes[0] ?? EXAMPLES[0]
- const chart = draft?.chart ?? tune.chart
+ const baseChart = draft?.chart ?? tune.chart
+ const chart = useMemo(
+ () => (!draft && mode !== 'original' ? switchMode(baseChart, mode) : baseChart),
+ [baseChart, draft, mode],
+ )
// The lab's style is rebuilt from the grid each time it is needed
// Saved styles are chosen as "my:"
const styleFor = (id: string, current: LabStyle | null, mine: LabStyle[]): StyleDefinition => {
@@ -299,12 +305,12 @@ export default function App() {
playerRef.current?.setRate(liveBpm / BASE_BPM)
}, [liveBpm])
- const start = async (opts: ArrangeOptions, fromSeconds = 0) => {
+ const start = async (opts: ArrangeOptions, fromSeconds = 0, chartToUse = chart) => {
const player = playerRef.current
if (!player) return
setNotice(null)
const { loop, keyStep } = opts.practice
- const { midi, timeline } = arrange(chart, resolveStyle(opts.styleId), opts.transpose, opts.choruses, { loop, keyStep })
+ const { midi, timeline } = arrange(chartToUse, resolveStyle(opts.styleId), opts.transpose, opts.choruses, { loop, keyStep })
timelineRef.current = timeline
try {
await player.play(midi, fromSeconds)
@@ -336,6 +342,16 @@ export default function App() {
if (playing && player) void start(next, loopChanged ? 0 : player.position)
}
+ const changeMode = (nextMode: ModeOption) => {
+ setMode(nextMode)
+ setSelectedChord(null)
+ const nextChart = !draft && nextMode !== 'original' ? switchMode(baseChart, nextMode) : baseChart
+ const player = playerRef.current
+ if (playing && player) {
+ void start({ styleId, transpose, choruses, practice }, player.position, nextChart)
+ }
+ }
+
const changePractice = (next: PracticeSettings) => {
// Going round the keys needs enough choruses to get back home
const keysNeeded = next.keyStep ? 12 / gcd(next.keyStep, 12) : 0
@@ -392,6 +408,7 @@ export default function App() {
setSongId(next.id)
setStyleId(labRef.current ? LAB_STYLE : next.chart.style)
setTranspose(0)
+ setMode('original')
setBpm(next.chart.bpm)
setPractice((p) => ({ ...p, loop: null }))
setPicking(null)
@@ -660,13 +677,13 @@ export default function App() {
{() => (