Initial commit

This commit is contained in:
AG
2025-12-20 16:32:05 +02:00
commit f430c2b757
31 changed files with 4797 additions and 0 deletions

39
public/constants.ts Normal file
View File

@@ -0,0 +1,39 @@
import { Instrument } from './types';
export const INSTRUMENTS: Instrument[] = [
{ name: 'Kick' },
{ name: 'Snare' },
{ name: 'Hi-Hat' },
{ name: 'Open Hat' },
{ name: 'Ride' },
];
export const INITIAL_TEMPO = 76;
export const INITIAL_STEPS = 16;
export const MIN_TEMPO = 40;
export const MAX_TEMPO = 240;
export const MIN_STEPS = 4;
export const MAX_STEPS = 64;
// --- BASS CONSTANTS ---
const NOTE_NAMES = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'];
const getFrequency = (midiNote: number): number => {
// A4 (MIDI 69) is 440 Hz
return 440 * Math.pow(2, (midiNote - 69) / 12);
};
export const BASS_NOTES: { name: string; isSharp: boolean }[] = [];
export const NOTE_FREQ_MAP: { [key: string]: number } = {};
// Generate notes for 2 octaves, starting from C2 (MIDI 36) up to B3
for (let octave = 2; octave < 4; octave++) {
for (let i = 0; i < 12; i++) {
const noteName = `${NOTE_NAMES[i]}${octave}`;
const midiNote = 36 + (octave - 2) * 12 + i;
BASS_NOTES.push({ name: noteName, isSharp: NOTE_NAMES[i].includes('#') });
NOTE_FREQ_MAP[noteName] = getFrequency(midiNote);
}
}