my Question: Is there a possibility to use mathematic operators like +,*, /,
and to have constants which are bigger than 127?
I want to calculate f(x)BPM = 7620 / x
x= 1 to 128 (rotary button constant)and than to display f(x) which is my BPM on the G2. For displaying a delay/tempo.

Division is a problem in general on the G2, a while ago there was some discussion about this on the mailing list. Kees van der Maarel came up with this then :

Quote:

A couple of weeks ago I was experimenting with a "division circuit",
using the formula: Log(x/y) = Log(x) - Log(y).
Here is my theory: The Pitch-tracker module is a hidden log-converter,
because incoming frequencies are in fact translated into note-numbers,
which are proportional to the logarithm of the frequency: every doubling
of the frequency should add 12 "clavia-units" to the output of the
pitchtracker. I used two oscillators with linear modulation inputs to to
get frequencies proportional to x and y, and two pitchtrackers to get
log(x) and log(y). With a mixer I subtracted log(y) from log(x) and I
finally used a Level Scaler module to get a signal proportional to x/y
(because the output of the Level Scaler has an exponential relationship
to its input signal.
I used a Control Sequencer to read out the signal.
However, I don't think this circuit is accurate, probably because I've
overlooked something.

Greetings,

Kees.

I've been puzzling a bit on your question, but coulddn't come up with anything reasonable.

Addition, subtraction and multiplication can be done though with mixers and the level multiplier module. Large numbers is a broblem though as the highest number representable in the system seems to be 255, being about four times unity (64). All such calculations need to be scaled and their outcome interpreted in the right way.

the level multiplier module can also be used to divide, as you can multiply an incoming control signal with 0.01 to 0.97

but i;m certain that a binary math system should be possible - the building blocks are there. A way of checking the on off state of each bit, plus a counter, and a way of converting the result back into clavia control units, which although limited to 128, can be used to set the pitch of an oscillator logarithmically which will can deal with large numbers (i.e. the frequency range. I dont know enough about binary computing to build this... yet.

I made a little patch that can display the result of a multiplication or division on the front panel, by using the noteseqencer. But the value is a note, not a number which is not much use._________________www.no-future.com

Division is equivalent to multiplication by the reciprocal value (the reciprocal of x is 1/x).

And indeed when I want to divide a signal by 2 I can multiply it by 1/2 by using a mixer or a multiplier but here one must first somehow calculate the reciprocal outside the machine.

The question however is how to perform division by a variable, where the machine itself must be able to make a reciprocal of that variable before multiplication can be used.

There is no way to get around division in general by multiplication, a possible way to get around it is using logarithms and exponentiation in a smart way such that division can be reduced to subtraction (as in the example I quoted earlier).

So the question as how to divide might be rephrased into the question as how to take a logarithm of a signal.

Don't forget you can do many approximations by using an 8-input switch as a sort of "look-up table" method of doing math (or, depending on the equation, a mixer), by generating 8 different values that get selected by a control input. These 8 inputs might in turn be 8 approximations. Heavy on the DSP%, but worth experimenting with.

If an addressable memory block was available, it would not only be useful for sampling, but performing nearly any 1-input math function like a real look-up table (tan(x) for example, or even 1/x!!!!)

Good idea to make such a table, although for those who really need it, it might be a bit cryptic.

I assume that where you wrote MUX you meant mixer ?

In my experience the ShapeExp module is a bit of a fanatasy thing, I couldn't really use it to do exponentiation on the Classic (didn't try it yet on the G2). Usefull for audio shaping or to change the keyboard velocity curve, not so much to do math with.

I noted that some people think math is not very usefull for the NM. I think this is a pitty, as there really is a strong relation between music and math that goes back far into history.

In my opinion proper math is the basis to work from, after that deviations might make things more interesting, but without math the synthesizer could not even exist.

A HP filter is basically a differentiator, at least for low frequencies, while a LP is a good approximation for a high frequency integrator. An envelope follower can also be good, though you'd need to scale the output (cheaper than a LP).

A HP filter is basically a differentiator, at least for low frequencies, while a LP is a good approximation for a high frequency integrator. An envelope follower can also be good, though you'd need to scale the output (cheaper than a LP).

On the G2, use the Glide module for an Integrator. Set the slope to linear. It is a near perfect integrator module. In fact, it should not be called a Glide module, but and Integrator module, because glide is just one function an integrator.

A filter, depending on which one you use, is more of an approximation, IMHO, and it will use more DSP resources.

what is an integrator and differentiator? I remember my basic calculus at shool ... but i take it in the world of synthesis , you're referring to something else or what?_________________www.no-future.com

Given a function [f(x)], and if you viewed the graph of such a signal (as in an oscilloscope), the differential of that signal is the instantaneous SLOPE of the function. So, in audio, for a triangle wave, as the triangle ramp goes up, you'd have a positive constant as the differential (the angle or slope of the triangle is constant), and when it starts going down again, you get a negative constant (again, the slope is a constant negative number). In essence, you get a square wave that lines up with the triangle waves peaks & valleys.

What an integrator does, is like a calculation of the "area under f(x)". So, if you put a square wave into an integrator, you get a ramp out of it for the "high" part (as time progresses, the area increases linearly), and when the square flips over, the ramp goes negative. End result: you get a triangle wave out.

If you connect your nord to a soundcard input, use some oscilloscope program to view these things (or help you tune the circuit your making).

If you connect your nord to a soundcard input, use some oscilloscope program to view these things (or help you tune the circuit your making).

I'm using wavetool. It contains a software scope which works quite well.
Anyway. Trying your suggestions, but I can't really get a pure integrator/differentiator yet. I suppose I have to do something with proportional gain.

As for proportional gain - if you use the glide module, it will be the time constant that controls the integration time. If you want an integrator for very fast events, like audio waveforms from oscillators, then just use a filter.

An integrator is really a numerical moving average of the current sample, plus each of some previous samples up to N, which is basically the time constant of the integrator. If you integrate over 100 samples that is a time of 100 * Sample Rate. If you integrate over 1000 samples, that time constant will be longer by a factor of 10. You could make an integrator using an 8 bit shift register, or several hooked up in series. Add all of the shift registers outputs in a mixer. You need to attenuate each output by about 1/N where N is the number of steps in the shift register. That is a true integrator.

As an asside, if you vary the settings on those summing mixers, then you have an FIR (Finite Impulse Response) filter. The setting of each knob is what is called a coefficient of the filter. It is possible to build very small FIR filters with the G2 in this manner, but you'll run out of resources if you want anything serious. Still, this is a good way to experiment and learn about FIR filters.

As for the differentiator, the simplist one would be the current sample minus the previous sample. Thus, the output of the differentiator is the difference signal. Why is this a high pass filter? Imagine if the signal changed from +1 to -1 every sample. The output would be +2 and -2 every clock tick. Virtually the same signal. (You'd want to scale the output by .5 obviously so you won't overload you systems dynamic range. Now imagine a very low frequency, say a DC signal that is always +!. The output of this would always be 0. Extrapolate these two examples and you'll see that at high frequencies go right through and low ones are blocked.

A differentiator is also sometimes called an AC coupler becasue it will pass AC but block DC.

Here's a simple FIR filter. It's has 16 "taps". As you load it is is an integrator because all of the coefficients are equal. There is a Xfade module so you can easily hear the difference between the input and the output.

Experiment with changing the coeffients by change the settings on the 8 channel mixers.

So a mixer will do the trick, the output has to be fed back into an input on itself that is maximally opened. The input signal can be fed into another input that attenuates quite an awfull lot (maybe an extra pre-attenuation will be needed) to avoid (almost) instantaneous clipping.

To make the integration process go slower the feedback could be sent through a sample and hold, the clock rate will then determine the speed (but it shoulld be set to at least twice the maximum frequency to be processed by it, otherwise nonsense will come out).

Note that this is still not a perfect integrator as 1) it clips, which it shouldn.t, yet it must. And 2) it's discrrete in time (and value) it should be continues. So its an approximation, but a better one than a low pass filter I guess.

