Frequency Table Read for Alternative Tuning


#22

@lokki I’m using conversion from frequency to midi -64 to 64 and converting to 32uint outside of the axoloti but following the research I’ve been doing thanks to the thetechnobear’s advice you really need to be doing any conversions on the axo or another device that supports fixed point math and the Q number systems used on the axo.
Having said that the best way forward seems to be to follow johannes and the others model and use functional tuning on the axo itself. This could mean an init routine that sets up a array maybe even multi dimensional i.e. with an offset indexing scheme like thetechnobear hinted at. Try thinking about the intervals as functions. 2/1, 7/4 etc or algorithmic forms rather than floats then your using the number system on the architecture itself. Much much simpler.

I’m still working on it...I’m attempting to write a parser for files on the SD.

The axo is by all means a highly flexible system to use and should reduce the kinds of rounding errors and problems with overflow ( especially in the smaller Edo’s ) you’ll get trying to do things elsewhere and bringing them in from outside.

I forget where I saw it on here but I think it was lokki’s Remapper? that could also be pressed into service for keymappings too..

By the way Op de Couls Scala is a beast.


#23

@jaffasplaffa Floats have spoiled me too.

I'd love to know if this object still works on the axo.


#24

I love to work with floats.... When I can use them as they are and not having to do all the scaling/bitshifting.

I made a good bunch of modules for VCV rack and also made a couple of simple vst's and its just soo much simpler without all the scaling.

but Axolotis shines in other ways, but yeah, it would shurely be nice to atleast have a simple way of working with floats in Axoloti world, even though they maybe not be as efficient. Its not always about efficiency, in some cases simplicity is more important. By that I mean its not every patch one make that pushes axoloti to the limit. Sometimes I would rather use a little bit more dsp/memory and get to the result easily and quickly, using floats, than having to break my brain in the scaling process :slight_smile:


Microtonal patches broken in 2.0
#25

I've found the maquam synthesizer patch from music tech fest 2016 that contains @johannes scala file importer. I think johannes ported it from another open source synth.

Maqam Synthesizer.axp (17.1 KB)


#26

Amazing!!
Thanks for sharing this, I am going to spend some time pouring over this, pure gold.
I'll fire it up later today. :star_struck:


#27

How to use axolotis polyphonic voice assignment for this?


#28

I think you put the scale loader and the table in the mainpatch und have the table read in the subpatch, refering to the table in the mainpatch.


#29

true its working now....super yeah


#30

Yes so much fun!

Does someone have any Ideas how to turn this into a system that can load different scala files?

Could you replace the attribute with the filename with in inlet and then hook up several strings?

I tried this but I'm not so good with code. I guess I need to move the load aspect out of the init secion in the code but I don't know how.


#31

@jaffasplaffa I’d like to check out your VCV stuff, is it online?


#32

No its was mostly for personal to start with and maybe later for a commercil package. So for now it was not released.

And they wont work with 0.6 version cause I have not updated them.

My plan was to make som paid modules, which I have not entirely given up on yet. But yeah I can share a couple I think.

I have to dig out all out again, but if you are interested follow this tutorial, it is actually VERY easy to make objects for VCV. This tutorial is updated for VCV 0.6. It shows all the the tools you need to install and make modules.


#33

Thanks. I’ll check that out when I get a chance.


#34

Thanks all @Blindsmyth you rock !
So cool to be able to use scala files . I will just see if i can get the bits that translate the interval ratios into axoloti domain values and go from there to make that dinamic table switching .

Cool to see your VCV stuff but is going a bit offtopic maybe?

I had so much fun playing polyphonic Rast and Usak maqams , was enjoying like a child in a turkish wedding :slight_smile:
@lokki Loved your outlet mapping example . Where could I get more info about editing objects ?
I was trying in the wrong object apparently using the table edit doesnt seem to make sense now that I see Johannes object for the scala thingy . Please feel free to post threads or known resources for making custom objects and coding inside the k-rate and s-rate objects . I got lots of information from axo Github which i didn't know existed . There is even a part for people coming from pd and max that was super helpful to understand the differences


#36

