back to list

Adaptive JI by injection locking (entrainment)

🔗Keenan Pepper <keenanpepper@...>

5/27/2011 3:18:34 PM

I just had a really sweet idea.

Injection locking, a.k.a. entrainment, is when two oscillators with slightly different natural frequencies become locked in a definite phase relationship when there is a nonlinear coupling between them, so the frequencies become identical. The well-known "discovery" of this phenomenon was when Christiaan Huygens (of 31 equal fame!!) suspended two pendulum clocks from the same beam, and observed that they kept exactly the same time, even though they kept different time when apart.

Crucially for our purposes, two oscillators can also have any of their harmonics become injection locked to each other. In other words, the fundamentals can become locked to any JI interval. For example, in the audio file here
http://en.wikipedia.org/wiki/Injection_locking#Injection_pulling
it's obvious that the variable-frequency oscillator becomes locked to the fixed one at intervals of 5/1, 3/1, and 1/1, and if you listen closely you can also hear brief periods of lock at 13/3, 11/3, 7/3, 11/5, 9/5, 5/3, and 7/5. (These contain only odd numbers because the square waves involved have only odd harmonics. In contrast, at 4/1 and 2/1 you can hear the beating stop for an instant, but the oscillators don't become locked for any finite length of time.)

This phenomenon is already present and noticeable in acoustic instruments. For example, I'm sure I can hear injection locking in this aulos performance: http://www.youtube.com/watch?v=PVsWWkBrKG4

But as far as I know, all adaptive JI schemes proposed so far involve some algorithm to determine what the JI intervals are supposed to be, based on some more or less artificial conditions.