I have to think a bit on differentiation, my first impulse is to say it can be done with the same circuit but setting the feedback to be negative instead of posittive, but I'm not too sure here, would need to refresh my math here ... ideas anyone ?

Remember that when experimenting with this using an oscilloscope that the G2 outputs have DC blocking, so to see if it works your signals should have reasonable frequencies, let's say 500 Hz or above.

An integrator is really a numerical moving average of the current sample, plus each of some previous samples up to N

All that follows is IMHO ... I have to go way back into the past for this ...

An integrator when fed with a short impulse on its input would exhibit a small DC jump at it's output and would not decay to zero. So a pure integrator does not have a finite imulse response ... am I right ?

A moving average OTOH does not have a finite impulse response (it's a leaky integrator, or a low pass filter), and (so) it can be modeled as a FIR filter (although to only make a moving average I think the (cheaper) circuit I suggested earlier can be used as well, only the sensitivity of the positive feedback must be reduced to below unity (again IHMO just according to the best of my rememberance)).

Question is, why would we need integration or differentiation ? I wanted it (integration) once as building blocks for filters ... any other uses for it ?

An integrator when fed with a short impulse on its input would exhibit a small DC jump at it's output and would not decay to zero. So a pure integrator does not have a finite imulse response ... am I right ?

An impulse implies that the single goes up and then down. The Integrator would return to zero after N clock ticks. If the input was a step function, the integrator would ramp up to the maxium value, but it would take N clock ticks to get there. The slope of the ramp should be constant.

What can you do with these? Well, since we already have really nifty filter modules and the glide module, the answer isn't obvious - except for educational reasons.

Any ideas?

While we are still on this topic, an Infinite Impulse Response Filter (IIR Filter) doesn't sum the outputs of the shift register - it mixes them back in with the input. There is recirculation of the signal through the shift register. These filters achieve much more dramatic filter effects, but they are a bit tricky because they can "blow up" - something that can happen whenever you play with feedback.

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum

Please support our site. If you click through and buy from our affiliate partners, we earn a small commission.