Open Theremin and Zynthian


the fine tune feature is not 100% correct yet.
It only works within this 8192*2 range.
When you pitch your zynthian to the lowest or highes value, pitch-bending won’t work correctly.

So there needs to be some kind of border crossing anyways. :slight_smile:


Could somebody fix the math for working correctly with the full range? :wink:
There are 2 small functions in zyncoder.c:

void set_midi_filter_tuning_freq(int freq) {
	double pb=6*log((double)freq/440.0)/log(2.0);
	if (pb<1.0 && pb>-1.0) {
		fprintf (stdout, "Zyncoder: MIDI tuning frequency set to %d Hz (%d)\n",freq,midi_filter.tuning_pitchbend);
	} else {
		fprintf (stderr, "Zyncoder: MIDI tuning frequency out of range!\n");

int get_tuned_pitchbend(int pb) {
	int tpb=midi_filter.tuning_pitchbend+pb-8192;
	if (tpb<0) tpb=0;
	else if (tpb>16383) tpb=16383;
	return tpb;



When I tested it, the math itself was ok.
The issue I had was the cap: tpb>16383 and tpb<0

This is wrong. Actually you need to translate to the next or previous note value and pitch to the remaining difference.
Hope you understand, what I mean.


I think i understand … but the range in the webconf’s selectbox is restricted to this range and don’t allow configuring a higher or lower value, so it should work OK for the values you are allowed to select from the webconf tool (392-492 Hz). Is that correct?

Of course, if we want to use a bigger range than pitchbend, then we should implement the solution you propose. Do you think that is needed? Anyway, if someone wants to use such a tuning, it could combine with the “transpose” feature, available from the Zynthian UI.



Yes, the fine tune piitch should be between - half a halftone to + half a halftone.
If you need more, you can transpose. (ah you said it :slight_smile:

As we are using the pitch message for this feature, we are stealing it from the actual pitch bending
I guess we need it. There are people with absolute hearing (not me). And when you pitch from one tone under or over to 0, you hear it.

And if we have this additional mechanism, we can even add a feature, that don’t have many keyboards.
Pitchbending over more than one tone.

And this is especially interesting for the Theremin.

And yes, then we need a new math (logarithm). But we need the pitchbend to transpose bridge first.