Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/formats/ireal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}

Expand Down
3 changes: 2 additions & 1 deletion src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
119 changes: 119 additions & 0 deletions src/styles/library/reggae.ts
Original file line number Diff line number Diff line change
@@ -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],
],
},
}
1 change: 1 addition & 0 deletions tests/styles.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down