Skip to content

hcl/audioduration

Repository files navigation

Audio Duration

A naive go module to get a audio file's duration in second.

Usage

import github.com/hcl/audioduration

For an audio file (eg. mp3 format)

f, _ := os.Open("audio.mp3")
defer f.Close()
d, err := audioduration.Mp3(f)
if err != nil {
	// handling error
}

Or alternatively

f, _ := os.Open("audio.mp3")
defer f.Close()
d, err := audioduration.Duration(f, audioduration.TypeMp3)
if err != nil {
	// handling error
}

License

The code is licensed under GPLv3.

    audioduration - audio duration calculation library in go
    Copyright (C) 2021  hcl

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.

Credits

The audio samples (files under samples) for package test are from following source:

About

An audio duration calculation library

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages