Tag Archives: Max

Tathagata

The base-chords and note progression that forms Tathagata is something that must have been going through Fredrik Thordendal’s head for some time.  This progression is something that has emerged at least 3 times in both Meshuggah and Fredrik’s solo work, and can be heard as the basis of Tathagata (Sol Niger Within, 1997; Sol Niger Within version 3.33, 1999), the close [3:50] of Sublevels (Destroy Erase Improve, 1995) and the outro [9:06] of Fredrik’s Secrets of the Unknown demo.

Tathagata is a beautiful track that seems to will the listener into innately feeling or predicting the next series of notes.  I was wondering why I felt this way about the track, until I sat down and started to score out the notes.  What emerged was a pattern, or a recursive, self-pitch-clipping algorithm.  (While it is a progression that continues to spiral upward, it has octave subtraction protection to stop it going on infinitely upward).  This is a very cool progression that, while it isn’t an auditory illusion, for some reason makes me think of a Shepard-Risset glissando, Risset’s rhythmic accelerando auditory illusion, or Autechre’s Fold4,Wrap5 (LP5, 1998).

At first, I thought the track progressed in measures of 5, with the notes being played on the 1, 2 and 3. Sarah argues that each measure is divided into 16ths with stresses on 1, 4 and 7, which I now think is actually correct.

In lay terms, the track can be represented as such:

The pattern progresses in a count of 16.

The ‘root’ note starts at MIDI pitch 56, and adds 5 semitones after each loop.  If ‘root’ exceeds 62 (or the initial ‘root’ value + 6), then subtract 12.

‘root’ plays a chord (root, root + 7, root + 12 [they are transposed down an octave in the code below]) on the 1 that rings out over the course of the measure.

‘note[1-3]’ is the melodic progression of the plucked parts.  They play on positions 1, 4, and 7 respectively of the measure.

note[1] = root + 2

note[2] = root + 3

note[3] = root + 11

One possible implementation of Tathagata for JS in Max

 

// Simple representation of pitches and key modulation in Fredrik Thordendal's Tathagata.
// Tathagata.js by Alex Mesker / alex@x37v.com / www.x37v.com
// Save as Tathagata.js and put it in your Max search path.
outlets = 2;
setoutletassist(0, "Melodic progression (MIDI pitch)");
setoutletassist(1, "Root chord note/s (MIDI pitch)");
var root = 56;
var cutoff = root + 6;
function msg_int(i) {
if (i==1) {
outlet(1, root-12);
outlet(1, root-5);
outlet(1, root);
outlet(0, root+14);
} else if (i==4) {
outlet(0, root+15);
} else if (i==7) {
outlet(0, root+23);
root += 5;
if (root > cutoff) {
root -= 12;
}
}
}

Save the above JavaScript as Tathagata.js and put it in your Max search path.

A Max patch that uses it can be downloaded here:

 ----------begin_max5_patcher----------
1034.3oc0YtzbaBCDG+r8mBMb1MC5EO5jKc54dqSuzloCATrIEPd.4ooMS9t
WP.wOBTDBaYxgPRDfz+8m1c0hzyKWXcO+IVgE3ifuCVr34kKVHappgEM++Bq
zfmBSBJjOlUJqnHXMyZU88DrmDx1QXZaaayYErLQfHlm8ybVnnt+gT3M1q.X
mpq1MW.207RY6RiyRXB4nfZ6o.Q3l3r0G0KxWkhj8E5F5J.z639guSz1QvlV
iijhje+ie.ha04C7LQVPJSdqOkGGjzdm5dP7msr5A0x509u5kJh+q7FvRQT0
5KKWVcYkhHLjmlVxm2fvuvR3Qwg+H6a73vWIbRbFKjuKSbDX5FwXBsBKHj2v
LF1OiadeHVNgQIRTS5Ex1c.Y3vP9BRxOugmGoBGUkHXa3ADg3Odh3YDfjw9c
4f8Fdb6s.h0HCzv1R+GBQ9Kbsik8XhzvtZDoEWMAc2EmH4fhsLVTmPwdXnXK
CPpSnMRn3bsS+zCQJ9ODANX9XnsqjH3AHRGQF6W33hFZz6BWtiMx.gHSaIHL
7Z6CzKL7GML7mHL1Ojyr.hDdPz8AYqsF8pmRh.kIGbrGeJBjN4MkJ8rRkco2
yx0z3cqyFLjwi5v3oZtnwpKAC51yX65Ji..0LwQStRG33yUhbLSYD5M26O04
dx6l4djl4ImxbO7ZVBYZvuXYbAqracAXWpcm..2O.7jqPPbq+zBn63cOf5rR
wCkowkNH0+gA7PlLoP1SGUtuKPUEl5OZZXDQgd5FMActlQSsFNTunHJjpscS
ul1cAKAXO1Tmv5O9D5Q1u+QiKbfpaAUqN2kZVjDG0yJqnAc2QT4FO3ViCeuw
f.xPKfdzGdmxipMSyYidS1DQlyD0p9nZKrwMVq5iPyo5iNhAkDHNcWpr+bza
KDlPci1y+5Fka8HKGXCff8q8bDhnC55Tu8t9dCfHRGo8m.hZ+4bu0bB950IL
8hhH0AQdsWU+qq8GXqGOiEBxD4bvAGLx3RE19oBZryqyiMPnap7XA3qAhMAq
CDA27XgdS+HjrzGOMJMVqi+Ykg1+svDVf1UGfP6SfNt8f6hsmzxmQdzKmbHi
Rynp8igTAeWdX6HztWXf8VRDqPDmIO1qCdnpiz6fGZSbTDK6v5eSii1xKCua
DQOA4ppoSFtt0T0ZRFTSUkFLnlLKl7UPQtFUQJ4KY34MaEoDzbt2pHoS72tz
ZRoHNiqH3.JhXTE4n.ileJxryZTETjiYWLoJZCMfjnFURDURSZ1L2PkRc6Xd
MAUQSlK2MRk4tpCRvjbRkBAfTyqInJZxfycpjbBYVebUpp7j42KtjTIU.ZFp
IrYC6NY35gSlMrCoRp.DY9UAN1rbBqRkSXytDL1U0xBPyLM4OAMU9Our7ez3
5PsB
-----------end_max5_patcher-----------

Pitched Synthesis with Noise Driven Feedback Delay Lines

The other day I was listening to Autechre’s Quaristice and thinking about my first perceptions of the album.  I remember thinking “This album has a very physical-modeling feel to it”.   I had forgotten about this, and recently I was playing around with Karplus-Strong string-modelling synthesis, after reading about the methodology behind it.

The opening of Autechre’s 90101-5l-l has these gorgeous rich resonating tones, which I accidentally seemed to be able to replicate with a Karplus-Strong model.  It sounds like they are capturing an incoming audio stream and then thrusting a noise-grain into a Karplus-Strong algorithm. (There’s more going on in there, but this seems to be the basis.)

Autechre – 90101-5l-l (Quaristsice)

Example of Noise-Grain Feedback using Karplus Strong Plucked String Synthesis Methods
 

In simple terms, Karplus-Strong tones are generated by taking a burst of noise, and creating a feedback loop that repeatedly lowpass-filters the noise and scales the volume back slightly.

The combination of each of these factors plays a part in the resulting tone:

  • The brighter the burst of noise, the brighter the attack and note.
  • The loop time determines the pitch (shorter = higher, longer = lower)
  • The amount of filtering determines the length and life of the note.

Kind of like concatenative synthesis with a recursive function applied to each grain.

So, for fun I was trying to make a synth that would generate tones using this noise-based feedback model using Max.

In order to generate a specific tones, I was basing my pitches on the relationship:

F0 = FS / Z-L

That is, the fundamental frequency (F0) is determined by the sample rate (FS) divided by the length of the delay line in samples (Z-L).  Put simply, the number of times the delay line is read through per second is its frequency in Hz.

My first versions suffered from a very strange thing where the pitch accuracy was shockingly bad.  I was getting weird results where tones were getting more out of tune the higher they went.

The first problem is that I was using a [delay~] delay line with integer sample-length delays.  Who would have thought that something that was ‘sample accurate’ could be a bad thing?

I realised later that it was bad because the generated tones were inversely proportional to the sample rate and that the values were being truncated to integer lengths.  When the length of the delay was long, the pitch was moderately accurate.  However, as the sample length got shorter, the pitch went way out.

The reason why this is bad is quite interesting.  Consider that we are working at a sampling rate of 44100 Hz.

What tone will be generated if we use a delay line consisting of 5 samples?

44100 / 5 = 8820Hz

What about a delay line of 4 samples?

44100 / 4 = 11025Hz

This is a big problem.  As the frequency that we are trying to generate gets higher, the less range we have in discrete tones.

At first, this appeared to be a sample rate issue.  If we increase the sample rate we should be able to get finer tone control.  However, doubling it means that we can get only one new pitch between the two we got at 44100.

88200 / 9 = 9800Hz

This is still not that good.  My solution was to make an abstraction and try some ridiculous upsampling with [poly~].  With this, understandably came a hit to my CPU.  The solution was still not all that good, as only one single new pitch could be attained between the previously possible tones each time the sampling was doubled.

This had been puzzling me for about a week until I decided to drop [delay~] for [tapin~].  Amazingly,  [tapin~] allows fractional sample length delays, as it does subsample interpolation when given a signal as its delay time.

The following is an example of the nature of the low-pass roll-off effect.  The clip starts with a fairly moderate low-pass filter (centred around 1500Hz) that is slowly opened up until it is barely filtering the delay line.  As the filter starts out strongly attenuating, the note is quickly damped, and demonstrates a transition from:

Muted > Damped > Koto > Plucked Bass > Slap Bass > Harpsichord > Non-Realistic Model of a Resonating String.
[Examples of Simple Plucked String Synthesis with a Relatively Bright Pink Noise Excitation.]

A simple version of the patch can be downloaded here: Karplus-Strong example