GNOME Bugzilla – Bug 754450
audiotestsrc: remove frequency and channel number limit
Last modified: 2015-11-02 15:42:03 UTC
Created attachment 310487 [details] [review] The patch implementing the changes. As discussed on http://gstreamer-devel.966125.n4.nabble.com/Ultrasound-and-audiotestsrc-tt4673383.html the limitation of generated frequencies to the audible range is not really necessary and there are use cases where it might be desirable to be able to produce ultrasound. Furthermore, the restriction to mono and stereo signals is also a needless limitation. I therefore created a patch that lifts both these limitations while also extending the caps negotiation code to make sure that the sample rate is always at least four times as high as the frequency that ought to be generated. The reasons for this not being twice the frequency were mentioned on the list but mainly boil down to avoiding artifacts or digital silence being generated with certain wave forms at or close to the Nyquist frequency with existing code.
I'm seeing some strange crackling artifacts with this patch so I would recommend not applying it to master right now. I will keep you posted as I learn more.
commit bd89f2430bd34f57808f3cf67185db1b647ad128 Author: Wim Taymans <wtaymans@redhat.com> Date: Mon Nov 2 15:54:19 2015 +0100 audiotestsrc: increase freq limit Raise the frequency limit and try to negotiate to a samplerate of 4*freq when larger then the default samplerate. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=754450
There was no need to convert the rate to double and back to multiple by 4. Also we need a channel-mask when dealing with channels > 2. I pushed a slightly modified patch, thanks for the inspiration :)