Package Exports
- audiomix
- audiomix/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (audiomix) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
audiomix
Native module for mixing multiple audio recordings in Expo React Native (Android).
It allows combining a base track with recordings, handling delays (delayMs), and optional monitoring during playback.
Installation
npm install audiomixLink native module if needed (RN < 0.60):
react-native link audiomixFor RN 0.60+, autolinking handles it.
Usage
Import
import { audioMix } from 'audiomix';Method: mixRecordings
audioMix(
recordings: Array<{ id: string; uri: string; delayMs?: number }>,
selectedIds: string[],
baseTrack: string | null,
monitorPlayback: boolean,
syncValue: number,
)- recordings: List of recording objects. Each must include
idanduri. OptionaldelayMsin ms. - selectedIds: Array of IDs from
recordingsto include in mixing. - baseTrack: Path/URI of base audio track (can be
null). - monitorPlayback: If
true, mixes with base track for monitoring. - syncValue: Sync adjustment in ms.
- Returns: Promise resolving with the path of the mixed output
.wavfile (stored in app cache).
Example
const recordings = [
{ id: '1', uri: '/storage/emulated/0/Music/rec1.wav', delayMs: 120 },
{ id: '2', uri: '/storage/emulated/0/Music/rec2.wav', delayMs: 0 },
];
const selectedIds = ['1'];
const baseTrack = '/storage/emulated/0/Music/base.wav';
audioMix(
recordings,
selectedIds,
baseTrack,
true, // monitorPlayback
0 // syncValue
).then(outputPath => {
console.log('Mixed audio file:', outputPath);
}).catch(err => {
console.error('Mixing error:', err);
});Notes
Output file is generated in the app cache directory with name pattern:
mixed_output_<timestamp>.wavOn error, promise rejects with:
MIX_PREP_ERROR: Input or preparation error.MIX_ERROR: Mixing process failed.
License
MIT