Skip to content

Commit

Permalink
add sample rate
Browse files Browse the repository at this point in the history
  • Loading branch information
volyx committed Jul 1, 2024
1 parent afd1c55 commit 16ffb9b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion audio/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import (
"github.com/hajimehoshi/go-mp3"
)

const (
gomp3NumChannels = 2
gomp3Precision = 2
gomp3BytesPerFrame = gomp3NumChannels * gomp3Precision
)

func main() {
fmt.Println("Open: ", os.Args[1])
f, err := os.Open(os.Args[1])
Expand All @@ -23,7 +29,7 @@ func main() {

fmt.Printf("SampleRate %d\n", d.SampleRate())
// 134,407,456
fmt.Printf("Length %d bytes\n", d.Length())
fmt.Printf("Length %d bytes\n", d.Length()/gomp3BytesPerFrame)
// fmt.Printf("Length %d Mb\n", )

}

0 comments on commit 16ffb9b

Please sign in to comment.