Has anyone ever implemented adaptive JI using digital (simulated) injection locking? This seems to me like a much more "natural" way to do it, and it's probably much simpler to implement. If not, I'm going to try adding it to amSynth (http://code.google.com/p/amsynth/), a nifty little softsynth to which I'm currently adding alternate tuning support.

Keenan

P.S. One last random thought: Is it possible for two people to injection lock their voices to each other, by pressing their throats together or something?

🔗Carl Lumma <carl@...>

5/27/2011 4:39:55 PM

"Keenan Pepper" <keenanpepper@...> wrote:

> I just had a really sweet idea.
> Injection locking, a.k.a. entrainment, [snip]
> Has anyone ever implemented adaptive JI using digital (simulated)
> injection locking? This seems to me like a much more "natural"
> way to do it, and it's probably much simpler to implement.
> If not, I'm going to try adding it to amSynth
> (http://code.google.com/p/amsynth/), a nifty little softsynth
> to which I'm currently adding alternate tuning support.

The problem with automatic JI isn't usually figuring out
what the chords are supposed to be, it's figuring out the
melodic motion between chords.

> P.S. One last random thought: Is it possible for two people
> to injection lock their voices to each other, by pressing their
> throats together or something?

I've often wondered if brass choirs playing in close
spaces don't get some guidance from entrainment. As I
think about it now, probably not. But it's a nice
thought. :)

-Carl

🔗Steve Parker <steve@...>

5/27/2011 5:07:04 PM

On 28 May 2011, at 00:39, Carl Lumma wrote:

> The problem with automatic JI isn't usually figuring out
> what the chords are supposed to be, it's figuring out the
> melodic motion between chords.

This may be above my head.. but diving in..

The biggest problem is dealing with it over an entire piece so drift is accounted for.
In my experience of choral singing this tends to be dealt with in sledge hammer fashion by someone
adamantly sticking to a pitch or re-entering and resetting.

Steve P.

🔗Keenan Pepper <keenanpepper@...>

5/27/2011 6:04:16 PM

--- In tuning@yahoogroups.com, Steve Parker <steve@...> wrote:
>
>
> On 28 May 2011, at 00:39, Carl Lumma wrote:
>
> > The problem with automatic JI isn't usually figuring out
> > what the chords are supposed to be, it's figuring out the
> > melodic motion between chords.
>
> This may be above my head.. but diving in..
>
> The biggest problem is dealing with it over an entire piece so drift
> is accounted for.
> In my experience of choral singing this tends to be dealt with in
> sledge hammer fashion by someone
> adamantly sticking to a pitch or re-entering and resetting.

Exactly right, and my injection locking idea would instantly solve this problem, because each oscillator would have a permanently fixed natural frequency, and would only differ from that frequency when other oscillators are playing. The average frequency shift over time of all the oscillators would be forced to center itself around zero, because if you try to pull any given oscillator's frequency too far away from its natural one it will just fall out of lock.

Also it should be obvious that the injection locking would only apply when multiple oscillators are playing in harmony. If one oscillator is playing a melody by itself it won't be perturbed by any other oscillators, so the frequencies will be exactly the natural ones you set it to.

Keenan

🔗Mike Battaglia <battaglia01@...>

5/27/2011 7:48:42 PM

On Fri, May 27, 2011 at 6:18 PM, Keenan Pepper <keenanpepper@...> wrote:
>
> Has anyone ever implemented adaptive JI using digital (simulated) injection locking? This seems to me like a much more "natural" way to do it, and it's probably much simpler to implement. If not, I'm going to try adding it to amSynth (http://code.google.com/p/amsynth/), a nifty little softsynth to which I'm currently adding alternate tuning support.

This is a fantastic idea, how are you going to implement it? Some kind
of waveguide-based approach?

-Mike

🔗Aaron Krister Johnson <aaron@...>

5/27/2011 7:58:45 PM

Keenan,

I'm fascinated by the idea, and interested to see how it progresses!

More interesting: you use amSynth! Is this now cross-platform? I only know
it from Linux; in fact I was interested in adding tuning tables to the
codebase for WhySynth on Linux some time ago, but I never got started, being
rather too busy to do so. Again, I'm eager to hear how *this* progresses,
too.

Cheers,
AKJ

On Fri, May 27, 2011 at 9:48 PM, Mike Battaglia <battaglia01@...>wrote:

> On Fri, May 27, 2011 at 6:18 PM, Keenan Pepper <keenanpepper@...>
> wrote:
> >
> > Has anyone ever implemented adaptive JI using digital (simulated)
> injection locking? This seems to me like a much more "natural" way to do it,
> and it's probably much simpler to implement. If not, I'm going to try adding
> it to amSynth (http://code.google.com/p/amsynth/), a nifty little
> softsynth to which I'm currently adding alternate tuning support.
>
> This is a fantastic idea, how are you going to implement it? Some kind
> of waveguide-based approach?
>
> -Mike
>
>
> ------------------------------------
>
> You can configure your subscription by sending an empty email to one
> of these addresses (from the address at which you receive the list):
> tuning-subscribe@yahoogroups.com - join the tuning group.
> tuning-unsubscribe@yahoogroups.com - leave the group.
> tuning-nomail@yahoogroups.com - turn off mail from the group.
> tuning-digest@yahoogroups.com - set group to send daily digests.
> tuning-normal@yahoogroups.com - set group to send individual emails.
> tuning-help@yahoogroups.com - receive general help information.
> Yahoo! Groups Links
>
>
>
>

--
Aaron Krister Johnson
http://www.akjmusic.com
http://www.untwelve.org

🔗Keenan Pepper <keenanpepper@...>

5/27/2011 8:18:32 PM

--- In tuning@yahoogroups.com, Mike Battaglia <battaglia01@...> wrote:
> This is a fantastic idea, how are you going to implement it? Some kind
> of waveguide-based approach?
>
> -Mike

I'm really interested in what you mean by "waveguide-based", because I was thinking of something that doesn't sound at all like that, and is just the simplest thing I could come up with.

Let's say you have two oscillators and you want to give them some coupling to each other so they can become injection locked. Each oscillator internally keeps track of its own phase, and for every sample basically does

phase += frequency * (delta t)

and then its output is some function of that phase. For concreteness let's say they're both sines, so their output is sin(phase).

If I'm the first oscillator, in order to be able to lock phase with the other guy I have to do something different that depends on his phase. I could certainly look at his phase directly, but if I only look at his output (not his internal phase), I can also make injection locking happen, and that case is more easily generalized to hundreds of oscillators.

Again for concreteness, let's say I'm trying to make my phase equal to the other guy's (rather than some definite nonzero phase difference, which would also work).

If my phase is zero, that means my output is crossing zero and it's going up. Therefore, if the other guy's output is positive, that means he already crossed zero and I need to speed up to catch him. If the other guy's output is negative, he hasn't crossed zero yet, so I'm rushing ahead of him and need to slow down.

If my phase is pi/2, however, then my output is at a maximum and it's not currently changing. Therefore I can't tell from the other guy's output whether I'm lagging behind him or rushing ahead of him. In lieu of an error signal, I always use my own natural frequency when my phase is pi/2.

The simplest way to complete this emerging pattern is to perturb my frequency by an amount proportional to

cos(my phase) * (other guy's output)

So the way I update my own phase becomes

phase += (natural_frequency + coupling * cos(phase) * (other guy's output)) * (delta t)

A bonus is that this is super easy to generalize to a whole synthesizer's worth of oscillators. Just replace (other guy's output) with (whole synthesizer output). It doesn't even matter if you subtract out each oscillator's own contribution to the output, because its error signal with its own output must average to zero.

Keenan

🔗Keenan Pepper <keenanpepper@...>

5/27/2011 8:26:06 PM

--- In tuning@yahoogroups.com, Aaron Krister Johnson <aaron@...> wrote:
>
> Keenan,
>
> I'm fascinated by the idea, and interested to see how it progresses!
>
> More interesting: you use amSynth! Is this now cross-platform? I only know
> it from Linux; in fact I was interested in adding tuning tables to the
> codebase for WhySynth on Linux some time ago, but I never got started, being
> rather too busy to do so. Again, I'm eager to hear how *this* progresses,
> too.

Unfortunately I don't think it compiles on Windows yet, but it definitely wouldn't be too difficult to port. The GUI library, gtkmm, already works on Windows, so all you'd need to do is write Windows MIDI and audio interfaces for it and then compile it.

My version of amSynth can already read SCL and KBM files and retune itself. I'm about to submit a patch to the main developer, Nick Dowell, so it can get included in the next release, but I'd be happy to send anyone a tarball who wants it.

Keenan

🔗Carl Lumma <carl@...>

5/27/2011 9:00:31 PM

"Keenan Pepper" <keenanpepper@...> wrote:

> Exactly right, and my injection locking idea would instantly
> solve this problem, because each oscillator would have a
> permanently fixed natural frequency, and would only differ
> from that frequency when other oscillators are playing.
> The average frequency shift over time of all the oscillators
> would be forced to center itself around zero, [snip]
> Also it should be obvious that the injection locking would
> only apply when multiple oscillators are playing in harmony.

I don't get it. It's straightforward to simply code this
behavior if it's what you want. In fact, Hermode tuning
does. -Carl

🔗Keenan Pepper <keenanpepper@...>

5/27/2011 9:26:20 PM

--- In tuning@yahoogroups.com, "Carl Lumma" <carl@...> wrote:
> I don't get it. It's straightforward to simply code this
> behavior if it's what you want. In fact, Hermode tuning
> does. -Carl

Can Hermode tuning automatically work with any tempered scale you choose? Or is it specific to temperaments similar to 12-equal or meantone?

I think the thing that would make injection locking different from just about any other system is it's totally temperament-agnostic. There's really only one parameter: the coupling strength between oscillators.

Keenan

🔗Carl Lumma <carl@...>

5/27/2011 10:06:56 PM

-- "Keenan Pepper" <keenanpepper@...> wrote:

> --- In tuning@yahoogroups.com, "Carl Lumma" <carl@> wrote:
> > I don't get it. It's straightforward to simply code this
> > behavior if it's what you want. In fact, Hermode tuning
> > does. -Carl
>
> Can Hermode tuning automatically work with any tempered scale
> you choose?

Hermode's anchor tuning is 12-ET and it has 5- and 7-limit
destination tunings depending on the implementation.
Obviously the approach could be used for any tempered scale.
However these approaches work at the score/MIDI level.
Your idea has the potential advantage of working at the synth
level. But it takes some time for two oscillators to mode
lock and longer for 3 or more...

-Carl

🔗Daniel Nielsen <nielsed@...>

5/28/2011 12:11:16 AM

Hope I'm not just throwing out needless asides, but a couple things this
reminds me of:
SwarmSynth (oscillator flocking; not a lot of theory to this particular
implementation, I don't think)
http://anarchysoundsoftware.co.uk/anarchysoundsoftware/?page_id=62
The delta rule in neural networks
http://en.wikipedia.org/wiki/Backpropagation

Dan N

🔗bigAndrewM <bigandrewm@...>

5/28/2011 1:50:47 AM

This is a cool concept, but to me, the most serious problem is related to the "coupling strength." How widely do you want the vibrating surfaces to be able to change pitch? This matters a great deal, especially if you want to compose with some of the higher-order JI chords. And even in the simpler chords there are problems. Two problems jump out to me: figuring which version of a JI diminished chord your algorithm will lean toward, and which version of a minor seventh chord your algorithm will lean toward. In those cases, it isn't even clear that one tuning is "better" than another; for example that minor 7th chord can be either 1, 19:16, 3:2, 7:4, or 1, 6:5, 3:2, 9:5. They're both good-sounding tunings, and of course choosing one or the other can make a huge difference on your voice-leading, too. I suppose that for specific issues like this, you could base the vibrators on an ET that, combined with adjusting the coupling strength, can distinguish between the two, but I guarantee that no setup will be able to solve all such ambiguities.

Andrew

--- In tuning@yahoogroups.com, "Keenan Pepper" <keenanpepper@...> wrote:
>
>
>
> --- In tuning@yahoogroups.com, "Carl Lumma" <carl@> wrote:
> > I don't get it. It's straightforward to simply code this
> > behavior if it's what you want. In fact, Hermode tuning
> > does. -Carl
>
> Can Hermode tuning automatically work with any tempered scale you choose? Or is it specific to temperaments similar to 12-equal or meantone?
>
> I think the thing that would make injection locking different from just about any other system is it's totally temperament-agnostic. There's really only one parameter: the coupling strength between oscillators.
>
> Keenan
>

🔗Steve Parker <steve@...>

5/28/2011 5:44:10 AM

But drift occurs without harmony.
Establish the key of C, then sing D A G D A G D A G etc
Sung quickly this is stable, but at say 10 seconds per pitch it can
drift producing:

D A+ G+ D+ A++ G++ D++ A+++ G+++ etc....

I observe this in actual situations with choirs.

Steve P.

On 28 May 2011, at 02:04, Keenan Pepper wrote:

> --- In tuning@yahoogroups.com, Steve Parker <steve@...> wrote:
> >
> >
> > On 28 May 2011, at 00:39, Carl Lumma wrote:
> >
> > > The problem with automatic JI isn't usually figuring out
> > > what the chords are supposed to be, it's figuring out the
> > > melodic motion between chords.
> >
> > This may be above my head.. but diving in..
> >
> > The biggest problem is dealing with it over an entire piece so drift
> > is accounted for.
> > In my experience of choral singing this tends to be dealt with in
> > sledge hammer fashion by someone
> > adamantly sticking to a pitch or re-entering and resetting.
>
> Exactly right, and my injection locking idea would instantly solve
> this problem, because each oscillator would have a permanently fixed
> natural frequency, and would only differ from that frequency when
> other oscillators are playing. The average frequency shift over time
> of all the oscillators would be forced to center itself around zero,
> because if you try to pull any given oscillator's frequency too far
> away from its natural one it will just fall out of lock.
>
> Also it should be obvious that the injection locking would only
> apply when multiple oscillators are playing in harmony. If one
> oscillator is playing a melody by itself it won't be perturbed by
> any other oscillators, so the frequencies will be exactly the
> natural ones you set it to.
>
> Keenan
>
>
>

🔗Mike Battaglia <battaglia01@...>

5/28/2011 11:08:22 AM

On Fri, May 27, 2011 at 11:18 PM, Keenan Pepper <keenanpepper@...> wrote:
>
> --- In tuning@yahoogroups.com, Mike Battaglia <battaglia01@...> wrote:
> > This is a fantastic idea, how are you going to implement it? Some kind
> > of waveguide-based approach?
> >
> > -Mike
>
> phase += (natural_frequency + coupling * cos(phase) * (other guy's output)) * (delta t)
>
> A bonus is that this is super easy to generalize to a whole synthesizer's worth of oscillators. Just replace (other guy's output) with (whole synthesizer output). It doesn't even matter if you subtract out each oscillator's own contribution to the output, because its error signal with its own output must average to zero.

Very interesting, although this doesn't look like it'll tune each
harmonic separately, but just slowly lock the whole thing to itself. I
was suggesting that perhaps you were going to do it with one of these

https://ccrma.stanford.edu/~jos/swgt/

Commonly referred to as "physical modelling" among the unhip. The
basic idea is that you simulate the propagation of a wave along a
waveguide by modeling the waveguide as a bunch of delay lines, and I
suspect that the combination of that and some sort of nonlinear
junction would handle this situation well, except the word "nonlinear"
could be a code word for almost anything, so I'd have to really
understand the physical basis for the phenomenon to see how exactly a
waveguide setup would work.

I would have imagined right off the bat that some sort of FM would be
involved, as you wrote in your initial implementation, but it it's
really true that harmonics can drift independently of the fundamental,
that alone wouldn't cover it. But all in all it's a fascinating idea,
if you can give me more details of the mechanism behind it I'd be down
to work on something like this for sure.

PS - for cross-platform audio coding, have you heard of JUCE?
http://www.rawmaterialsoftware.com/juce.php

Supports Windows, Mac, Linux, iPhone(!) Android(!!). It's a general
cross-platform framework, but even more importantly it's an audio
plugin framework, and makes it so that a plugin you write
automatically gets AU, RTAS, and VST equivalents. The whole thing
supports C++. Can't beat that.

-Mike

🔗Kalle Aho <kalleaho@...>

5/28/2011 1:09:29 PM

Hi Keenan,

isn't this going produce distortion artifacts in the sound, at
least when the coupling constant is large?

Also, I understand the explanation for two tones but how is this
going to work with larger chords?

Kalle

--- In tuning@yahoogroups.com, "Keenan Pepper" <keenanpepper@...> wrote:
>
>
>
> --- In tuning@yahoogroups.com, Mike Battaglia <battaglia01@> wrote:
> > This is a fantastic idea, how are you going to implement it? Some kind
> > of waveguide-based approach?
> >
> > -Mike
>
> I'm really interested in what you mean by "waveguide-based", because I was thinking of something that doesn't sound at all like that, and is just the simplest thing I could come up with.
>
> Let's say you have two oscillators and you want to give them some coupling to each other so they can become injection locked. Each oscillator internally keeps track of its own phase, and for every sample basically does
>
> phase += frequency * (delta t)
>
> and then its output is some function of that phase. For concreteness let's say they're both sines, so their output is sin(phase).
>
> If I'm the first oscillator, in order to be able to lock phase with the other guy I have to do something different that depends on his phase. I could certainly look at his phase directly, but if I only look at his output (not his internal phase), I can also make injection locking happen, and that case is more easily generalized to hundreds of oscillators.
>
> Again for concreteness, let's say I'm trying to make my phase equal to the other guy's (rather than some definite nonzero phase difference, which would also work).
>
> If my phase is zero, that means my output is crossing zero and it's going up. Therefore, if the other guy's output is positive, that means he already crossed zero and I need to speed up to catch him. If the other guy's output is negative, he hasn't crossed zero yet, so I'm rushing ahead of him and need to slow down.
>
> If my phase is pi/2, however, then my output is at a maximum and it's not currently changing. Therefore I can't tell from the other guy's output whether I'm lagging behind him or rushing ahead of him. In lieu of an error signal, I always use my own natural frequency when my phase is pi/2.
>
> The simplest way to complete this emerging pattern is to perturb my frequency by an amount proportional to
>
> cos(my phase) * (other guy's output)
>
> So the way I update my own phase becomes
>
> phase += (natural_frequency + coupling * cos(phase) * (other guy's output)) * (delta t)
>
> A bonus is that this is super easy to generalize to a whole synthesizer's worth of oscillators. Just replace (other guy's output) with (whole synthesizer output). It doesn't even matter if you subtract out each oscillator's own contribution to the output, because its error signal with its own output must average to zero.
>
> Keenan
>

🔗Keenan Pepper <keenanpepper@...>

5/28/2011 5:09:04 PM

--- In tuning@yahoogroups.com, Daniel Nielsen <nielsed@...> wrote:
>
> Hope I'm not just throwing out needless asides, but a couple things this
> reminds me of:
> SwarmSynth (oscillator flocking; not a lot of theory to this particular
> implementation, I don't think)
> http://anarchysoundsoftware.co.uk/anarchysoundsoftware/?page_id=62

I would definitely try this if I had a Windows machine. Maybe on one of my school's computers sometime.

> The delta rule in neural networks
> http://en.wikipedia.org/wiki/Backpropagation

Not sure how this is related.

Keenan

🔗Keenan Pepper <keenanpepper@...>

5/28/2011 6:02:33 PM

--- In tuning@yahoogroups.com, "bigAndrewM" <bigandrewm@...> wrote:
>
> This is a cool concept, but to me, the most serious problem is related to the "coupling strength." How widely do you want the vibrating surfaces to be able to change pitch? This matters a great deal, especially if you want to compose with some of the higher-order JI chords. And even in the simpler chords there are problems. Two problems jump out to me: figuring which version of a JI diminished chord your algorithm will lean toward, and which version of a minor seventh chord your algorithm will lean toward. In those cases, it isn't even clear that one tuning is "better" than another; for example that minor 7th chord can be either 1, 19:16, 3:2, 7:4, or 1, 6:5, 3:2, 9:5. They're both good-sounding tunings, and of course choosing one or the other can make a huge difference on your voice-leading, too. I suppose that for specific issues like this, you could base the vibrators on an ET that, combined with adjusting the coupling strength, can distinguish between the two, but I guarantee that no setup will be able to solve all such ambiguities.

I guess we'll just have to wait and see which versions of those chords emerge from different coupling parameters. (Of course, a lot of parameter choices might result in those chords remaining unlocked.)

Also, once you have a working system, it should be quite easy to limit the frequency deviations to some maximum value.

I think one of the most significant benefits of injection locking is that you never have to make such choices between chords artificially. You just tell the oscillators how to talk to each other and they decide what to do.

Keenan

🔗Keenan Pepper <keenanpepper@...>

5/28/2011 6:05:12 PM

--- In tuning@yahoogroups.com, Steve Parker <steve@...> wrote:
>
> But drift occurs without harmony.
> Establish the key of C, then sing D A G D A G D A G etc
> Sung quickly this is stable, but at say 10 seconds per pitch it can
> drift producing:
>
> D A+ G+ D+ A++ G++ D++ A+++ G+++ etc....
>
> I observe this in actual situations with choirs.

I'm sure things like that do happen, but I'm equally sure that this is a phenomenon of psychology, or psychoacoustics, or some other thing that only humans suffer from. This won't happen with digital oscillators because I won't program them to do that.

Keenan

🔗Steve Parker <steve@...>

5/29/2011 3:47:43 AM

I'm not at all sure I agree. It's not a psycoacoustic
problem, it's a tuning problem. Once you lock in with a comma shift
somewhere, it becomes a long range problem to avoid drift
rather than a chord to chord problem.
With pro choirs sometimes these decisions need to
be made by looking at the entire piece.

Steve P.

On 29 May 2011, at 02:05, "Keenan Pepper" <keenanpepper@...> wrote:

> --- In tuning@yahoogroups.com, Steve Parker <steve@...> wrote:
> >
> > But drift occurs without harmony.
> > Establish the key of C, then sing D A G D A G D A G etc
> > Sung quickly this is stable, but at say 10 seconds per pitch it can
> > drift producing:
> >
> > D A+ G+ D+ A++ G++ D++ A+++ G+++ etc....
> >
> > I observe this in actual situations with choirs.
>
> I'm sure things like that do happen, but I'm equally sure that this is a phenomenon of psychology, or psychoacoustics, or some other thing that only humans suffer from. This won't happen with digital oscillators because I won't program them to do that.
>
> Keenan
>
>

🔗Keenan Pepper <keenanpepper@...>

5/29/2011 10:14:07 PM

--- In tuning@yahoogroups.com, Steve Parker <steve@...> wrote:
>
> I'm not at all sure I agree. It's not a psycoacoustic
> problem, it's a tuning problem. Once you lock in with a comma shift
> somewhere, it becomes a long range problem to avoid drift
> rather than a chord to chord problem.
> With pro choirs sometimes these decisions need to
> be made by looking at the entire piece.
>
> Steve P.

I don't understand. Could you explain specifically why you would expect this to happen with coupled digital oscillators?

Note that I'm not in any way disputing your conclusions from your experience with pro choirs. I'm disputing their relevance to a purely mathematical process that doesn't involve humans.

Keenan

🔗Aaron Krister Johnson <aaron@...>

5/30/2011 8:53:13 PM

Keenan,

I think what Steve is asking is: how exactly would the oscillators
counteract commatic drift in certain chord progressions? Or is this even a
concern for you?

The simplest example might be the JI progression that forms a diesis of
128/125 (from Cmaj-Emajor-G#major-B#major, where we want
B#major=Cmajor)...it's one thing if you just want devil-may-care in
tune-ness, drifting be damned, we're working with and designing music in
pure JI, so that's part of the bargain...but it's quite another if you
expect certain commas to cancel out, and your melodic motions still need to
form 'closed loops' even as your vertical harmony is smooth and pure.

AKJ

On Mon, May 30, 2011 at 12:14 AM, Keenan Pepper <keenanpepper@...>wrote:

> --- In tuning@yahoogroups.com, Steve Parker <steve@...> wrote:
> >
> > I'm not at all sure I agree. It's not a psycoacoustic
> > problem, it's a tuning problem. Once you lock in with a comma shift
> > somewhere, it becomes a long range problem to avoid drift
> > rather than a chord to chord problem.
> > With pro choirs sometimes these decisions need to
> > be made by looking at the entire piece.
> >
> > Steve P.
>
> I don't understand. Could you explain specifically why you would expect
> this to happen with coupled digital oscillators?
>
> Note that I'm not in any way disputing your conclusions from your
> experience with pro choirs. I'm disputing their relevance to a purely
> mathematical process that doesn't involve humans.
>
> Keenan
>
>
>
>
> ------------------------------------
>
> You can configure your subscription by sending an empty email to one
> of these addresses (from the address at which you receive the list):
> tuning-subscribe@yahoogroups.com - join the tuning group.
> tuning-unsubscribe@yahoogroups.com - leave the group.
> tuning-nomail@yahoogroups.com - turn off mail from the group.
> tuning-digest@yahoogroups.com - set group to send daily digests.
> tuning-normal@yahoogroups.com - set group to send individual emails.
> tuning-help@yahoogroups.com - receive general help information.
> Yahoo! Groups Links
>
>
>
>

--
Aaron Krister Johnson
http://www.akjmusic.com
http://www.untwelve.org

🔗Keenan Pepper <keenanpepper@...>

5/31/2011 12:21:31 AM

Exciting news - I just got amsynth to successfully injection lock real chords!

It was quite surprising when I finally got it to work, because as I was debugging it it kept making all these weird chirps and gargling sounds, as well as harshly beating chords when it tried to adjust the frequencies the wrong way and never got into lock.

But eventually I fixed all my stupid programming errors and got all the parameters in a good range, and then suddenly I was hearing all these pure phase-locked JI chords - and the base tuning was still set to 12-equal!

It's still really rough because I haven't optimized anything, so it doesn't achieve lock as reliably as possible. But it already sounds pretty damn good!

--- In tuning@yahoogroups.com, Aaron Krister Johnson <aaron@...> wrote:
>
> Keenan,
>
> I think what Steve is asking is: how exactly would the oscillators
> counteract commatic drift in certain chord progressions? Or is this even a
> concern for you?
>
> The simplest example might be the JI progression that forms a diesis of
> 128/125 (from Cmaj-Emajor-G#major-B#major, where we want
> B#major=Cmajor)...it's one thing if you just want devil-may-care in
> tune-ness, drifting be damned, we're working with and designing music in
> pure JI, so that's part of the bargain...but it's quite another if you
> expect certain commas to cancel out, and your melodic motions still need to
> form 'closed loops' even as your vertical harmony is smooth and pure.

OK, now that I have a rough working prototype I can actually test out things like this and just see what pops out. Without further ado, here's a recording I put in my files section:

http://f1.grp.yahoofs.com/v1/8JHkTcd0hUMB3wgbMM_Gi8LDcoyfGm1gT5Awb1SlU7kWk_meLyWzNxn2VDx2zXNpN1CjDNPWI3rCArDpWo0gHS9Nw7VSGOWWwA/KeenanPepper/comma-test.mp3

This is a "typical" result with the coupling scheme I have now, which is to say that I was actually pretty lucky in that all the chords got into lock this quickly and smoothly. =P

Some things to notice:

* The last chord really is exactly the same as the first chord. There is no overall drift, as there would unavoidably be with a choir or some other kinds of adaptive JI algorithms.
* Thus, there are slight shifts within voices that are supposed to be holding "the same note".
* However, these shifts are not really that jarring, because the frequency of each oscillator changes continuously in a natural way as it interacts with the others. In fact, it's possible to make the transition smoother or more sudden by changing a parameter (basically the integration time of the frequency feedback signal).
* Also, the overall 128/125 comma is distributed quite fairly between the three shifts. I made a longer version of this progression and plotted the spectra in Audacity, and the roots of the chords appear to be 266 Hz, 336 Hz, and 423 Hz. The ratios between these are indistinguishable from 2^(1/3) given the somewhat low spectral resolution provided. (The overall deviation from A-440 is an artifact of my bad implementation of the algorithm - each oscillator isn't supposed to interact with itself, but in fact it does because the cancellation is imperfect, so the overall pitch of all the oscillators is shifted by about the same amount even when only one is playing at a time.)

Keenan

🔗Mike Battaglia <battaglia01@...>

5/31/2011 12:30:22 AM

On Tue, May 31, 2011 at 3:21 AM, Keenan Pepper <keenanpepper@...> wrote:
>
> OK, now that I have a rough working prototype I can actually test out things like this and just see what pops out. Without further ado, here's a recording I put in my files section:
>
> http://f1.grp.yahoofs.com/v1/8JHkTcd0hUMB3wgbMM_Gi8LDcoyfGm1gT5Awb1SlU7kWk_meLyWzNxn2VDx2zXNpN1CjDNPWI3rCArDpWo0gHS9Nw7VSGOWWwA/KeenanPepper/comma-test.mp3
>
> This is a "typical" result with the coupling scheme I have now, which is to say that I was actually pretty lucky in that all the chords got into lock this quickly and smoothly. =P

Wow! Not bad at all! A few questions -

1) Does your existing algorithm end up detuning individual harmonics
in a single waveform, or simply alter the pitch of the entire
aggregate waveform to perform the locking? It's the latter, right?
2) Have you tried tetrads in 12-equal to see if it injection locks
them to 4:5:6:7?
3) Any chance we might get to hear this with 15- or 16-equal? Say a
blackwood circle-of-fifths progression in the first case, or some
mavila comma pump in the latter case (Cmaj -> Em -> Bm -> Fmaj ->
Cmaj, where B -> F is 3/2)

Still trying to really wrap my head around this man, damn! Good work!

-Mike

🔗Carl Lumma <carl@...>

5/31/2011 1:18:51 AM

Aaron Krister Johnson <aaron@...> wrote:

> I think what Steve is asking is: how exactly would the
> oscillators counteract commatic drift in certain chord
> progressions? Or is this even a concern for you?

No drift can occur in Keenan's scheme because notes always
begin sounding as scored. Instead, the proposal will
generate comma shifts. But these shifts will be smaller
than in strict JI when the scored pitches are tempered.
It is effectively the same as Hermode tuning when the
score is in 12-ET. The potential advantage is that specific
JI chords don't have to be programmed into the system in
advance.

-Carl

🔗Carl Lumma <carl@...>

5/31/2011 1:25:27 AM

"Keenan Pepper" <keenanpepper@...> wrote:

> OK, now that I have a rough working prototype I can actually
> test out things like this and just see what pops out. Without
> further ado, here's a recording I put in my files section:

Wow, impressive. I'm shocked they lock so quickly. Can you
confirm the attacks are 12-ET and that this is realtime
performance (i.e. no lookahead)?

By the way, Manuel once posted some research which concluded
that melodic pitch sensation depends more strongly on the
attack of a note, whereas harmonic purity sensation depends
more strongly on the sustain. I'd previously suggested this
effect be exploited in adaptive tuning but so far yours is the
first I know to actually do it (assuming the answers to the
above are "yes and yes").

Can you get an otonal tetrad to lock?

-Carl

🔗Steve Parker <steve@...>

5/31/2011 2:11:42 AM

Sorry.. I start messaging then don't have the time to keep up..

This is more or less what I'm asking.
Carl Lumma has clarified in that the locking is the choral sledgehammer approach of always beginning with the initial pitches.
Also I was missing completely that the idea was not to lock to standard JI comma shifts but maybe to some halfway house.
I hope I understand now..
My musical aims may just be different, but this seems undesirable because you gain just tuning by sacrificing just voice-leading?

Steve P.

On 31 May 2011, at 04:53, Aaron Krister Johnson wrote:

> Keenan,
>
>
> I think what Steve is asking is: how exactly would the oscillators > counteract commatic drift in certain chord progressions? Or is this > even a concern for you?
>
> The simplest example might be the JI progression that forms a diesis > of 128/125 (from Cmaj-Emajor-G#major-B#major, where we want > B#major=Cmajor)...it's one thing if you just want devil-may-care in > tune-ness, drifting be damned, we're working with and designing > music in pure JI, so that's part of the bargain...but it's quite > another if you expect certain commas to cancel out, and your melodic > motions still need to form 'closed loops' even as your vertical > harmony is smooth and pure.

🔗Daniel Nielsen <nielsed@...>

5/31/2011 9:42:58 AM

Hi, is the file still available? I'm not able to link to it.
Dan N

On Tue, May 31, 2011 at 4:11 AM, Steve Parker <steve@...> wrote:

>
>
> Sorry.. I start messaging then don't have the time to keep up..
>
> This is more or less what I'm asking.
> Carl Lumma has clarified in that the locking is the choral sledgehammer
> approach of always beginning with the initial pitches.
> Also I was missing completely that the idea was not to lock to standard JI
> comma shifts but maybe to some halfway house.
> I hope I understand now..
> My musical aims may just be different, but this seems undesirable because
> you gain just tuning by sacrificing just voice-leading?
>
> Steve P.
>
> On 31 May 2011, at 04:53, Aaron Krister Johnson wrote:
>
> Keenan,
>
> I think what Steve is asking is: how exactly would the oscillators
> counteract commatic drift in certain chord progressions? Or is this even a
> concern for you?
>
> The simplest example might be the JI progression that forms a diesis of
> 128/125 (from Cmaj-Emajor-G#major-B#major, where we want
> B#major=Cmajor)...it's one thing if you just want devil-may-care in
> tune-ness, drifting be damned, we're working with and designing music in
> pure JI, so that's part of the bargain...but it's quite another if you
> expect certain commas to cancel out, and your melodic motions still need to
> form 'closed loops' even as your vertical harmony is smooth and pure.
>
>
>
>

🔗Aaron Krister Johnson <aaron@...>

5/31/2011 1:28:15 PM

+1...I had the same problem, Keenan. I'd love to hear it, and how can
download and install the changed source for amSynth? Is the author accepting
your patch?

AKJ

On Tue, May 31, 2011 at 11:42 AM, Daniel Nielsen <nielsed@...> wrote:

>
>
> Hi, is the file still available? I'm not able to link to it.
> Dan N
>
>
> On Tue, May 31, 2011 at 4:11 AM, Steve Parker <steve@...> wrote:
>
>>
>>
>> Sorry.. I start messaging then don't have the time to keep up..
>>
>> This is more or less what I'm asking.
>> Carl Lumma has clarified in that the locking is the choral sledgehammer
>> approach of always beginning with the initial pitches.
>> Also I was missing completely that the idea was not to lock to standard JI
>> comma shifts but maybe to some halfway house.
>> I hope I understand now..
>> My musical aims may just be different, but this seems undesirable because
>> you gain just tuning by sacrificing just voice-leading?
>>
>> Steve P.
>>
>> On 31 May 2011, at 04:53, Aaron Krister Johnson wrote:
>>
>> Keenan,
>>
>> I think what Steve is asking is: how exactly would the oscillators
>> counteract commatic drift in certain chord progressions? Or is this even a
>> concern for you?
>>
>> The simplest example might be the JI progression that forms a diesis of
>> 128/125 (from Cmaj-Emajor-G#major-B#major, where we want
>> B#major=Cmajor)...it's one thing if you just want devil-may-care in
>> tune-ness, drifting be damned, we're working with and designing music in
>> pure JI, so that's part of the bargain...but it's quite another if you
>> expect certain commas to cancel out, and your melodic motions still need to
>> form 'closed loops' even as your vertical harmony is smooth and pure.
>>
>>
>>
>
>
>
>

--
Aaron Krister Johnson
http://www.akjmusic.com
http://www.untwelve.org

🔗Keenan Pepper <keenanpepper@...>

5/31/2011 3:11:57 PM

--- In tuning@yahoogroups.com, "Carl Lumma" <carl@...> wrote:
>
> "Keenan Pepper" <keenanpepper@> wrote:
>
> > OK, now that I have a rough working prototype I can actually
> > test out things like this and just see what pops out. Without
> > further ado, here's a recording I put in my files section:
>
> Wow, impressive. I'm shocked they lock so quickly. Can you
> confirm the attacks are 12-ET and that this is realtime
> performance (i.e. no lookahead)?

It's definitely realtime performance (I played the notes in realtime with vkeybd).

I had to think a little about the "attacks in 12-ET" question. The attacks should have been 12-equal, but they might not have been *exactly* that because there was a bug in my code where I forgot to reset the IIR filters when the note was played again after being inactive (now fixed). But in practice that effect should be tiny because the IIR filter "memory" values quickly go to zero when the note decays.

So yes, basically the oscillators always start out with their natural frequency for each attack (in this case 12-equal).

> By the way, Manuel once posted some research which concluded
> that melodic pitch sensation depends more strongly on the
> attack of a note, whereas harmonic purity sensation depends
> more strongly on the sustain. I'd previously suggested this
> effect be exploited in adaptive tuning but so far yours is the
> first I know to actually do it (assuming the answers to the
> above are "yes and yes").
>
> Can you get an otonal tetrad to lock?

In 12-equal, no can do. In a better temperament, piece of cake. See my reply to Mike.

Keenan

🔗Keenan Pepper <keenanpepper@...>

5/31/2011 3:12:19 PM

--- In tuning@yahoogroups.com, Mike Battaglia <battaglia01@...> wrote:
> Wow! Not bad at all! A few questions -
>
> 1) Does your existing algorithm end up detuning individual harmonics
> in a single waveform, or simply alter the pitch of the entire
> aggregate waveform to perform the locking? It's the latter, right?

Right, it's the latter. I'm not really sure what purpose the former would serve, because the harmonics of any periodic signal are already perfectly phase-locked to each other.

The only way amsynth can make a timbre with inharmonic overtones is if you manually detune the second oscillator from the first one in the same voice by a non-JI interval (amsynth has two oscillators per voice). In that case it would be easy to simply let each oscillator have its own independent frequency feedback signal and lock to each other, but the overall effect would be difficult to distinguish from what you'd get just by setting the detuning to a JI interval in the first place!

Maybe if you described something specific you'd like to achieve with this "independent control over harmonics" idea, I'd better understand what you have in mind.

> 2) Have you tried tetrads in 12-equal to see if it injection locks
> them to 4:5:6:7?

This definitely doesn't work. I tried many different combinations of parameters (currently I have just two - coupling strength and integration time), but 0,400,700,1000 cents simply does not want to lock to 4:5:6:7.

It seems that one of three things always happens:

The first possibility is that we don't even have enough coupling for a 4:5:6 chord to lock, so there's no way 4:5:6:7 is going to lock.

The second possibility is that 4:5:6 locks fine, but when you try to add 7 it just screeches away all by itself, never locking with the other three notes. (I actually think it managed to lock to some much more complicated chord a few times, but it's hard to tell.)

The third possibility, which happens when you turn up the coupling too much, is that the obvious JI intervals you'd expect things to lock to become unstable with respect to even simpler intervals. For example you'd play a 12-equal major third but it would lock to 4/3, not 5/4. In this case if you try to play a 4:5:6:7 tetrad it'll try to lock to 4:5:6:8 instead (but usually end up just screeching and gurgling and sounding very unhappy).

On the other hand, if you set the base tuning to 1/4-comma meantone and play an augmented 6th chord, 4:5:6:7 just pops right out, no trouble at all.

> 3) Any chance we might get to hear this with 15- or 16-equal? Say a
> blackwood circle-of-fifths progression in the first case, or some
> mavila comma pump in the latter case (Cmaj -> Em -> Bm -> Fmaj ->
> Cmaj, where B -> F is 3/2)

http://f1.grp.yahoofs.com/v1/4GTlTettRlHYikrwZ-HC4fZOnVjDeYINiLV1mA34YYyv05zqnArXPADuHxamhXGALr1mbv_C2H3PAycwmV_YFws9X82IjKd86A/KeenanPepper/blackwood.mp3

http://f1.grp.yahoofs.com/v1/4GTlTU33_2LYikrw_qd0kBJVO8peZeiIdQQ37U6Pht2xrZtWfC7ltNxk-URPAbHLlt_SyenhsID_h1GaL4YeERwyk-iz84QSog/KeenanPepper/mavila.mp3

This proved pretty difficult to do, for the same reasons as above. But nevertheless I was able to get most (all?) of the chords in those progressions to lock, with much tweaking of parameters. The ability to lock depends strongly on the voicing of the chords, and occasionally also on the *order* in which notes are added to the chord. There's definitely hysteresis and such.

If I use a more accurate base tuning, e.g. meantone, everything seems to work much better...

> Still trying to really wrap my head around this man, damn! Good work!

Thanks!

Keenan

🔗Keenan Pepper <keenanpepper@...>

5/31/2011 3:28:50 PM

--- In tuning@yahoogroups.com, Aaron Krister Johnson <aaron@...> wrote:
>
> +1...I had the same problem, Keenan. I'd love to hear it, and how can
> download and install the changed source for amSynth? Is the author accepting
> your patch?

The file is still working for me. I just uploaded it to the Yahoo group files section in the usual way.

But in case that's not working for some people, I also uploaded the examples to Wikimedia Commons (in Ogg Vorbis format):

http://commons.wikimedia.org/wiki/File:Comma-test.ogg
http://commons.wikimedia.org/wiki/File:Blackwood.ogg
http://commons.wikimedia.org/wiki/File:Mavila.ogg

As for amsynth, the maintainer Nick Dowell said he's accepting my alternate tuning patches as-is, so in the next release of amsynth you'll be able to load any Scala scale file or keyboard map. In the meantime, if you're familiar with these things, you can get the patch at

http://f1.grp.yahoofs.com/v1/4GTlTefIMcXYikrwNY_ljBeBAKnJeiIk22z7ZmdavkJnLf8oMwwep1QBA8KZ5F7xs5QqUVmf0WPgHtlb8VR9duwFAY88eSzR6g/KeenanPepper/alternate-tuning.patch

and check out the Subversion source, patch it, and compile it.

However, the injection locking stuff is still really hacked together and nowhere near even beta quality, so it might be a while before you can try that out.

Keenan