From 2f14f5d0977ef8d32055a365a29ff6beae6f4df3 Mon Sep 17 00:00:00 2001 From: jay23606 Date: Tue, 10 Nov 2026 20:16:21 -0500 Subject: [PATCH] Add a Reggae style (one drop) and map iReal Reggae to it --- src/formats/ireal.ts | 3 +- src/styles/index.ts | 3 +- src/styles/library/reggae.ts | 119 +++++++++++++++++++++++++++++++++++ tests/styles.test.ts | 1 + 4 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 src/styles/library/reggae.ts diff --git a/src/formats/ireal.ts b/src/formats/ireal.ts index a8f507e..d608046 100644 --- a/src/formats/ireal.ts +++ b/src/formats/ireal.ts @@ -36,7 +36,8 @@ export function mapStyle(name: string, time: TimeSignature = [4, 4]): string { if (/shuffle|blues|boogie|rock'?n'?roll/.test(s) && !/swing/.test(s)) return 'shuffle' if (/ballad/.test(s) && !/pop|rock|rnb|soul|country|folk/.test(s)) return inThree ? 'jazz-waltz' : 'ballad' if (/swing|bop|jazz|gypsy|trad|new orleans|second line/.test(s)) return inThree ? 'jazz-waltz' : 'medium-swing' - if (/pop|rock|even|reggae|country|folk|house|smooth|bluegrass|ballad/.test(s)) return 'pop-rock' + if (/reggae/.test(s)) return 'reggae' + if (/pop|rock|even|country|folk|house|smooth|bluegrass|ballad/.test(s)) return 'pop-rock' return inThree ? 'jazz-waltz' : 'medium-swing' } diff --git a/src/styles/index.ts b/src/styles/index.ts index 4a13cbc..de9a136 100644 --- a/src/styles/index.ts +++ b/src/styles/index.ts @@ -4,11 +4,12 @@ import { funk } from './library/funk' import { jazzWaltz } from './library/jazz-waltz' import { mediumSwing } from './library/medium-swing' import { popRock } from './library/pop-rock' +import { reggae } from './library/reggae' import { samba } from './library/samba' import { shuffle } from './library/shuffle' import type { StyleDefinition } from './types' -export const STYLES: StyleDefinition[] = [mediumSwing, ballad, jazzWaltz, bossaNova, samba, popRock, funk, shuffle] +export const STYLES: StyleDefinition[] = [mediumSwing, ballad, jazzWaltz, bossaNova, samba, popRock, funk, shuffle, reggae] export function getStyle(id: string): StyleDefinition { return STYLES.find((s) => s.id === id) ?? STYLES[0] diff --git a/src/styles/library/reggae.ts b/src/styles/library/reggae.ts new file mode 100644 index 0000000..9ded3cb --- /dev/null +++ b/src/styles/library/reggae.ts @@ -0,0 +1,119 @@ +import type { DrumHit, StyleDefinition } from '../types' + +// One drop: kick and rim together on beat 3 only, nothing on beat 1 +const offbeatHats: DrumHit[] = Array.from({ length: 8 }, (_, i): DrumHit => [i / 2, 'hhClosed', i % 2 === 0 ? 70 : 85]) + +export const reggae: StyleDefinition = { + id: 'reggae', + name: 'Reggae', + family: 'world', + swing: 0.5, + tempo: { default: 80, min: 60, max: 110 }, + + bass: { + mode: 'pattern', + program: 33, // fingered electric bass + range: [28, 50], + patterns: { + '4': [ + // Riff that leaves beat one empty: root, fifth, octave + [ + { at: 1, dur: 0.9, tone: 'R' }, + { at: 2.5, dur: 0.42, tone: '5' }, + { at: 3, dur: 0.9, tone: '8' }, + ], + [ + { at: 0.5, dur: 0.42, tone: 'R' }, + { at: 1, dur: 0.9, tone: 'R' }, + { at: 2.5, dur: 0.42, tone: '5' }, + { at: 3.5, dur: 0.42, tone: 'app' }, + ], + ], + '2': [ + [ + { at: 1, dur: 0.9, tone: 'R' }, + { at: 1.5, dur: 0.42, tone: '5' }, + ], + ], + '1': [[{ at: 0.5, dur: 0.42, tone: 'R' }]], + }, + }, + + comp: { + program: 27, // clean electric guitar: the skank + voicing: 'close', + velocity: [60, 76], + rhythms: { + // Short chords on the off-beats only + '4': [ + [ + [0.5, 0.3], + [1.5, 0.3], + [2.5, 0.3], + [3.5, 0.3], + ], + [ + [1.5, 0.3], + [2.5, 0.3], + [3.5, 0.3], + ], + ], + '2': [ + [ + [0.5, 0.3], + [1.5, 0.3], + ], + ], + '1': [[[0.5, 0.3]]], + }, + }, + + drums: { + kit: 0, + countIn: [ + [0, 'hhClosed', 90], + [1, 'hhClosed', 80], + [2, 'hhClosed', 80], + [3, 'hhClosed', 80], + ], + grooves: { + middle: [ + { + bars: 1, + hits: [ + ...offbeatHats, + [2, 'kick', 105], + [2, 'sidestick', 100], + [3.5, 'hhOpen', 70, 0.3], + ], + }, + { + bars: 1, + hits: [ + ...offbeatHats, + [2, 'kick', 105], + [2, 'sidestick', 100], + [3.75, 'hhOpen', 70, 0.5], + ], + }, + ], + last: [ + { + bars: 1, + hits: [ + ...offbeatHats.slice(0, 4), + [2, 'kick', 105], + [2, 'sidestick', 100], + [3, 'tomHigh', 90], + [3.5, 'tomMid', 95], + ], + }, + ], + }, + ending: [ + [0, 'crash', 110, 1, 3], + [2, 'kick', 105], + [2, 'sidestick', 100], + ], + }, +} diff --git a/tests/styles.test.ts b/tests/styles.test.ts index 67c7b3a..a7963e8 100644 --- a/tests/styles.test.ts +++ b/tests/styles.test.ts @@ -37,6 +37,7 @@ describe('styles', () => { expect(mapStyle('Slow Blues')).toBe('shuffle') expect(mapStyle('Rock Pop')).toBe('pop-rock') expect(mapStyle('Ballad')).toBe('ballad') + expect(mapStyle('Reggae')).toBe('reggae') }) test('a waltz counts in "1 . . | 1 2 3" and keeps its bars three beats long', () => {