Skip navigation

Today, right now, there are Over 2000! tunes in NusachDB. As previous posts have pointed out, the method of counting can sometimes inflate totals, so what this number means is a bit unclear because it depends on how you group texts. Is the same melody for two texts one tune or two tunes? If it’s two tunes, what happens if I subdivide a text into many parts, all of them having the same tune? Right now, that Over 2000! count counts them all separately. There’s also a bit of a counting problem elsewhere, where a section that exists in multiple places is only counted once, but a tune that exists in multiple sections is counted multiple times. Regardless.

THERE ARE OVER 2000! TUNES IN NUSACHDB! Specifically, as of right now, 2001. BECAUSE 2001 IS OVER 2000!

Coming up May 22nd is the first birthday of NusachDB, which means that I’ve added Over 2000! tunes within one year, and there are plenty more to go. I’m going one service at a time, going through the first 30-odd sites on Nusach Resources and occasionally elsewhere as well, which means there are hundreds of sites that I’ve barely even looked at that will have more tunes. Friday night is done on those sites, except, of course, Piyut, with way more recordings than I can cover in time. If I went through all of the relevant recordings on Piyut before moving on, I would end up spending probably about 75% of my time there. So I’m going through it as a break between other sites so that more services can be covered.

Other interesting things: Brickoff, the game I’m working on, is at the playable demo stage. There are only three levels done and the ending sound effects are missing; I’m working on the fourth. Everything is done in JavaScript, from scratch, and that includes the physics and the sounds! Everything is dynamically generated. So far people have found it fun to play; we’ll see how it turns out!

I haven’t figured out yet how I’ll be announcing updated to NusachDB, my database of Jewish liturgical melodies and chants. One thought was that I would somehow automate git logs, but those are really private messages and I don’t exactly want to make them public. One possibility is to figure out which tunes or sections have been added and link to them, but quite a bit of infrastructure needs to be built for this to happen at this point. But I do have this blog, so I might as well post here. I will warn you, however, that postings here will be relatively infrequent compared to the actual updates. I add new tunes nearly every night, sometimes even more than once in a day (though not so often when I’m traveling, which will happen next week and I’ll be out for about three weeks). I’m not going to make posts like they’re commit messages. That’s what commit messages are for. This will be reserved for bigger and more interesting updates and milestones.

Which leads me to today. Since I started NusachDB, I kept a count in the navigation bar of how many tunes a particular section has, as a way of monitoring progress and gauging completeness. You might see that there are 92 tunes for Shabbat Dinner, for example, and figure out that there are more now than there were yesterday. Now, not all of these are full-fledged tunes, and many are counted multiple times. For example, the entire first half of the service of Kabbalat Shabbat uses the same nusach — the same chant — but with each passage having obviously different words. Each one is counted separately, and when the start and end of a passage are listed separately, each of those is counted separately as well. There’s really no way around this, I’m pretty sure, for reasons of data integrity. However, it’s also often the case that the same text is repeated at multiple places. Adon Olam, for example, may be sung at weddings, at the start of the daily morning service, at the end of Shabbat Maariv, at the end of Shabbat Musaf, etc. The same tunes are often used for all of these (though not necessarily, which makes another set of problems). This is accomplished by using reference links in the data files. A section to be linked — say, Adon Olam, in the file Common Tunes.xml — is given an id — “Adon Olam”, and when another service wants to borrow it, it can cite the filename and the id. This saves on code duplication, but the entries are duplicated in the database, because each tune needs to be aware of its parent sections and nodes. The same tune will appear multiple times with the same title, images, recordings, etc. but different paths.

Speaking of paths, one of the great advantages of, say, MongoDB over SQL is the ability to store nested documents/records/whatever you want to call it. But I’m using MySQL because I need the relational part of the paradigm. What to do? Simple: the tree is represented by a string listing the nodes in order, with some arbitrary separator (‘ | ‘ in this case), and it’s easy to find the direct parent — break off the last bit and find the node with that path — or to check whether a node is an ancestor of another — check whether its path is an initial substring of the other. What’s happening here is that a particular tune is at the end of a path of sections and services. For example, one service path might be Shabbat | Shacharit and its section path might be K’riat Sh’ma | Sh’ma | Sh’ma Yisrael | Melody 1, which would denote Melody 1 of Sh’ma Yisrael, which is part of the Sh’ma, the central passage of the K’riat Sh’ma, at Shabbat Shacharit. The tunes are exactly the same as for Shabbat Maariv, so the database entry for the tune at Maariv would have a service path of Shabbat | Maariv instead, with, coincidentally, the same section path since the two services are similar in this way.

