diff --git a/src/samples/drums/tom-high.ts b/src/samples/drums/tom-high.ts deleted file mode 100644 index fb96689..0000000 --- a/src/samples/drums/tom-high.ts +++ /dev/null @@ -1,10 +0,0 @@ -import {triggerTom} from './tom-low.ts'; - -export function playTom2High(volume = 100) { - triggerTom(volume, { - frequency: 250, // Higher frequency for high tom - decayTime: 0.3, // Shorter decay - pitchDecay: 0.3, // Fast pitch decay - frequencyDrop: 0.9 // Moderate frequency drop - }); -} diff --git a/src/samples/drums/tom-low.ts b/src/samples/drums/toms.ts similarity index 74% rename from src/samples/drums/tom-low.ts rename to src/samples/drums/toms.ts index 5a2269c..1d54553 100644 --- a/src/samples/drums/tom-low.ts +++ b/src/samples/drums/toms.ts @@ -56,11 +56,29 @@ export function triggerTom(volume = 50, settings = defaults) { osc.stop(time + settings.decayTime + 0.02); } -export function playTom1Low(volume = 100) { +export function playLowTom(volume = 100) { triggerTom(volume, { - frequency: 180, // Higher than kick but lower than high tom + frequency: 160, // Lower than mid tom + decayTime: 0.45, // Longer decay + pitchDecay: 0.25, // More pitch decay + frequencyDrop: 0.6 // More pronounced drop than mid tom + }); +} + +export function playMidTom(volume = 100) { + triggerTom(volume, { + frequency: 220, // Between low and high tom decayTime: 0.35, // Medium decay pitchDecay: 0.15, // Medium pitch decay frequencyDrop: 0.4 // More pronounced drop than high tom }); } + +export function playHighTom(volume = 100) { + triggerTom(volume, { + frequency: 280, // Higher than low tom + decayTime: 0.3, // Shorter decay + pitchDecay: 0.1, // Less pitch decay + frequencyDrop: 0.3 // Less pronounced drop than low tom + }); +} diff --git a/src/samples/play-sample.ts b/src/samples/play-sample.ts index 41447dc..231fc15 100644 --- a/src/samples/play-sample.ts +++ b/src/samples/play-sample.ts @@ -4,10 +4,9 @@ import {playSnare} from './drums/snare.ts'; import {playCrashCymbal} from './drums/crash.ts'; import {playOpenHiHat} from './drums/hihat-open.ts'; import {playRide} from './drums/ride.ts'; -import {playTom1Low} from './drums/tom-low.ts'; -import {playTom2High} from './drums/tom-high.ts'; import {resetAudioContext} from './sample-utils.ts'; import {logger} from '../utils/logger.ts'; +import {playHighTom, playLowTom, playMidTom} from './drums/toms.ts'; const sampleToAudioFn: Record void> = { hihat: playHiHat, @@ -16,8 +15,9 @@ const sampleToAudioFn: Record void> = { crash: playCrashCymbal, 'hihat-open': playOpenHiHat, ride: playRide, - 'tom-low': playTom1Low, - 'tom-high': playTom2High, + 'tom-low': playLowTom, + 'tom-high': playHighTom, + 'tom-mid': playMidTom, } export const playSample = (sample: Sample, volume: number) => { @@ -34,4 +34,4 @@ export const playSample = (sample: Sample, volume: number) => { } export type Sample = 'hihat' | 'hihat-open' | 'ride' | 'crash' - | 'snare' | 'kick' | 'tom-low' | 'tom-high'; + | 'snare' | 'kick' | 'tom-low' | 'tom-high' | 'tom-mid'; diff --git a/src/scenes/DrumsScene.ts b/src/scenes/DrumsScene.ts index 4918ae5..b9bce5b 100644 --- a/src/scenes/DrumsScene.ts +++ b/src/scenes/DrumsScene.ts @@ -11,6 +11,7 @@ const padColors: Record = { ride: Colors.yellow2, 'tom-low': Colors.orange2, 'tom-high': Colors.purple, + 'tom-mid': Colors.pink, }; // create same object but instead of instrument, name colors @@ -18,18 +19,22 @@ const padColors: Record = { export class DrumsScene extends PadsScene { private instruments: Sample[] = [ + // cymbals + 'crash', 'crash', 'ride', 'hihat-open', 'hihat', + // drums 'snare', - 'tom-low', 'tom-high', + 'tom-mid', + 'tom-low', 'kick', ] constructor() { - super(2, 4); + super(2, 5); } protected getPadColor(_numberOfPads: number, _index: number) { diff --git a/src/utils/colors.ts b/src/utils/colors.ts index 24a1e12..b7ef59e 100644 --- a/src/utils/colors.ts +++ b/src/utils/colors.ts @@ -18,6 +18,7 @@ export const Colors = { yellow2: '#F5C542', orange2: '#FF7F50', purple: '#9B59B6', + pink: '#FFC0CB', } as const; export type PhaserColor = Phaser.Display.Color; @@ -59,6 +60,9 @@ export const PhaserColors = { get purple() { return hexToColor(Colors.purple); }, + get pink() { + return hexToColor(Colors.pink); + }, } as const satisfies Record; // @Deprecated