GNOME Bugzilla – Bug 397162
[audiofx] New element audioamplify
Last modified: 2007-01-24 12:44:38 UTC
Hi, attached are patches that add an audioamplify element to audiofx. This allows amplifying an audio stream by a given factor with a selectable clipping method, each of them giving different harmonics. The clip method is the normal cut-off clipping, wrap-negative pushes everything above max from the opposite side (i.e. G_MAXINT16 + 12 => G_MININT16 + 12), wrap-positive pushes everything above max from the same side (i.e. G_MAXINT16 + 12 => G_MAXINT16 - 12) There's one patch for the sources, one for the docs and one for unit tests Bye
Created attachment 80362 [details] [review] audioamplify-sources.diff
Created attachment 80363 [details] [review] audioamplify-docs.diff
Created attachment 80364 [details] [review] audioamplify-tests.diff
The difference of this effect and Volume are the clipping methods and the possible wider parameter range (including negative valudes to do inversion). Its more targetted at 'creative sound design'.
The current version doesn't support negative values though... What do you think, shall we allow negative values or take audioinvert instead? I don't have any strong oppinion on this
Hm, it seems to be a bit non-intuitive what a negative amplification value does... one would imagine that it decreases the volume if negative values are possible. Thus both elements (and this one going from 0.0 to G_MAXFLOAT) is probably the more intuitive solution.
Oh and another important difference to the Volume element is, that the amplification is a factor instead of a weird (iirc exponential) value. And in difference to the Volume element one can choose a random amplification with (almost) no upper bound.
Created attachment 80577 [details] [review] audioamplify-sources.diff trivial fix for the docs
looks good, commit please! minor nitpick, you should add entries in the copyright header with newer entries below.
I don't see a big difference between this and the volume element, myself. They're actually both using the amplification/volume value as a linear multiplier for the audio, the only difference seems to be the bound on the factor and the ability to change the clipping method.
Well, the volume element is meant for _simple_ volume changes in random players, etc while the amplify element, with the unlimited factor and different clipping methods, is mainly meant for what Stefan called 'creative sound design', i.e. for creating cool or weird sounds from some base sample. IMHO this difference in use cases and functionality justifies a different element in the audiofx plugin. And IMHO the volume element itself should have as less complexity as possible because it's used almost everywhere, where the additional features of amplify won't be used anyway...
Thanks for reviewing Stefan... committed it to CVS some seconds ago. For the code duplication aka copy&paste design I'll think about some kind of base class for all audio filters once I make the next one. 2007-01-24 Sebastian Dröge <slomo@circular-chaos.org> reviewed by: Stefan Kost <ensonic@users.sf.net> * gst/audiofx/Makefile.am: * gst/audiofx/audioamplify.c: (gst_audio_amplify_clipping_method_get_type), (gst_audio_amplify_base_init), (gst_audio_amplify_class_init), (gst_audio_amplify_init), (gst_audio_amplify_set_process_function), (gst_audio_amplify_set_property), (gst_audio_amplify_get_property), (gst_audio_amplify_set_caps), (gst_audio_amplify_transform_int_clip), (gst_audio_amplify_transform_int_wrap_negative), (gst_audio_amplify_transform_int_wrap_positive), (gst_audio_amplify_transform_float_clip), (gst_audio_amplify_transform_float_wrap_negative), (gst_audio_amplify_transform_float_wrap_positive), (gst_audio_amplify_transform_ip): * gst/audiofx/audioamplify.h: * gst/audiofx/audiofx.c: (plugin_init): Add new element "audioamplify". This allows scaling of raw audio samples, similar to the "volume" element, but provides different modes for clipping and allows unlimited amplification. It's mainly targeted for creative sound design and not as a replacement of the "volume" element. Fixes #397162 * docs/plugins/Makefile.am: * docs/plugins/gst-plugins-good-plugins-docs.sgml: * docs/plugins/gst-plugins-good-plugins-sections.txt: * docs/plugins/gst-plugins-good-plugins.args: * docs/plugins/inspect/plugin-audiofx.xml: Add docs for audioamplify and integrate them into the build system * tests/check/Makefile.am: * tests/check/elements/audioamplify.c: (setup_amplify), (cleanup_amplify), (GST_START_TEST), (amplify_suite), (main): Add fairly extensive unit test suite for audioamplify