The problem comes when we want to count them, because both services refer to the same melody, but there is no way to figure out that they’re the same melody. One solution would be to include unique id’s, but let’s get real; I’m writing these XML files by hand, so I can’t generate and maintain unique id’s for every tune. I can’t go by the title because almost every section has a Melody 1. The section lineage is what makes the tune unique, but since it can have different section lineages in different services, that’s not very helpful. So I thought that maybe I could figure out what file they’re in. That was nice! I can do that. When I reference another file, I need the name of the file, right? So I can just keep passing that around. Great! Doesn’t solve the problem, because that’s not nearly enough information to uniquely identify the tune…

So I came up with another path: the XML lineage inside the file. THAT is unique to each XML node, which the tunes are. Perfect! Except… there’s no way to easily get a lineage from an arbitrary XML element without holding the entire XML document in memory. There was a solution to that, though: whenever a section reference is encountered, whether a foreign reference or the referent, the path resets to filename | refid for the referent. This has to be unique within each file anyway or the import script will throw an error. Now, all that remains is for the counting function to count distinct paths, and hey, we get an accurate count! Shabbat went from having over 770 tunes to 602, simply by virtue of not counting the same tune nodes multiple times. It means that tune totals don’t add — Friday Afternoon currently has 48 tunes, all of them from other places because I haven’t actually collected any tunes for this particular portion of the liturgy yet. Combining them with Kabbalat Shabbat’s 306 tunes would yield… 306 tunes, because all of the ones in Friday Afternoon are also listed under Kabbalat Shabbat. I also added a Total field to gauge overall progress, and…


So close. Maybe tomorrow I’ll break 1000.

First of all, I may have been neglecting this blog, but I haven’t been neglecting NusachDB, a growing collection of Jewish liturgical tunes. It’s up to almost 1000 tunes, though with all the double-counting (for various reasons that I don’t want to get into right now), it’s probably about 400 or so unique ones. While working on NusachDB, which involves transcribing tunes found on the internet, I came across some, well, awful design. One site has its recordings stored as Flash applets, which is annoying enough, but it doesn’t actually have any controls. You can press play or you can press stop; pressing play starts the recording from the beginning and pressing stop stops it. No pause. No way to rewind. As you can guess, transcribing this is extremely annoying and an enormous waste of time. Well, a bit of digging (by which I mean just looking at the source) shows that these are .swf files, which I can download. Great, that’s a good first step! But how do I retrieve the music inside?

At first I figured it was some sort of bundle, like .app, with various resources (like the music I needed) inside. Finder doesn’t seem to think so. I googled it, to no avail. There are plenty of commercial programs that will do this, some costing $100. $100 for sound conversion? Sounds like a scam. This is a simple enough task that it shouldn’t take a program that costs more than $5 to do, so it smells like someone is trying to make some very cheap money out of this. I might as well try it myself. The Wikipedia page doesn’t have anything useful on the file specification, but maybe I can open it as a text file or something just to see what would happen. Probably nothing interesting, but… wait, I right-click the file to open it in Sublime, but one of the programs listed in the menu is The Unarchiver?

Turns out .swf is an archive format after all. The Unarchiver opens it with no problems. So yeah, don’t be an idiot and buy a program to open a downloaded Flash applet, because it’s simply not necessary and might well be an enormous waste of money.

Secondly, a recent Chrome update broke the Microtonal Synthesizer. Very sad. I got emails about it — at least it still worked in Safari, which is usually a few versions behind Chrome. Well, had some time yesterday to try to debug this; obviously there was a change in the API that broke AudioLib.js, the underlying sound library I use for the synth. (One of these days I’ll make my own, I suppose.) The synth is supposed to use WebAudio, but it was using the PCM fallback, which is terrible in every way. I couldn’t believe that Chrome decided to stop supporting WebAudio, so it must be something else. Unfortunately, it also wasn’t obvious where the code chose the right framework to use. It took a while, but eventually I found the switch — a for loop over the available audio frameworks that enclosed the creation of the audio object in a try block. If object creation failed, it would move on; if it succeeded, it would return the new object. This of course relies on an exception being thrown in case of failure. Not sure if it’s the best design. But it’s interesting that there was no catch block to deal with the exception. So I decided to log it instead, and the culprit was soon discovered: a method of the AudioContext that was renamed because who needs backwards compatibility anyway? It was throwing an exception because the method was undefined, so it was causing the audio object creation to fail and the for loop to go to the next iteration until the PCM fallback succeeded. That’s a simple enough fix — call the correct name of the method — and hey, now the synth works again! Check it out. There’s nothing new there yet, but it still works, so that’s something!

