id3-go icon indicating copy to clipboard operation
id3-go copied to clipboard

How to get and print Popularimeter frame

Open wolkenarchitekt opened this issue 6 years ago • 0 comments

I would like to read the Popularimeter frame from a file with id3-go.

This is how the frame looks like when printing with mutagen-inspect:

$ mutagen-inspect samples/with_popm.mp3 | grep POPM
[email protected]=0 255/255

I would like to read the value (255/255) from the file. As I could not find any documentation, my naive approach is:

popFrame := mp3File.Frame("POPM")
log.Println(popFrame.String())

But when I run this (on a file with and also without a popularimeter tag), I get segmentation faults:

$ ./popm-read samples/with_popm.mp3 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x4ac302]

goroutine 1 [running]:
main.main()
	/home/ifischer/src/rivamp/rivamp-dist/id3-go-popm-example/main.go:21 +0xd2

$ ./popm-read samples/without_popm.mp3 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x4ac302]

goroutine 1 [running]:
main.main()
	/home/ifischer/src/rivamp/rivamp-dist/id3-go-popm-example/main.go:21 +0xd2

I setup a sample repository containing two sample files (one with, one without popularimeter frame) here: https://github.com/ifischer/id3-go-popm-example

wolkenarchitekt avatar Oct 18 '18 22:10 wolkenarchitekt