-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256 I used rganalysis to get peak (whatever that is) gain and reference level on my songs. Now I'd like to apply that adjustment via rgvolume, but I can't get any detectable difference to occur whether I use it or not. In my code I am creating a GstMessage using the values that rganalysis put out earlier (loaded from a database) and a null source, then gst_bus_post to post the message. My gst_bus_add_watch callback displays those tags correctly during playback, giving me the impression that they have been properly dispatched. And I have a rgvolume element both added and linked right before alsasink. But the volume remains unchanged. Loud songs are still too loud. Quiet songs are still too quiet. For the song I'm testing the gain is 2.13, peak 0.512525 and reference level 89. It should sound distinguishably different when adjusted. But I can't hear any amplification going on. I realize you can't just do this: gst-launch-0.10 filesrc location=somewhere.mp3 ! audioconvert ! audioresample ! rganalysis ! rgvolume ! alsasink ...because the analysis cannot produce a result until the end of stream. For that reason I already performed the analysis just to a fakesink, and stored those results in a database. Supposedly I can then produce those results as tags during the actual playback and have rgvolume adjust the volume so that artificially dampened songs play just as well as artificially amplified ones. I can't use the GstTagSetter interface, because all the ones implementing that are for encoding songs and saving them to file not playing them out loud. here's the code where I add the tags: ... gdouble gain = g_ascii_strtod(PQgetvalue(result,0,1),&end); gdouble peak = g_ascii_strtod(PQgetvalue(result,0,2),&end); gdouble level = g_ascii_strtod(PQgetvalue(result,0,3),&end); if(!getenv("noreplaygain")) { static GstTagList* list = NULL; if(list==NULL) list = gst_tag_list_new(); gst_tag_list_add(list, GST_TAG_MERGE_REPLACE, GST_TAG_TRACK_GAIN, gain, GST_TAG_TRACK_PEAK, peak, GST_TAG_REFERENCE_LEVEL, level, NULL); GstMessage* message = gst_message_new_tag(NULL,list); gst_bus_post(bus,message); //gst_message_unref(message); } ... -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBCAAGBQJPAlt1AAoJEF1ecRpMzcFybaEH/34AIaP2idC26aUWy8UyOuyN O8oJ6/73lQXSVhFyD56jCKGeAwbSI+1++WxXc5Ukw1uizFzTgUp6e8G5lWauh13E sLhBxe4KD3pZaRVgEWpFM3mLDvW7e1ea7QW88R6ACd63nns0NKLSQClOZqIIt3b1 m1LcXbUNv3YSS7QMbzEqROqmBtB+gDp3jAxxb9ENquv57aDbOfkS9USqJ9k7LU/k u7RSodK1nCpQJWhEitfbstoER/6z0r3mRg/Jat9IDPX16XyHuFJ+Ci3GjD9GUPy2 BIno3a3OjOPYhNHUKHGlCfhdlAQEdAYtnNsPsmVtOog+nAtzyyyqMKEgsjWitbA= =X/S3 -----END PGP SIGNATURE----- _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256 Well, looks like I'm on my own then. *sighs* I looked at the source of the gstrgvolume.c and gstrganalysis.c to see if I could figure out how to notify rgvolume that it does indeed have a gain and peak to apply. Since the rgvolume code silently failed when it found no tags for said gain peak and level I added in a line to log a message when it found no tags, but otherwise left the source well unmodified. I'm not really sure what the problem is here. I tried using gst_bus_post to post a message with the tag list. I tried gst_pad_push_event on the specific pad that reads those events. Oddly, rgvolume's "sink" pad reads the events. Wouldn't the "src" pad be the one that responded to events to adjust the gain and peak of the signal filtering through? I tried gst_element_found_tags_for_pad on the pipeline for that pad, and gst_element_found_tags on the pipeline in general. In all 4 methods, the rgvolume should have found both a track gain and a track level tag, yet the statement if (!has_track_gain && !has_track_peak && !has_album_gain && !has_album_peak) { ...always returns true. The only thing I can think at this point is that something discards without processing any and all tags on the bus when the pipeline's state switches to playing. I tried switching the state before and after pushing the tags, again with no luck in both situations. Is there some event that I must wait for before the rgvolume "sink" pad can accept events to set the gain and peak it uses? Sure would be nice if you could just set them as properties. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBCAAGBQJPBV/NAAoJEF1ecRpMzcFyyAEH/0L+y9q21HUp1aVq6L1A7jgt c/YyLSZAZhU4uUkiRqIo4wdIBepyh+Mrv2QePJ+lN33MsEklqu71TEQT2Zd2uYrA +7Wwe+5AMzSl3+0w8DkA0lAyMOxdh2ETqNu83dSv9q0HBs479cJxiT29iDX8MsXT UCNFl2DqlI6McPiYcbGfbOCYc4/5Y5zXCrd8m0TabP9NE4Ljtf2hQ2sbEn83mZNB hHTU3g3LZhY+OnW0bXa2cYz1GVHwfYBL2Y2itw+9205+7EZg6Y8fl1LJf+4pzpAW H54+CU09lZqrqibdZQgK+nqKoY9P4BUGUH0mTi2C9/PmCzfwuNJZVfO9Ai9s2/A= =7552 -----END PGP SIGNATURE----- _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256 OK think I got it. If you call gst_pad_send_event the moment that pad has been activated, on rgvolume's "sink" pad, then rgvolume will adjust the volume. And conveniently there is a gst_pad_set_activatepush_function to do just that. It doesn't take a "user data" parameter though. :/ Also I'm not sure if the default value of the function is important, but it's easy enough to extract the function pointer and call it inside my own override. So... 1) use rganalysis and watch the bus for the peak/gain/level tags 2) save them somewhere in a database or something per track/album 3) when playing the song, handle the activate push function on rgvolume's "sink" 4) in that handler, supply the tags rganalysis put out via gst_pad_send_event. 5) You can actually hear your quiet songs again! It still doesn't seem to be damping loud songs... -5.9 dB gain at 0.1 peak was almost unnoticable. Or is damping greater at peaks closer to 1? I don't actually have very many loud songs heh... Well, if I can figure anything out I'm doing wrong I'll continue to post. Thanks for nothing and I hope this helps! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBCAAGBQJPBYFqAAoJEF1ecRpMzcFyaucH/0p+hybuVWeUA34dR/890sQe B7Jmnx0jIuPyz71CYx7++xfTO/tiT/F/GB0iON1effgZo3ZEDYC60uuavlwCThMR VyL4XOR50+evelb3r39cXSA5J5zmMytlKl2DO3N+xPghD3NVRfNHg/uZt/Zj1U5g D481SGdU73+DPsyDj3DSABRuBPTPZNO0WaYpusw3g9b0FD09FzgRm9PSIyzNK9Jq 8eM8ZNv3imT7LQFmDOLsl4CXtNJD+sMzzGkmX8OxUIQS3iB+4T9qfGMzuVk3C//V jKSlnCNgCRNAd8ndMBrihEtYNYYq64IwgkNAYc57UduNLFnD0JRrxX2Baz0IpHs= =CIdQ -----END PGP SIGNATURE----- _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |