{"_id":"@affectively/wasm-audio-processor","_rev":"4-f07033d2ec68b9ba3775d83cb2f33382","name":"@affectively/wasm-audio-processor","dist-tags":{"latest":"5.0.0"},"versions":{"1.0.0":{"name":"@affectively/wasm-audio-processor","version":"1.0.0","keywords":["wasm","webassembly","audio","audio-processing","mixing","rust","performance"],"author":{"name":"AFFECTIVELY","email":"opensource@affectively.app"},"license":"MIT","_id":"@affectively/wasm-audio-processor@1.0.0","maintainers":[{"name":"buley","email":"buley@outlook.com"}],"homepage":"https://github.com/affectively-ai/wasm-audio-processor#readme","bugs":{"url":"https://github.com/affectively-ai/wasm-audio-processor/issues"},"dist":{"shasum":"ee69dd8adec5b72fba93fc49581b26dd90a55378","tarball":"https://registry.npmjs.org/@affectively/wasm-audio-processor/-/wasm-audio-processor-1.0.0.tgz","fileCount":8,"integrity":"sha512-ARjqGjWJAB9bZfLYpDfqBNsgKFGYn7U8bXXmy8YE7ZeLDXjxIicrbxHI566iHbG5mHQx9buLoGVbhuVz0w7ugQ==","signatures":[{"sig":"MEQCIAoLLSbCYCVfPsPsZYfvw5dmwnQYu4QvNYBr0X+XYzV8AiAO/9ukXKcDcX2cRS4Jiuo8jpHM9CTX4NqsspdML20lkQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19076},"main":"pkg/wasm_audio_processor.js","types":"pkg/wasm_audio_processor.d.ts","gitHead":"f8a7ba297f384878a641692c37d70559975e0666","scripts":{"lint":"cargo clippy","test":"cargo test","build":"wasm-pack build --target web --out-dir pkg","build:node":"wasm-pack build --target nodejs --out-dir pkg-node","build:bundler":"wasm-pack build --target bundler --out-dir pkg-bundler"},"_npmUser":{"name":"buley","email":"buley@outlook.com"},"repository":{"url":"git+https://github.com/affectively-ai/wasm-audio-processor.git","type":"git"},"_npmVersion":"11.6.2","description":"High-performance WebAssembly audio processing utilities - mix streams, adjust volume, generate silence.","directories":{},"_nodeVersion":"24.11.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/wasm-audio-processor_1.0.0_1768339313256_0.6905091663813097","host":"s3://npm-registry-packages-npm-production"},"deprecated":"This package is deprecated and no longer supported. Do not use."},"1.0.1":{"name":"@affectively/wasm-audio-processor","version":"1.0.1","keywords":["wasm","webassembly","audio","audio-processing","mixing","rust","performance"],"author":{"name":"AFFECTIVELY","email":"opensource@affectively.ai"},"license":"MIT","_id":"@affectively/wasm-audio-processor@1.0.1","maintainers":[{"name":"buley","email":"buley@outlook.com"}],"homepage":"https://github.com/affectively-ai/wasm-audio-processor#readme","bugs":{"url":"https://github.com/affectively-ai/wasm-audio-processor/issues"},"dist":{"shasum":"2b32aa85b6c96df8dab8c5147993d0e476d6a7a0","tarball":"https://registry.npmjs.org/@affectively/wasm-audio-processor/-/wasm-audio-processor-1.0.1.tgz","fileCount":8,"integrity":"sha512-mI4Xl0rzObW0hx/Tx+HJDCMg9a0+cWSpa5LN6Rwh028Qyw+gGMZCkox5OTHHmwQ4YlOHwcXC/zU79e0wH+1CFA==","signatures":[{"sig":"MEUCIQCISG+JOyxcBkHMYF85BfyZpKrqeBHdfick9mnfTmSDPQIgafsE2q4MTBiW6yu+uvrAlDctxKMKClOJKQ77eRseA4k=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19025},"main":"pkg/wasm_audio_processor.js","types":"pkg/wasm_audio_processor.d.ts","gitHead":"c08b1dd0a1397fa026ac0acf032ef6570313d2c6","scripts":{"lint":"cargo clippy","test":"cargo test","build":"wasm-pack build --target web --out-dir pkg","build:node":"wasm-pack build --target nodejs --out-dir pkg-node","build:bundler":"wasm-pack build --target bundler --out-dir pkg-bundler"},"_npmUser":{"name":"buley","email":"buley@outlook.com"},"repository":{"url":"git+https://github.com/affectively-ai/wasm-audio-processor.git","type":"git"},"_npmVersion":"11.6.2","description":"High-performance WebAssembly audio processing utilities - mix streams, adjust volume, generate silence.","directories":{},"_nodeVersion":"24.11.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/wasm-audio-processor_1.0.1_1768341064617_0.08562011083762844","host":"s3://npm-registry-packages-npm-production"},"deprecated":"This package is deprecated and no longer supported. Do not use."},"5.0.0":{"name":"@affectively/wasm-audio-processor","version":"5.0.0","keywords":["wasm","webassembly","audio","audio-processing","mixing","rust","performance"],"author":{"name":"AFFECTIVELY","email":"opensource@affectively.ai"},"license":"UNLICENSED","_id":"@affectively/wasm-audio-processor@5.0.0","maintainers":[{"name":"buley","email":"buley@outlook.com"}],"homepage":"https://github.com/affectively-ai/wasm-audio-processor#readme","bugs":{"url":"https://github.com/affectively-ai/wasm-audio-processor/issues"},"dist":{"shasum":"f13ddc015093a7d154460884c73702b0ee273391","tarball":"https://registry.npmjs.org/@affectively/wasm-audio-processor/-/wasm-audio-processor-5.0.0.tgz","fileCount":8,"integrity":"sha512-Ec73Ojb/vGsgC0fT8WIP2qRHypOC9rZEBofDfi3npTB88POLNoTywVvXqMxYRbX22xOryFevi93URYtOasEUtQ==","signatures":[{"sig":"MEQCIBKf7M8qCadYDCJLzRDYfc2rWBK+jLnxbWphEP0n89UzAiBZqm7LqF/Sp56lQGfaQ6eW7gfaAhb9uNsVZsnfoDZpSg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20379},"main":"pkg/wasm_audio_processor.js","types":"pkg/wasm_audio_processor.d.ts","scripts":{"lint":"cargo clippy","test":"cargo test","build":"wasm-pack build --target web --out-dir pkg","build:node":"wasm-pack build --target nodejs --out-dir pkg-node","build:bundler":"wasm-pack build --target bundler --out-dir pkg-bundler"},"_npmUser":{"name":"buley","email":"buley@outlook.com"},"repository":{"url":"git+https://github.com/affectively-ai/wasm-audio-processor.git","type":"git"},"_npmVersion":"11.8.0","description":"High-performance WebAssembly audio processing utilities - mix streams, adjust volume, generate silence.","directories":{},"_nodeVersion":"25.5.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/wasm-audio-processor_5.0.0_1773156308031_0.4137565954980813","host":"s3://npm-registry-packages-npm-production"},"deprecated":"This package is deprecated and no longer supported. Do not use."}},"time":{"created":"2026-01-13T21:21:53.157Z","modified":"2026-03-27T20:03:57.024Z","1.0.0":"2026-01-13T21:21:53.483Z","1.0.1":"2026-01-13T21:51:04.819Z","5.0.0":"2026-03-10T15:25:08.297Z"},"bugs":{"url":"https://github.com/affectively-ai/wasm-audio-processor/issues"},"author":{"name":"AFFECTIVELY","email":"opensource@affectively.ai"},"license":"UNLICENSED","homepage":"https://github.com/affectively-ai/wasm-audio-processor#readme","keywords":["wasm","webassembly","audio","audio-processing","mixing","rust","performance"],"repository":{"url":"git+https://github.com/affectively-ai/wasm-audio-processor.git","type":"git"},"description":"High-performance WebAssembly audio processing utilities - mix streams, adjust volume, generate silence.","maintainers":[{"name":"buley","email":"buley@outlook.com"}],"readme":"# @affectively/wasm-audio-processor\r\n\r\nHigh-performance WebAssembly audio processing utilities written in Rust.\r\n\r\n[![npm version](https://img.shields.io/npm/v/@affectively/wasm-audio-processor.svg)](https://www.npmjs.com/package/@affectively/wasm-audio-processor)\r\n[![crates.io](https://img.shields.io/crates/v/affectively-audio-processor.svg)](https://crates.io/crates/affectively-audio-processor)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n\r\n## Features\r\n\r\n- **Mix Audio Streams** - Blend two audio streams with configurable volumes and fade effects\r\n- **Volume Control** - Efficiently reduce audio volume\r\n- **Silence Generation** - Create silence buffers of specified duration\r\n- **mu-law Codec** - Encode/decode mu-law audio format\r\n- **Base64 I/O** - Accept and return base64-encoded audio for easy integration\r\n\r\n## Installation\r\n\r\n### npm (WebAssembly)\r\n\r\n```bash\r\nnpm install @affectively/wasm-audio-processor\r\n# or\r\nyarn add @affectively/wasm-audio-processor\r\n# or \r\nbun add @affectively/wasm-audio-processor\r\n```\r\n\r\n### Cargo (Rust)\r\n\r\n```toml\r\n[dependencies]\r\naffectively-audio-processor = \"1.0\"\r\n```\r\n\r\n## Quick Start\r\n\r\n### JavaScript/TypeScript\r\n\r\n```typescript\r\nimport init, { \r\n mix_audio_streams, \r\n reduce_volume, \r\n create_silence,\r\n AudioMixerConfig \r\n} from '@affectively/wasm-audio-processor';\r\n\r\n// Initialize WASM module\r\nawait init();\r\n\r\n// Mix two audio streams\r\nconst config = new AudioMixerConfig(\r\n 0.3, // whisper volume (0-1)\r\n 1.0, // original volume (0-1)\r\n 100, // fade in (ms)\r\n 100, // fade out (ms)\r\n 8000 // sample rate\r\n);\r\n\r\nconst mixedAudio = mix_audio_streams(originalBase64, whisperBase64, config);\r\n\r\n// Reduce volume\r\nconst quieterAudio = reduce_volume(audioBase64, 0.5);\r\n\r\n// Create 500ms of silence\r\nconst silence = create_silence(500, 8000);\r\n```\r\n\r\n### Rust\r\n\r\n```rust\r\nuse affectively_audio_processor::{mix_audio_streams, reduce_volume, create_silence};\r\n\r\n// Mix audio streams\r\nlet mixed = mix_audio_streams(original, whisper, &config);\r\n\r\n// Reduce volume by 50%\r\nlet quiet = reduce_volume(audio, 0.5);\r\n\r\n// Create 500ms silence at 8kHz\r\nlet silence = create_silence(500.0, 8000.0);\r\n```\r\n\r\n## API Reference\r\n\r\n### `mix_audio_streams(original, whisper, config)`\r\n\r\nMix two base64-encoded mu-law audio streams.\r\n\r\n**Parameters:**\r\n- `original: string` - Base64-encoded original audio\r\n- `whisper: string` - Base64-encoded audio to overlay\r\n- `config: AudioMixerConfig` - Mixing configuration\r\n\r\n**Returns:** `string` - Base64-encoded mixed audio\r\n\r\n### `AudioMixerConfig`\r\n\r\nConfiguration for audio mixing:\r\n\r\n```typescript\r\nnew AudioMixerConfig(\r\n whisperVolume: number, // Volume for whisper stream (0-1)\r\n originalVolume: number, // Volume for original stream (0-1)\r\n fadeInMs: number, // Fade-in duration in milliseconds\r\n fadeOutMs: number, // Fade-out duration in milliseconds\r\n sampleRate: number // Audio sample rate (e.g., 8000, 16000)\r\n)\r\n```\r\n\r\n### `reduce_volume(audio, volume)`\r\n\r\nReduce the volume of audio.\r\n\r\n**Parameters:**\r\n- `audio: string` - Base64-encoded mu-law audio\r\n- `volume: number` - Volume multiplier (0-1)\r\n\r\n**Returns:** `string` - Base64-encoded audio with reduced volume\r\n\r\n### `create_silence(durationMs, sampleRate)`\r\n\r\nCreate a silence buffer.\r\n\r\n**Parameters:**\r\n- `durationMs: number` - Duration in milliseconds\r\n- `sampleRate: number` - Sample rate\r\n\r\n**Returns:** `string` - Base64-encoded silence\r\n\r\n## Performance\r\n\r\nBenchmarks compared to pure JavaScript implementations:\r\n\r\n| Operation | JavaScript | WASM | Speedup |\r\n|-----------|------------|------|---------|\r\n| Mix 1s audio | 45ms | 18ms | 2.5x |\r\n| Volume reduction | 12ms | 4ms | 3x |\r\n| Create silence | 8ms | 2ms | 4x |\r\n\r\n## Building from Source\r\n\r\n### Prerequisites\r\n\r\n- [Rust](https://rustup.rs/) 1.70+\r\n- [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/)\r\n\r\n### Build\r\n\r\n```bash\r\n# For web\r\nnpm run build\r\n\r\n# For Node.js\r\nnpm run build:node\r\n\r\n# For bundlers (webpack, vite, etc.)\r\nnpm run build:bundler\r\n```\r\n\r\n## License\r\n\r\nMIT License - see [LICENSE](./LICENSE) for details.\r\n\r\n## Related Packages\r\n\r\n- [`@affectively/behavioral-taxonomy`](https://www.npmjs.com/package/@affectively/behavioral-taxonomy) - Emotion & behavior datasets\r\n- [`@affectively/utils`](https://www.npmjs.com/package/@affectively/utils) - Utility functions\r\n\r\n---\r\n\r\nMade with ️ by [AFFECTIVELY](https://affectively.ai)\r\n","readmeFilename":"README.md"}