[gst-devel] amplitude modulation plugin

David Schleef ds at schleef.org
Thu Aug 25 16:08:19 CEST 2005


On Fri, Aug 26, 2005 at 12:44:07AM +0200, berti wrote:
> I'm trying to make a amplitude modulation of a sound signal, i.e. simply 
> multiply the sound by sin(2*pi*f*t) where t is the time.
> 
> My plugin have the following caps 
> "audio/x-raw-int, width = (int) 16, depth = (int) 16, signed = (bool) true, 
> endianness = (int) 1234, rate = (int) 44100, channels = (int) 1"
> so that I'm sure I will be able to connect it to sinesrc & osssink to simply 
> test it.

> -filter->f is the frequency of the modulation
> -The ByteSwap simply convert a gint16 between Big and Little endian 
> representation.

You should almost always use host endian in GStreamer audio plugins.
Non-host-endian audio is mostly uninteresting.  I'd recommend using
GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS as a starting point for caps
for any audio filtering (this is defined in gst/audio/audio.h).  Or
you can use GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS for float
audio, which has both advantages and disadvantages.

> The code compile and work, I can hear the variation of the frequency BUT there 
> is a lot of noise on the top of the sine signals. Where does this noise come 
> from ?

That's for you to figure out.  My guess is either endianness problems
or clipping (although you're not ever multiplying by greater than 1.0).



dave...

-- 
David Schleef
Big Kitten LLC (http://www.bigkitten.com/) -- data acquisition on Linux




More information about the gstreamer-devel mailing list