19 lines
658 B
TypeScript
19 lines
658 B
TypeScript
import * as Tone from 'tone';
|
|
|
|
export function createPadSynth(isDay: boolean): Tone.PolySynth {
|
|
return new Tone.PolySynth(Tone.Synth, {
|
|
oscillator: {
|
|
type: 'fatsine', // Fat oscillator creates multiple detuned voices for lush sound
|
|
count: 3, // Number of detuned oscillators
|
|
spread: 30 // Amount of detune in cents for width and movement
|
|
},
|
|
envelope: {
|
|
attack: isDay ? 2.0 : 3.0, // Longer, smoother attack
|
|
decay: 1.5,
|
|
sustain: 0.85, // Higher sustain for consistent pad presence
|
|
release: isDay ? 2.5 : 4.0 // Longer release for smooth tail-off
|
|
},
|
|
volume: -14 // Quieter to sit back in the mix and reduce mid heaviness
|
|
});
|
|
}
|