Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TUNV1 #14

Open
baconpaul opened this issue Feb 26, 2020 · 3 comments
Open

Support TUNV1 #14

baconpaul opened this issue Feb 26, 2020 · 3 comments

Comments

@baconpaul
Copy link
Collaborator

baconpaul commented Feb 26, 2020

https://www.mark-henning.de/files/am/tuning.zip is the TUN v1 spec

There is a TUN V2 spec. This library
https://github.com/zardini123/AnaMark-Tuning-Library
supports it.

@baconpaul baconpaul changed the title Does this library mean I’m redundant? Overlap? Comparability? Opportunity? Feb 26, 2020
@mkruselj
Copy link
Contributor

Here's a few .tun files (v1) for testing.

tun mini library.zip

@baconpaul
Copy link
Collaborator Author

TUN.zip

That's @JackyLigon files which match the surge tuning library are all mapped with the 1/1 and Reference Pitch on middle C.60 @ 262 Hz as tun

@baconpaul baconpaul changed the title Overlap? Comparability? Opportunity? Support TUNV1 Feb 27, 2020
@baconpaul
Copy link
Collaborator Author

From the Tuning v1 document

Section [Tuning]

This section contains a relative quantized tune in cents given for each MIDI note number from 0 - 127. The parameter name is "note #", whereas # stands for the MIDI note number.
The default value for each parameter is (100*MIDI_Note_Number). There is no setting for the absolute frequency of note 0.
The tunes are integer numbers and must not contain a '.', nor be written in scientific notation! Each one of the 128 notes has to be set. If a note is missing, this may produce a warning and the note's tuning is set to the default.
Example for a valid "[Tuning]" section, which shows the default settings:

	[Tuning]
	note 0 = 0
	note 1 = 100
	note 2 = 200
	; This has to be continued for each one of the notes
	; in the range 3-127, including 127

Section [Exact Tuning]

Similar to the section "Tuning". Differences:
The optional parameter "basefreq" specifies the absolute frequency of note 0. Its default value is 8.1757989156437073336Hz, which corresponds to the A=440Hz-tuning. ('A' is note 69.)
The tunes may be given in integer, floating point oder scientific representation, so they are much more exact.
Examples for valid numbers: "583", "-143.23", "0.837e4"
Not each MIDI note number has to be given. Note numbers <0 or >127 are generally possible in the future, but must be ignored in the current version of this format (in the following, they are treated as not-existing).
If no MIDI note number is given, keep the default tuning (100MIDI_Note_Number).
Let H be the highest MIDI note number given, let P be its tune given in the file (called P, because it's the period length). t(x) is the current tune value of the note with the MIDI note number x, which is initially set to the values given in the file.
First set the tunes t(x) of all MIDI notes in the range [0; H] which are not given in the file to the default value (100
x). Then fill in the values [H;127] according to this algorithm:

if ( H < 127 ) then 
    from i=H to i=127 including 127, stepsize 1 do: 
        Let f(i) = f(i-H) + P 
    end from 
end if

Note, that f(0) is not necessarily set to 0!
Example for a valid "[Exact Tuning]" section:

	; All 'E' should be tuned +12.5 cents compared with
	; the default scale. All other notes should have the
	; default tuning.
	[Exact Tuning]
	note 4 = 412.5
	; To let the period be one octave, we have to set the "periodic point":
	note 12 = 1200

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants