Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/qq15725/modern-audio
- Owner: qq15725
- License: mit
- Created: 2022-09-09T16:02:26.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-09-16T09:22:25.000Z (over 2 years ago)
- Last Synced: 2024-04-23T21:22:42.420Z (8 months ago)
- Topics: audio-mixin, export-audio, htmlaudioelement, modern-audio, noise-reduction, web-audio
- Language: TypeScript
- Homepage:
- Size: 1.64 MB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Modern Audio
## 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()
```