Recently I added some logic gates to my synthesiser. Not the familiar little chips we know and love
rather, logic gates especially for musical application.
I’ve had an OR gate in my synth from the early days, finding it useful for combining trigger signals from my sequencer to build up drum patterns, etc. Originally, I used the simplest diode-based OR gate designs, such as that as seen on the Doepfer DIY page. Subsequently, I augmented this with a level converter, to allow the OR gate to trigger those modules requiring high voltage signals (I still have some old MFOS modules expecting 10V) even when the sources were putting out timid 5V pulses from a microcontroller. I exploited the same old level converter circuit I’ve used and abused many times before.
This original OR gate worked but wasn’t everything I wanted, so I started to toy with a new design and realised it was easy to conceive of an AND sibling for my new OR gate, as they shared many common features.
Some observations on modulation
% Specify the Periods of the two squarewaves:Ta=10;Tb=12;% Specify the duty cycles of the two squarewaves:DUTYa=50;DUTYb=50;% Calculate the normalised frequencies of the two squarewaves:fa=1/Ta-eps;fb=1/Tb-eps;% Generate a time vector:tmax=1000;t=[0:tmax];% build the squarewaves:a=(square(fa*2*pi*t,DUTYa)+1)/2;b=(square(fb*2*pi*t,DUTYb)+1)/2;% apply the logic:c=and(a,b);d=or(a,b);e=xor(a,b);% Now look at the result in the Frequency Domain:% build a window:w=window(@blackman,length(a)).';% and calculate the FTsA=fft(w.*a);B=fft(w.*b);C=fft(w.*c);D=fft(w.*d);E=fft(w.*e);
So I set the duty cycle of both pulse outputs as best I could to 50% and – yes – the sound of the OR and AND gate modulating the same pair of square waves suddenly sounded similar – just as the code predicted. The outputs of the AND and the OR modulators sounded the same!!
* the result of modulating two rectangular signals by an AND gate sounds different to the result of modulating the same pair of rectangular signals by an OR gate (no surprise) but* there are special circumstances (in the case of SQUARE waves with truly 50% duty cycle), where modulation by AND and OR produces the same magnitude spectrum (apart from the d.c. term).
[because these (1.1 and 1.2) will only change the phase component of the spectral peaks associated with the harmonics of the periodic signal – not their magnitude, and will not change the peak at d.c (fn = 0)]
[because these (2.1 and 2.2) will impact the peak at d.c. ( fn = 0 ) but not the other harmonic peaks, which are agnostic to mean value and phase/polarity]
[It also might appear that there's some time-shift involved too, but - as I'll show below - time shift isn't involved. In fact, there's no memory/filtering/delay mechanism in the modulator capable of imposing a time shift; it's all in the signals - but we're getting ahead of ourselves.]
Explaining the Curiosity
"The negation of a disjunction is the conjunction of the negations""The negation of a conjunction is the disjunction of the negations"
Covering the Exclusive Base
[It is also ‘two layer’; you have to do the ANDs first before the OR, so it literally takes longer than the single layer AND and OR operations.]
No comments:
Post a Comment