To be fair, the new plugin is the same as the old one but with different numbers.  I’m planning on making a Sibelius plugin factory at some point, to allow custom plugins.  For now, though, enjoy the ability to write in 17-tone equal temperament!

Though “temperament” is a bit of a misnomer, because while 17-TET certainly sounds like it has quite a temper, it doesn’t actually temper out anything useful.  Here are the names of the 17 notes of 17-TET:

C Db C# D Eb D# E F Gb F# G Ab G# A Bb A# B (C)

If you’ve read my previous post on the mathematics of diatonic tunings (and actually understood my ramblings), you might remember (or not) that our diatonic 12-tone system depends on two kinds of half steps, the chromatic, from C to C# where the note name doesn’t change, and the diatonic, from C to Db where the note name does change.  The chromatic half step is seven fifths forward in the circle of fifths, and the diatonic half step is five fifths backward in the circle of fifths.  In 12-TET, there are only 12 notes, so those two half steps meet at the same notes, and they’re enharmonic.  C# is the same as Db, just spelled differently.  In other diatonic tunings, though, the chromatic and diatonic half steps have different sizes!  In n-TET, the circle of fifths has n notes.  Each diatonic half step steps backwards 5 fifths, and each chromatic one steps forward 7 fifths, so if your chromatic and diatonic half steps meet after c chromatic ones and d diatonic ones, there are n = 7c + 5d notes in the circle of fifths.  Heh, like that derivation?  Anyway, one of the values of n is 17, where equivalence is reached in 1 chromatic and two diatonic half steps because c = 1 and d = 2.  1 chromatic half step from B is B#; 1 diatonic half step is C and two is Db.  In 17-TET, B# = Db.  Kinda weird, isn’t it?  c and d are also the sizes of the intervals in 17-TET steps.  The chromatic half step is 1 17-TET step and the diatonic is two.  This explains the weird order evident in the note names.  I excluded double flats and double sharps (as well as Cb, E#, Fb, B#), but it’s easy to see where they go.

Problem number 1 with 17-TET: the major triad.  Let’s look at the cent values: the major third is 423.5 cents and the fifth is 705.9 cents.  12-TET has 400 and 700, and JI has 386.3 and 702.0.  The fifth is a little sharp — not much sharper than the 12-TET fifth is flat.  You barely notice it if at all.  But the third is 23.5 cents sharper than 12-TET and a ridiculous 37 cents sharper than JI!  It resembles a major third but it’s REALLY out of tune.  19-TET has a pretty close fifth as well, but its major third is 378.9 cents, closer to JI than 12-TET.  When you hear a major chord in 19-TET, it’s very consonant; in 17-TET, it’s an elementary school class of violinists.

So, you have to wonder: how would the second movement of Beethoven’s Sonata No. 8 “Pathetique” sound in 17-TET?  Well, it’s fairly odd that you were wondering that, but that’s OK because it’s right here:

Sonata No. 8 – II (12-TET)

Sonata No. 8 – II (17-TET)

Sonata No. 8 – II (19-TET)

These recordings were made in Sibelius; the 17-TET and 19-TET recordings using my plugins for the respective purposes.  It’s really easy to retune: select all, apply the plugin, done.  (So long as you wrote the music with one note in a staff at a time, anyway; I also had to transcribe the E major section as being in Fb major to keep spellings correct.)  Hopefully they give a good sense of how 17-TET works.

And that is that it doesn’t.

17-TET is AWFUL for tonal music.  Most of the piece is beautiful major chords, and if there’s one thing that sounds awful in 17-TET, it’s major chords.  Minor chords aren’t as bad.  17-TET does have a neutral third that sounds good, the D# (which is the same as Ed, E half-flat).  However, 12-TET does not have a neutral third, so Beethoven wasn’t gonna use it!

