Mus2 -> MIDI -> Matlab

176 views
Skip to first unread message

Olivier Lartillot

unread,
Aug 2, 2012, 5:38:46 AM8/2/12
to mus...@googlegroups.com
Gunaydın,

In the context of the CréMusCult project, the CompMusic project, and in collaboration with Funda Yacızı from Istanbul Technical University, I am developing a routine that imports MIDI files generated by Mus2 into Matlab, based on the MIDItoolbox framework (that I integrate into my new framework The MiningSuite.)

Concretely, this means that instead of using integral pitch number + integral pitch bend parameters, I use instead pitch positions expressed as real numbers, where integers corresponds to the successive semi-tones of the equal temperament graduated scale.

I wrote a routine for that but it seems I did not manage to make it work properly.

Here is an example: Let's take the interval between A natural and D bakiyye in Saba makam. The width of this interval is 18 Holdrian commas, so corresponding to 405 cents. This would correspond to 4.05 semitones in MIDI standard, am I right? Since the interval between A and D# in MIDI equal temperament is 4 semitones, this means that the pitchbend should correspond to .05 cents, if I am right.

In the MIDI output by Mus2, the A natural has a pitchbend of 0, and D bakiyye has a pitchbend of +321 (where pitchbend has a value between -8192 and +8192). If we normalize pitchbend between -1 and +1 this means that the pitchbend for D bakiyye is +0.0392. So I was expecting that to convert the pitchbend normalize MIDI value (between -1 and +1) into cents, we could use the equation: pitchbend_cent = pitchbend_normal_MIDI / .0392 * .05

But when I try this equation to the next intervals in the MIDI file I am trying to import, I see that the conversion is not correct.

Could you please explain me how to proceed?

Thanks for your kind attention,

Best regards,

Olivier Lartillot

Utku Uzmen

unread,
Aug 2, 2012, 1:53:32 PM8/2/12
to mus...@googlegroups.com
Hi Olivier,

In your calculations, the pitch bend value should correspond to 5 cents. However, note that the maqam scales in Mus2 are slightly different than the 12-tet scale. The frequency of D5 (natural) would be around 586.666 Hz. Its ratio to A4 at 440 Hz would be approximately 1.333 which converts to around 498 cents. Subtract from this the value of the Bakıyye bemol, 90.2 cents, and the interval is reduced to 407.8 cents.

Mus2 uses a fixed pitch bend range of +/- 2 semitones or 200 cents. So a bitch bend value for 7.8 cents would be 7.8 / 200 * 8191 = 319.449, which is near the value you saw in the MIDI file. (The pitch bend range is 0-16383 with 8192 corresponding to the neutral position)

I should also point out that the latest internal beta version of Mus2 can export to the SymbTr format proposed by M. Kemal Karaosmanoğlu (also involved in CompMusic). This format includes values in comma units and I imagine it could be useful in your work. A quick search reveals a copy of his article here: http://compmusic.upf.edu/system/files/static_files/KemalKaraosmanoglu_Ismir2012.pdf

If you are interested, I can send you a copy of this internal version.

Best,


Utku Uzmen



--
You received this message because you are subscribed to the Google Groups "Mus2" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mus2-en/-/x7zDKFOqBcUJ.
To post to this group, send email to mus...@googlegroups.com.
To unsubscribe from this group, send email to mus2-en+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mus2-en?hl=en.

Olivier Lartillot

unread,
Aug 3, 2012, 5:11:43 AM8/3/12
to mus...@googlegroups.com
Hi Utku,

Thank you very much for the detailed answer.

Kind regards,

Olivier

Ozan Yarman

unread,
Aug 3, 2012, 4:48:24 PM8/3/12
to mus...@googlegroups.com
Dear Olivier and Utku,

This reminds me of a pitch calculation table I had undertaken by hand, to cross-check my Mus2 MIDI output imported in Logic Pro, when preparing the audio mix of my score arrangement of Ivor Darreg's 19-tET pieces under the title "Darreg's Motley" for MELM: Microtonalist Entrepreneurs International Meeting (http://www.ozanyarman.com/musics.html) played by Academic Başkent String Ensemble in Ankara.

You can check the relevant Mus2 files attached.

1 cent corresponds to 40.96 Midi Tuning Units (MTU) and the maximum tuning range is assumed to be 200 cents up and down (-8192 ... 0 ... +8191 MTU) in Logic Pro. Therefore, with A at 440 Hz corresponding to 0 MTU / cents detuning, the calculation table is as follows:


12-tET pivot points 19-tET notes and cents detuning MTU detuning

0 cents C +15.78947 +647
100 cents C# -21.05263 -862
100 cents Db +42.10526 +1725
200 cents D +5.26316 +216
300 cents D# -31.57895 -1293
300 cents Eb +31.57895 +1293
400 cents E -5.26316 -216
500 cents E#/Fb -42.10526 -1725
500 cents F +21.05263 +862
600 cents F# -15.78947 -647
600 cents Gb +47.36842 +1940
700 cents G +10.52632 +431
800 cents G# -26.31579 -1078
800 cents Ab +36.8421 +1509
900 cents A  0  (reference freq. = 440 Hz)  0
1000 cents A# -36.8421 -1509
1000 cents Bb +26.31579 +1078
1100 cents B -10.52632 -431
1200 cents B#/Cb -47.36842 -1940
1200 cents c +15.78947 +647


Note, that the incorrect assignment (if the negative/positive signs escape your attention) of almost the same integer MTU values for several notes, except toward opposite directions, will ruin the whole tuning!

This is a very simple mistake to make, and to complicate matters, Logic does not show the + sign for positive MTU detunings. It took me many hours to meticulously check which absolute detuning value corresponded to which 19-tET note.

To align 19-tET's A to the 900 cent A to match 0 cents detuning, the operation here is:

{(1200 / 19) * n } + {900 - [(1200 : 19) * 14] }

Where n is the degree of 19-tET.

To convert to MTU, just multiply the outputs with 40.96 and round to the nearest integer.

Dr. Oz.


--
 
 
DarregPreludes.mus2
DarregWaltz.mus2
Reply all
Reply to author
Forward
0 new messages