IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
need help with libreplaygain + python and numpy
sebpiq
post Feb 7 2013, 20:21
Post #1





Group: Members
Posts: 3
Joined: 7-February 13
Member No.: 106481



Hi all !

I am trying to calculate the replay gain from Python, have tried over and over again, and failed miserably ...
I figured that would be the best place to ask, but if it isn't please redirect me smile.gif

I am using the shared object "libreplaygain.so" and what happens is that whatever data I give to `gain_analyze_samples`, `gain_get_chapter` always returns 80.000 ...

Here is the script I am using for testing : http://pastebin.com/4ngNuDZP
EDIT : here is a simpler version of the same snippet using scipy to read the sound file : http://pastebin.com/C7AWiGC6

I've really tried everything, and I am a bit desperate now sad.gif . I am not very good with C, and don't really understand what's going on with "ctypes", so I guess that might be a problem with value types. Hopefully the problem might be obvious to some of you?

Thanks,

Sébastien

This post has been edited by sebpiq: Feb 7 2013, 21:13
Go to the top of the page
+Quote Post
romor
post Feb 7 2013, 21:14
Post #2





Group: Members
Posts: 682
Joined: 16-January 09
Member No.: 65630



Not to me, but you can calculate RG just with scipy.
Additionally if you want to calculate filter coefficients, you can see example of Yulewalk in scikit talkbox, AR model function (or perhaps in statsmodels also), as it's not included in scipy. But coefficients can also be downloaded precomputed, for various sample rates.

Original idea explained, with scripts (which or course slightly differs from your linked library): http://web.archive.org/web/20060713212205/...ulating_rg.html


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
sebpiq
post Feb 7 2013, 21:22
Post #3





Group: Members
Posts: 3
Joined: 7-February 13
Member No.: 106481



QUOTE (romor @ Feb 7 2013, 22:14) *
Not to me, but you can calculate RG just with scipy.


Yeah ... I also thought about this options, but then I kind of thought using the shared library would be easier, faster, and wouldl't require scipy dependency (which I don't need for anything else...)
Go to the top of the page
+Quote Post
sebpiq
post Feb 7 2013, 21:45
Post #4





Group: Members
Posts: 3
Joined: 7-February 13
Member No.: 106481



Ok ... I've got some improvement by using :

replaygain.gain_get_chapter.restype = ctypes.c_double

before calling gain_get_chapter

Now it returns different values (previously only 80.000), but it is still different than what the command line tool gives me (64dB vs. -3dB)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 22nd November 2014 - 01:31