I solved it in a different way ... by modifying an object so it converts one pitch to another. With this object in between a keyboard object and an e.g. an oscillator, one gets whatever frequency in the list (see below) played in the osc.

I'll just provide the XML code of the object here, I hope that helps some of you.

I have a function that converts a list of frequencies to pitch and outputs the corresponding pitch. Since I only used 12 notes, the "determine_key" function converts incoming pitch (frac32) to an integer, which corresponds to one note / the index in the list of 12 frequencies.

For any questions, just ask.

<axoObjectPatcherObject id="pitch_hack" uuid="6b958b82fafa8d61216203d28f9f0e4cd27fa2a6" sha="1bffe2143076d9d67735f75abda79ef4c82db4ac">
   <upgradeSha>61413e41a22dba4d3f6a4be145c06146934f7120</upgradeSha>
   <author>Andrea Heilrath</author>
   <license>BSD</license>
   <helpPatch>math.axh</helpPatch>
   <inlets>
      <frac32.bipolar name="note" description="note"/>
   </inlets>
   <outlets>
      <frac32.bipolar name="pitch" description="pitch"/>
      <frac32.positive name="amp" description="amp"/>
   </outlets>
   <displays/>
   <params/>
   <attribs/>
   <file-depends/>
   <includes/>
   <depends/>
   <modules/>
   <code.declaration><![CDATA[float frequencies[12] = {220, 220, 220, 220, 440, 440, 440, 440, 880, 880, 880, 880};
float amplitudes[12] = {0.2, 0.5, 0.8, 1.0, 0.2, 0.5, 0.8, 1.0, 0.2, 0.5, 0.8, 1.0};

int semi_tone = 2097152;
int ref_e4 = 134217728;
int key = 0;

int32_t freq2pitch(float freq){
	return int32_t(2097152.0 * 12.0 * log2f(freq/329.63)); //reference pitch e4, 134217728
}

int32_t famp2intamp(float amp){
	return int32_t(134217728*amp);
}

int determine_key (int input_pitch){
 	return ((input_pitch + 134217728) % (12 * 2097152)) / 2097152;
}]]></code.declaration>
   <code.init><![CDATA[]]></code.init>
   <code.dispose><![CDATA[]]></code.dispose>
   <code.krate><![CDATA[key = determine_key(inlet_note);
outlet_pitch = freq2pitch(frequencies[key]);
outlet_amp = famp2intamp(amplitudes[key]);]]></code.krate>
   <code.srate><![CDATA[]]></code.srate>
   <code.midihandler><![CDATA[]]></code.midihandler>
</axoObjectPatcherObject>

#37

Hey , wow @corratio , cant wait to test this and learn from the code , Thanks a zillion ! Ive tried in the past to get the arrays on my own etc cause I would prefer to have it hardcoded in objects too . Amazing , thanks


#38

Hey there corratio. I tried to make a new object from scratch adding the info on your xml but I do get an error missing a function . On compile attempt

"undefined reference to `log2f'"

Do I have to define this function somewhere else ? cause It doesnt seem to be in the xml

Thanks


#39

Hm. Since I made this object some time ago I'm not 100% sure... but I think it should be in the

math.axh

This has to be included for some reason :smiley: But I don't find it right now.


#40

hmm. I tried adding this from the log object , but still doesnt work . It compiles correctly but math is wrong . I have to find that log2f or make an implementation . Im looking a getting redirected to c++ websites and literally rocket science stuff :slight_smile:

this is what Ive tried adding on top of the other functions :

float log2f (float val){
Float_t f;
f.f = val;
int32_t r1 = ((f.parts.exponent&0x7F)-18) << 24;
int32_t r3 = logt[f.parts.mantissa>>15]<<10;
return r1 + r3;
}


#41

OK for now I just tried log instead of log2f ( probably not a good idea )
however it works now And I understood a lot from your patch , thanks a lot .
I will keep testing and I will avoid the 12 % function since I will dump in frequency tables with all 128 frequencies to avoid the math and have consistency across instruments in other platforms .
Just did a tool a while ago that converts scala files to a frequencies array that I should take a 2nd go for this now .
So many ideas and much cleaner for me to code than patch certain things .