PDA

View Full Version : Signal generator plugin



ortal
2006-10-14, 12:45
Hi,

I was going to write a plugin to do simple signal generator. I did not find such a plugin, but I thought its best to ask before I start..

All I need for the first phase is a plugin that generates a sine wave with a frequency that can be controlled from the remote.

does anyone know about such a plugin?

together with a cheap SPL meter, this can be a powerful tool to get started with room treatment.

Thanks,
Or Tal
ortal99@gmail.com

Mark Lanctot
2006-10-14, 15:39
That sounds like a great idea!

inguz
2007-03-10, 20:47
ortal - I don't know whether you got around to this. But in case you didn't: the latest version of the InguzEQ/DSP now includes a signal generator.

It's pretty flexible (see http://inguzaudio.com/usage/plugin/settings/test-signals) but right now most of the tones default to 1kHz (because I'm still struggling to write a "choose a frequency" mode in the plugin).

Triode
2007-03-17, 19:04
You might like to try the attached - a purl perl plugin which I've just been working on.

buttons in signal generator mode:
1 - function [sine, square, triangle, sawtooth]
2/5 - signal gain
3 - channel
4 - sample rate
6 - bit depth
up/down fwd/rew for changing the frequency

Please note this can generate full volume waveforms so please be careful with the volume control if you are playing it though your loudspeakers/headphones. [It was intended for lab testing of my dac so it will play full amplitude samples]

Feedback appreciated on how accurate & useful it is.

Adrian

inguz
2007-04-14, 10:00
Nice job, triode. It's small and simple.

Beware the square/triange/sawtooth though - I made the same mistake. If you make a "digital square wave" by alternating a stream of +1 and -1 samples (so it looks like a perfect square wave), you get a lot of really nasty non-harmonic artifacts due to aliasing. On the other hand, if you make a square wave and then filter down to the sample rate, you get a signal that has all the right harmonics and no non-harmonic content (up to half the sampling rate), but it doesn't look square when you look at the digital waveform.

It's quite easy to tell the difference by listening, too.

Whether this is any sort of a big deal depends what you want to use the signals for. If you're doing distortion analysis you'll want the band-limited version.

Some examples:
2205Hz raw square: WAV (http://inguzaudio.com/Data/square_raw.wav) and scope image (http://inguzaudio.com/Data/square_raw.jpg)
2205Hz band-limited square: WAV (http://inguzaudio.com/Data/square_bl.wav) and scope image (http://inguzaudio.com/Data/square_bl.jpg)

Triode
2007-04-14, 10:25
> Beware the square/triange/sawtooth though - I made the same mistake.
> If you make a "digital square wave" by alternating a stream of +1 and
> -1 samples (so it looks like a perfect square wave), you get a lot of
> really nasty non-harmonic artifacts due to aliasing. On the other
> hand, if you make a square wave and then filter down to the sample
> rate, you get a signal that has all the right harmonics and no
> non-harmonic content (up to half the sampling rate), but it doesn't
> look square when you look at the digital waveform.

I think there are actually a couple of bugs in the plugin I posted. If
people are interested I can post the latest one to the wiki.

I've been using this as a signal generator for viewing output on a scope.
To get the cleanest waveforms the plugin alters the frequency so that the
period of the signal is always an integral number of samples. I think this
minimises this effect, but yes there is probably some residual harmonic
distortion.

inguz
2007-04-14, 14:39
Snapping to the nearest frequency where period is an *even* number of samples is quite smart. (Integral: almost, for example a square wave should never have any 2nd harmonic content, but it would here).

Bah, my raw square has a even-harmonics bug even worse than this one: for a 2205Hz square I get 9 samples +1 and 11 samples at -1. Oh dear :-)

I make band-limited versions by summing sine waves of the various harmonics in appropriate ratios/phases, up to samplingrate/2. Which works great, but at low frequencies it's really expensive to compute. The BLIT paper (http://www-ccrma.stanford.edu/~stilti/papers/blit.pdf) gives a more efficient method (but harder to code...)

Roger66
2009-10-14, 06:50
Hi,

i've tried out the signel generator plugin just offered under "plugins" by SBS 7.4. Is this the plugin youre talking about ?

Nice piece of software, but i can't manage to get any sinus output above 12 kHz on both SB3 and Boom. It the SB hardware too slow for these frequencies ?

My ears are still in a condition to hear 15 kHz from a test CD, only the SB plugin suffers above 12 kHz.

Any ideas ?

regards
Roger

Triode
2009-10-17, 02:35
Roger, I suspect this is due to the snapping to the nearest frequency feature which is discussed above. At frequencies close to the sampling rate the plugin will become less accurate in terms of frequency as it is trying to create the most accurate waveform it can with simple maths.

What happens if you change the sampling frequency to 48k (or 96k if you have a transporter)?

I don't have a working scope at present so can't really test in detail. I believe if you enable debugging you will see what the actual period it thinks it is creating through and this should give you a good indication of what frequency the plugin is creating.

Roger66
2009-10-17, 16:39
What happens if you change the sampling frequency to 48k (or 96k if you have a transporter)?

Changing to 48 kHz (I only have a SB3) gives only a little higher output at 14 kHz, but still near silence. With a dedicated test CD I can hear up to 16 kHz without a problem.