hajimehoshi / go-mp3

An MP3 decoder in pure Go
Apache License 2.0
746 stars 80 forks source link

Wrong decoding result with ino2.mp3 (hajimehoshi/go-inovation) #13

Closed hajimehoshi closed 6 years ago

hajimehoshi commented 7 years ago

https://github.com/hajimehoshi/go-inovation/tree/master/ino/internal/assets/resources/sound

Compared to the other MP3 decoder (player), the results is different.

Arun22 commented 7 years ago

hi @hajimehoshi , not sure this issue is relevant to this bug. here is the my code snippet

      fd, err := os.Open("/tmp/test_music.mp3")
        defer fd.Close()
        d, err := mp3.NewDecoder(fd)
        defer d.Close()
        if err != nil {
                log.Panic(err)
        }
        log.Println("Decoded length:", d.Length())
        writebuf := make([]int16, PLAYBACK_RATE)
        readbuf := make ([]uint8, d.Length())
        count, err := d.Read(readbuf)
        if err != nil {
                log.Panic(err)
        }

        log.Printf( "Count=%d len=%d cap=%d %v \n", count, len(readbuf), cap(readbuf), readbuf )

Output shows this: All decoded data are 0's


2017/10/02 19:37:40 Count=4608 len=4608 cap=4608 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ```
hajimehoshi commented 7 years ago

Hi,

What mp3 file did you try?

Thanks,

Arun22 commented 7 years ago

Hi, I just tried with your example mp3 file ino2.mp3. still I get the same result:


2017/10/03 14:42:51 Count=4608 len=1709568 cap=1709568 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0```
hajimehoshi commented 7 years ago

I can't say this is a wrong result. 4608 bytes is too short (about 1/40 sec) and silence in the time span is not unnatural.