Files
audio-ui/lib/audio/effects/reverse.ts
Sebastian Krüger ee48f9475f feat: add advanced audio effects and improve UI
Phase 6.5 Advanced Effects:
- Add Pitch Shifter with semitones and cents adjustment
- Add Time Stretch with pitch preservation using overlap-add
- Add Distortion with soft/hard/tube types and tone control
- Add Bitcrusher with bit depth and sample rate reduction
- Add AdvancedParameterDialog with real-time waveform visualization
- Add 4 professional presets per effect type

Improvements:
- Fix undefined parameter errors by adding nullish coalescing operators
- Add global custom scrollbar styling with color-mix transparency
- Add custom-scrollbar utility class for side panel
- Improve theme-aware scrollbar appearance in light/dark modes
- Fix parameter initialization when switching effect types

Integration:
- All advanced effects support undo/redo via EffectCommand
- Effects accessible via command palette and side panel
- Selection-based processing support
- Toast notifications for all effects

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 20:03:40 +01:00

32 lines
785 B
TypeScript

/**
* Reverse audio effect
*/
import { getAudioContext } from '../context';
/**
* Reverse audio buffer
* @param buffer - Source audio buffer
* @returns New audio buffer with reversed audio
*/
export function reverseAudio(buffer: AudioBuffer): AudioBuffer {
const audioContext = getAudioContext();
const outputBuffer = audioContext.createBuffer(
buffer.numberOfChannels,
buffer.length,
buffer.sampleRate
);
// Reverse each channel
for (let channel = 0; channel < buffer.numberOfChannels; channel++) {
const inputData = buffer.getChannelData(channel);
const outputData = outputBuffer.getChannelData(channel);
for (let i = 0; i < buffer.length; i++) {
outputData[i] = inputData[buffer.length - 1 - i];
}
}
return outputBuffer;
}