- Adjustment decibel
- Adjustment fade in
- Adjustment fade out
- Adjustment stereo
- Enable noise reduction
- Render bar chart from peaks data
- Render bar chart from peaks time domain data
- Export multiple audio as single wav file
pnpm add modern-audio
npm i modern-audio
import { createAudio } from 'modern-audio'
const audio = createAudio('./test/assets/audio.mp3')
await audio.load()
audio.set({
db: 1,
pan: 0.1,
// fadeIn: 3,
fadeIn: { at: 0, duration: 3 },
fadeOut: 5,
noiseReduction: true,
playbackRate: 2,
loop: true,
})
// onclick after call
audio.start()
// Pause
// audio.reset()
// Play
// audio.start(0, audio.context.currentTime)
import { createAudio, createOfflineAudioContext, downloadOfflineAudio } from 'modern-audio'
// 10s duration
const context = createOfflineAudioContext(10)
const audio = createAudio('./test/assets/audio.mp3', context)
await audio.load()
audio.set('db', 1)
audio.set('pan', 0.1)
audio.set('fadeIn', 3)
audio.set('fadeOut', 5)
audio.set('noiseReduction', true)
const audio1 = createAudio('./test/assets/audio.mp3', context)
await audio1.load()
audio1.set('db', 0)
audio1.set('pan', 0)
audio1.set('fadeIn', 0)
audio1.set('fadeOut', 0)
audio1.set('noiseReduction', false)
// onclick after call
audio.start()
audio1.start()
downloadOfflineAudio(context)
import { ModernAudio } from 'modern-audio'
ModernAudio.install()
html
<audio
is="modern-audio"
src="./test/assets/audio.mp3"
controls
db="1"
pan="0.1"
fade-in="3"
fade-out="5"
noise-reduction
></audio>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>modern-audio</title>
<script src="https://cdn.jsdelivr.net/npm/modern-audio/dist/modern-audio.js"></script>
<script>
window['modern-audio'].ModernAudio.install()
</script>
</head>
<body>
<audio
is="modern-audio"
src="./test/assets/audio.mp3"
controls
db="1"
pan="0.1"
fade-in="3"
fade-out="5"
noise-reduction
></audio>
</body>
</html>