Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/qq15725/modern-audio

🎵 A modern web audio library.
https://github.com/qq15725/modern-audio

audio-mixin export-audio htmlaudioelement modern-audio noise-reduction web-audio

Last synced: about 2 months ago
JSON representation

🎵 A modern web audio library.

Awesome Lists containing this project

README

        

Modern Audio



License


Version


Minzip

## Feature

- 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

## Installation

### pnpm

```sh
pnpm add modern-audio
```

### npm

```sh
npm i modern-audio
```

## Usage

### Basic

```ts
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)
```

### Export multiple audio as single wav file

```ts
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)
```

### Web custom component

```ts
import { ModernAudio } from 'modern-audio'

ModernAudio.install()
```

html

```html

```

### CDN of usage

```html


modern-audio


window['modern-audio'].ModernAudio.install()

```