After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 397162 - [audiofx] New element audioamplify
[audiofx] New element audioamplify
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal enhancement
: 0.10.6
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-01-16 07:57 UTC by Sebastian Dröge (slomo)
Modified: 2007-01-24 12:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
audioamplify-sources.diff (17.38 KB, patch)
2007-01-16 07:57 UTC, Sebastian Dröge (slomo)
none Details | Review
audioamplify-docs.diff (2.31 KB, patch)
2007-01-16 07:58 UTC, Sebastian Dröge (slomo)
committed Details | Review
audioamplify-tests.diff (16.75 KB, patch)
2007-01-16 07:58 UTC, Sebastian Dröge (slomo)
committed Details | Review
audioamplify-sources.diff (17.38 KB, patch)
2007-01-18 10:30 UTC, Sebastian Dröge (slomo)
committed Details | Review

Description Sebastian Dröge (slomo) 2007-01-16 07:57:15 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
Comment 1 Sebastian Dröge (slomo) 2007-01-16 07:57:49 UTC
Created attachment 80362 [details] [review]
audioamplify-sources.diff
Comment 2 Sebastian Dröge (slomo) 2007-01-16 07:58:09 UTC
Created attachment 80363 [details] [review]
audioamplify-docs.diff
Comment 3 Sebastian Dröge (slomo) 2007-01-16 07:58:23 UTC
Created attachment 80364 [details] [review]
audioamplify-tests.diff
Comment 4 Stefan Sauer (gstreamer, gtkdoc dev) 2007-01-16 09:12:39 UTC
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'.
Comment 5 Sebastian Dröge (slomo) 2007-01-16 10:02:57 UTC
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
Comment 6 Sebastian Dröge (slomo) 2007-01-16 10:10:48 UTC
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.
Comment 7 Sebastian Dröge (slomo) 2007-01-16 10:37:01 UTC
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.
Comment 8 Sebastian Dröge (slomo) 2007-01-18 10:30:03 UTC
Created attachment 80577 [details] [review]
audioamplify-sources.diff

trivial fix for the docs
Comment 9 Stefan Sauer (gstreamer, gtkdoc dev) 2007-01-23 13:23:43 UTC
looks good, commit please!

minor nitpick, you should add entries in the copyright header with newer entries below.
Comment 10 Jan Schmidt 2007-01-23 15:02:08 UTC
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.
Comment 11 Sebastian Dröge (slomo) 2007-01-23 17:37:07 UTC
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...
Comment 12 Sebastian Dröge (slomo) 2007-01-24 12:44:38 UTC
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