A professional-grade distortion plugin inspired by Nani Distortions, featuring multiple distortion algorithms, real-time audio processing, and a modern, intuitive interface.
- Soft Clip: Tube-like saturation with smooth harmonic generation
- Hard Clip: Aggressive clipping for intense distortion
- Foldback: Wave folding distortion for complex harmonics
- Bit Crusher: Digital bit reduction for lo-fi effects
- Wave Folder: Complex wave folding for experimental sounds
- Polynomial: Harmonic distortion with mathematical precision
- Drive: Controls the amount of distortion applied
- Tone: Pre and post-filtering for tone shaping
- Mix: Blend between dry and processed signal
- Output: Master output level control
- Real-time waveform visualization
- Intuitive knob controls with value displays
- Built-in presets for quick setup
- Responsive design with professional styling
- Web Audio API integration
- AudioWorklet support for low-latency processing
- Fallback to ScriptProcessor for compatibility
- Stereo processing support
- Node.js (v14 or higher)
- Modern web browser with Web Audio API support
- Clone or download the plugin
- Install dependencies:
npm install- Build the plugin:
npm run build- Open
demo.htmlin your browser to test the plugin
import NaniStyleDistortion from './dist/index.js';
// Create plugin instance
const distortion = new NaniStyleDistortion({
container: document.getElementById('plugin-container'),
autoInitialize: true
});
// Set parameters
distortion.setDrive(0.7);
distortion.setTone(0.6);
distortion.setMix(0.8);
distortion.setOutput(0.5);
distortion.setDistortionType('soft');
// Connect to audio
const audioContext = new AudioContext();
const input = audioContext.createMediaStreamSource(stream);
const output = audioContext.destination;
await distortion.connectAudio(input, output);// Load presets
const presets = distortion.getPresets();
distortion.loadPreset(presets[0]); // Load first preset
// Get current parameters
const params = distortion.getParameters();
console.log(params);
// Process audio data offline
const audioData = new Float32Array(1024);
const processed = distortion.processAudioData(audioData);
// Process stereo audio
const leftChannel = new Float32Array(1024);
const rightChannel = new Float32Array(1024);
const stereoResult = distortion.processStereoAudioData(leftChannel, rightChannel);const options = {
container: HTMLElement, // DOM element for UI
autoInitialize: boolean // Auto-initialize on creation
};setDrive(value)- Set drive amount (0-1)setTone(value)- Set tone control (0-1)setMix(value)- Set mix amount (0-1)setOutput(value)- Set output level (0-1)setDistortionType(type)- Set distortion algorithm
connectAudio(input, output)- Connect audio nodesdisconnectAudio()- Disconnect audioprocessAudioData(data)- Process audio bufferprocessStereoAudioData(left, right)- Process stereo audio
getParameters()- Get current parametersgetPresets()- Get available presetsloadPreset(preset)- Load a presetreset()- Reset to default statedestroy()- Clean up resources
- Description: Tube-like saturation with smooth harmonic generation
- Best for: Warm, musical distortion
- Characteristics: Smooth compression, even harmonics
- Description: Aggressive clipping for intense distortion
- Best for: Heavy, aggressive sounds
- Characteristics: Sharp clipping, rich harmonics
- Description: Wave folding distortion for complex harmonics
- Best for: Experimental and industrial sounds
- Characteristics: Complex harmonic content, aliasing effects
- Description: Digital bit reduction for lo-fi effects
- Best for: Retro and digital distortion
- Characteristics: Quantization noise, digital artifacts
- Description: Complex wave folding for experimental sounds
- Best for: Modular synth-style distortion
- Characteristics: Complex modulation, frequency folding
- Description: Harmonic distortion with mathematical precision
- Best for: Precise harmonic control
- Characteristics: Controlled harmonics, mathematical accuracy
The plugin includes 6 built-in presets:
- Tube - Warm tube saturation
- Fuzz - Aggressive fuzz distortion
- Bit Crush - Digital bit crushing
- Fold - Wave folding distortion
- Wave - Complex wave folding
- Poly - Polynomial distortion
- Chrome 66+ (AudioWorklet support)
- Firefox 76+ (AudioWorklet support)
- Safari 14.1+ (AudioWorklet support)
- Edge 79+ (AudioWorklet support)
For older browsers, the plugin falls back to ScriptProcessor (deprecated but functional).
NaniStyleDistortion/
├── src/
│ ├── DistortionEngine.js # Core distortion algorithms
│ ├── AudioProcessor.js # Web Audio API integration
│ ├── UI.js # User interface
│ └── index.js # Main entry point
├── dist/
│ └── index.js # Built plugin
├── demo.html # Demo page
├── distortion-worklet.js # AudioWorklet processor
├── package.json # Dependencies
├── webpack.config.js # Build configuration
└── README.md # This file
# Development build with watch
npm run dev
# Production build
npm run build
# Run tests
npm test// In DistortionEngine.js
newDistortionType(input, drive) {
// Your distortion algorithm here
return processedInput;
}
// Add to switch statement in process() method
case 'newtype':
processed = this.newDistortionType(processed, this.drive);
break;const customPreset = {
name: 'Custom',
drive: 0.5,
tone: 0.7,
mix: 0.9,
output: 0.6,
type: 'soft'
};
distortion.loadPreset(customPreset);MIT License - see LICENSE file for details.
- Test in a wider browser spectrun js plugin
- Complete migration to vst (ableton compatible) plugin (c++)
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
- Inspired by Nani Distortions plugin
- Built with Web Audio API
- Uses modern JavaScript features
- Designed for professional audio applications
For issues, questions, or feature requests, please open an issue on the repository.
NaniStyle Distortion - Professional distortion processing for the web.