25 lines
606 B
JavaScript
25 lines
606 B
JavaScript
const INITIAL_STEPS = 16;
|
|
const INITIAL_TEMPO = 76;
|
|
const INSTRUMENTS_LENGTH = 5;
|
|
|
|
const createEmptyGrid = (steps) => {
|
|
return Array.from({ length: INSTRUMENTS_LENGTH }, () => Array(steps).fill(false));
|
|
};
|
|
|
|
const createEmptyBassLine = (steps) => {
|
|
return Array.from({ length: steps }, () => []);
|
|
}
|
|
|
|
const defaultState = {
|
|
grid: createEmptyGrid(INITIAL_STEPS),
|
|
bassLine: createEmptyBassLine(INITIAL_STEPS),
|
|
tempo: INITIAL_TEMPO,
|
|
steps: INITIAL_STEPS,
|
|
mutes: Array(INSTRUMENTS_LENGTH).fill(false),
|
|
drumVolume: 1,
|
|
bassVolume: 0.4,
|
|
isPlaying: false
|
|
};
|
|
|
|
module.exports = { defaultState };
|