1.0.8 • Published 2 years ago

aviatojs v1.0.8

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Aviatojs

A simple library to trim, cut and join audio files.

Usage

For a fully working example refer to this example

Importing

import  {AviatoAudio}  from  'aviatojs'

Initialising

const audio1  =  new  AviatoAudio(document.getElementById('audio1'));
//playing audio
audio1.play();
//pausing audio
audio2.pause();

Trimming

audio1.trim({start:"20s",end:"25s"})
//or
audio2.trim({start:"10%",end:"75%"})
//or
audio2.trim({start:10,end:75}) //also trims by percentage

Joining

const audio1  =  new  AviatoAudio(document.getElementById('audio1'));
const audio2  =  new  AviatoAudio(document.getElementById('audio2'));
audio1.append(audio2) 

Cut / Remove a part of audio

//removes the mentioned part from the audio
audio2.cut({start:'5s',end:'10s'});
//or
audio2.cut({start:'5%',end:'10%'});
//or
audio2.cut({start:5,end:10});

Converting to mp3

After performing trim,cut or append operations, you might want to convert the AviatoAudio object back to mp3 so that users can download the new audio file or something.

//you might wanna convert back to mp3 after performing trim/append operations.
//you can do that like this

audio1.convertToMP3()
.then((url:String)=>console.log(url))

//returns a url which contains the audio file in mp3 format
//this url can then be set as the src attribute of another audio element
1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago