Files
bruitiste/src/config/effects.ts
2025-09-30 14:20:50 +02:00

162 lines
2.9 KiB
TypeScript

import type { EffectConfig } from '../types/effects'
export const ENGINE_CONTROLS: EffectConfig[] = [
{
id: 'engine',
name: 'Engine',
parameters: [
{
id: 'sampleRate',
label: 'Sample Rate',
min: 0,
max: 3,
default: 1,
step: 1,
unit: ''
},
{
id: 'loopDuration',
label: 'Loop',
min: 2,
max: 8,
default: 4,
step: 2,
unit: 's'
},
{
id: 'complexity',
label: 'Complexity',
min: 0,
max: 2,
default: 1,
step: 1,
unit: ''
},
{
id: 'bitDepth',
label: 'Bit Depth',
min: 0,
max: 2,
default: 0,
step: 1,
unit: ''
},
{
id: 'masterVolume',
label: 'Volume',
min: 0,
max: 100,
default: 75,
step: 1,
unit: '%'
}
]
}
]
export const EFFECTS: EffectConfig[] = [
{
id: 'reverb',
name: 'Reverb',
parameters: [
{
id: 'reverbWetDry',
label: 'Reverb',
min: 0,
max: 100,
default: 0,
step: 1,
unit: '%'
}
]
},
{
id: 'delay',
name: 'Ping Pong Delay',
parameters: [
{
id: 'delayTime',
label: 'Time',
min: 0,
max: 1000,
default: 250,
step: 10,
unit: 'ms'
},
{
id: 'delayFeedback',
label: 'Feedback',
min: 0,
max: 100,
default: 50,
step: 1,
unit: '%'
}
]
},
{
id: 'bitcrush',
name: 'Bitcrush',
parameters: [
{
id: 'bitcrushDepth',
label: 'Depth',
min: 1,
max: 16,
default: 16,
step: 1,
unit: 'bit'
},
{
id: 'bitcrushRate',
label: 'Rate',
min: 0,
max: 100,
default: 0,
step: 1,
unit: '%'
}
]
},
{
id: 'clipmode',
name: 'Clip Mode',
parameters: [
{
id: 'clipMode',
label: 'Mode',
min: 0,
max: 2,
default: 0,
step: 1,
unit: ''
}
]
}
]
export function getDefaultEffectValues(): Record<string, number> {
const defaults: Record<string, number> = {}
EFFECTS.forEach(effect => {
effect.parameters.forEach(param => {
defaults[param.id] = param.default
})
})
return defaults
}
export function getDefaultEngineValues(): Record<string, number> {
const defaults: Record<string, number> = {}
ENGINE_CONTROLS.forEach(control => {
control.parameters.forEach(param => {
defaults[param.id] = param.default
})
})
return defaults
}
export const SAMPLE_RATES = [4000, 8000, 16000, 22050]
export function getSampleRateFromIndex(index: number): number {
return SAMPLE_RATES[index] || 8000
}