Note that 19-TET sounds considerably better.  The intervals that most diverge from their 12-TET counterparts are the half steps, both diatonic and chromatic (12-TET: 100 cents, 19-TET diatonic: 126 cents, 19-TET chromatic: 63 cents, 17-TET diatonic: 71 cents, 17-TET chromatic: 141 cents).  The sonata movement has a few chromatic passages, and it’s really obvious.  17-TET deals pretty well with leading tones, actually, which 19-TET doesn’t, but 17-TET makes up for it by totally destroying the major triad.  19-TET has better major triads than 12-TET!

Of course, you can write great music in 17-TET.  You can; I haven’t yet.  I will post when (and if) I do.  One thing that is painfully obvious upon hearing retunings of 12-TET music is that music conceived in 12-TET probably sounds better in 12-TET, and other ideas need to be worked out for other tuning systems.  With the Offtonic 17-TET plugin for Sibelius, you can play as you will!

A while ago (a long while ago, I guess — hey, I have a job, so I’m busy), I posted about how 19-tone equal temperament is a diatonic tuning.  But is it the only one?  Other than 12-TET, that is?

Obviously not.  Let’s take a look at how it works!

Under our harmonic system, we base everything on the fifth.  A perfect fifth is a frequency ratio of exactly 1.5, which translates to about 701.955 cents.  Our 12-TET scale only uses multiples of 100 cents, so it approximates the perfect fifth quite well at 700 cents.  This is far from the only possible value, however!  There’s a small range where we can arbitrarily choose our fifth, and that’s what we’re about to explore.

Read More »

Those familiar with my old site perhaps remembered that its main purpose was to host my compositions.  Well!  Those are all back!  There’s more work to be done in the design, and there are updates to be made as well: links to more recordings, etc.  The important bit, though, is that the music page is online.  And I even think it looks pretty, but what do I know.  The rest of the site will get a makeover soon (where “soon” doesn’t mean what you think it means — it actually means “eventually”).

I’m using 2.3.4, so I don’t know if this works for other people.  I wanted to change my notification sound to the little chime in Zelda games that plays when you find a secret, but it’s not at all obvious how to do it.  Turns out you have to make a folder on your SD card called “notifications” and put your sound file there, and it shows up.  “alarms” and “ringtones” will do the same for alarm and ringtone sound files.  It’s an easy fix, but you’d think they’d have a more obvious interface for it.  ::shrugs::

I have just recently written a Sibelius plugin that allows playback in 19-tone equal temperament, Offtonic 19-TET.  The 19-tone scale has also been available on the Offtonic Microtonal Synthesizer since its creation.  So what is it?  What is it about?  What is the deal with 19-tone equal temperament, or 19-TET?

To begin with, there are many ways to generate an EDO, an Equal Division of the Octave.  The most obvious way is to simply divide the octave into n equal parts, and voilà, n-TET.  You can think of this as starting from note 0 and adding 1 each time, and when you get to n, that’s really the same as note 0.  For example, in 12-TET, I can start at C:

Read More »

Two more plugins; get them here!

UPDATE: You can also get them at the Sibelius website here and here.

Remove MIDI Pitch Bends just removes MIDI pitch bends, which is pretty useful if you bend a lot of pitches.  Offtonic 19-TET, on the other hand, is, in my humble opinion, a giant leap for microtonal composition!  …OK, my opinion may not be so humble.  It is, however, very cool, at least to a microtonal nerd like myself.  I’ll analyze the 19-TET scale in detail in a later post, with musical examples that I created using this very plugin, but for now, enjoy composing in 12-TET’s closest microtonal cousin!

Normally I’d also talk about the challenges I faced when writing these plugins, but honestly, it wasn’t so hard.  I looked at existing plugins to get an idea of the idioms, I looked at the .plg file in a text editor to see how the script was stored, and I wrote.  I would, however, be very glad to answer any questions about ManuScript, the plugin language.  Don’t be afraid to ask in the comments.

Unlike the overtone series of the previous post, there is nothing physical or natural about the undertone series, despite its very similar construction.  The overtone series consists of notes at frequencies f, 2f, 3f, 4f, and so on; the undertone series, on the other hand, consists of notes at frequencies f, f/2, f/3, f/4, and so on.  The undertone series is the mirror image of the overtone series.  If you start at one particular note and go up for the overtone series, you’d go down by the same amount for the undertone series.  It’s available in the Offtonic Microtonal Synthesizer as Undertone (C8).

Read More »