Central Pattern Generators to Synthesize Birdsongs

Songbirds are among the most interesting creatures of nature. Out of 10,000 bird species, around 4,000 are songbirds. They sing for many reasons including territorial ownership and mating. The young birds learn their songs by listening to a tutor. This makes it an attractive research area for those who are interested in understanding how humans learn to speak.

The study of dynamical systems has proven to be an invaluable tool for understanding how songbirds sing. A very simple nonlinear oscillator model that is similar to a spring-mass system can shed a light onto the physics of the avian vocal organ, the syrinx. The neuronal control mechanisms that generate the songs can be modeled as a central pattern generator, which is a special kind of connectionist model. Furthermore, dynamic variation of the system parameters via temporal hierarchy gives rise to highly precise modeling of birdsongs.

This article briefly explains one such dynamical systems model from the literature [4] and provides a Matlab implementation that generates a synthetic version of the white-crowned sparrow song.

Structure of a Birdsong

A birdsong is a hierarchical structure consisting of syllables and motifs such as the following Chingolo song:

Here is how this waveform plot is generated in Matlab:

[y,fs] = wavread('e:\\recordedbird.wav');

And here is how the Chingolo’s song sounds like:

Example Birdsong

What is in a Syllable?
A syllable can contain multiple dynamic tones with up sweeps and down sweeps. The frequency range in a typical birdsong is generally between 2–7Khz [1]. The richness in dynamics makes this an interesting topic for dynamic systems modeling. The following sonogram/spectogram shows how the frequency changes within syllables:

Songbird Anatomy
So, how do birds generate songs? The following figure shows the vocal organs of a songbird.

Located between the lungs and the vocal tract, the syrinx is the sound-producing organ (source) of a songbird. Similar to the larynx in humans, the syrinx contains vibrating membranes that are called labia which oscillate when the air from lungs exerts force on them. The sound waves generated by the syrinx then travel through the vocal tract which serves as the filtering mechanism for producing the vocalizations [2].

What controls the singing is the songbird’s brain. Two distinct forebrain regions were identified as being highly active during birdsong generation. The HVC (high vocal center) projects to the region RA (robust nucleus of the archistriatum) which in turn projects to the brainstem regions that control the syrinx and the respiratory systems.

Based on the observations of the songbird brain activity during singing, it has been proposed that there is a temporal hierarchical organization that controls the bird-song generation. Namely, the HVC neurons were observed to be on a slower timescale than the RA neurons [3].

The final piece of the puzzle is the control of the muscles that actually govern the syrinx. It was proposed that there were 7 muscles controlling the vocal organs, however this meant a 7-dimensional problem for mathematical modeling of song generation. Through experiments, it was deduced that song generation in songbirds could be mathematically modeled with respect to two variables: the stiffness of the labia (the portion of the syrinx that oscillates) and the air pressure generated by the air-flow from the lungs to the vocal tract [2].

(image from [2])

Mathematical Modeling of the Syrinx
Sound is created by periodic airflow fluctuations (oscillations). A baseline model for the syrinx was proposed as a very basic spring-mass nonlinear oscillator model which turns out to be a slight variation of a Van der Pol Oscillator (see references for details).

Here is the simplest mathematical model of the syrinx that is supported by experimental evidence. In this scheme, x represents the mid-point of the labia, k is the labia stiffness and p is the air-flow pressure. Note here that these two variables (k and p) are time-varying.

Mathematical Modeling of the Songbird Brain
Here, I look at the model proposed in [4] that models a population of RA neurons using a central pattern generator.

(image from [4])

Here, xk and xp are the neurons that control the syringial and respiratory muscles respectively. The neuron y is the inter-neuron governing the co-ordination between xp and xk. The output of this network controls the two parameters for birdsong generation: the labia elasticity (k) and the air pressure (p). The rho values represent the excitatory connections from the HVC area. In their paper, the authors define paths in the p-k parameter space based on the excitatory input rho2 which creates a different syllable for each value.

Here is the actual mathematical model, where S is the sigmoid function.

In their paper, the authors show that they were able to closely replicate a recorded birdsong using this central pattern generator. The following is my attempt to replicate their result in Matlab using the same model and parameter values from their paper.

Creating Synthetic Birdsongs
Here is how to create a synthetic version of the white-crowned sparrow song shown in [4] using Matlab.

Model for the syrinx (syrinx.m):

%The bird syrinx model used in
%From Laje and Mindlin(2002), Diversity within a Birdsong, Physical Review
%pt = interlabial air pressure
%k:labia elasticity
function yprime = syrinx(t,y,flag,tra,p,k)
b=1000;  %(dissipation-friction coefficient) parameter taken from the paper
d=power(10,8); %(nonlinear dissipation coefficent for bounded motion) parameter taken from the paper
yprime(1) = y(2) ;
yprime(2) = (pt-b)*y(2) - kt*y(1) - d*(power(y(1),2)*y(2));
yprime = yprime';

Model for the Songbird brain (birdBrain.m, the Central Pattern Generator):

%The CPG (Central Pattern Generator) Neural Network
%Modeling the RA brain region of a songbird
%From Laje and Mindlin(2002), Diversity within a Birdsong, Physical Review
%the parameter rho2 is varied where all other parameters are fixed in
%generating birdsong syllables
function yprime = birdBrain(t,y,flag,rho2)
yprime(1) = 30 * ( — y(1) + ( 1 / ( 1 + exp(-1 * (rho1 + A * y(1) — B *y(2)))) )) ;
yprime(2) = 30 * ( — y(2) + ( 1 / ( 1 + exp (-1 * ( rho2 + C * y(1) — D*y(2) + alpha * y(3))))));
yprime(3) = 120 * ( -y(3) + ( 1 / ( 1 + exp ( -1 * (rho3 + E* y(3) — beta*y(2))))));
yprime = yprime’;

Singing a syllable (singSyllable.m):

function [t,song] = singSyllable(rho2)
Fs = 22050; %sampling
t = 0:1/Fs:0.24;
[t1 y] = ode15s(‘birdBrain’,t,[0.01 0.01 0.01],[],rho2);
kt=1.4*power(10,9)*y(:,3) + 4.8 * power(10,8);
pt=7000*y(:,1) — 2200;
[m z1] = ode15s(‘syrinx’,t,[0.01 0.01],[],t,pt,kt);

Creating a whole song of syllables a-b-c-c (createSong.m)

clear all;
Fs = 22050; %sampling
%syllable a
disp(‘Generating Syllable a (rho2=-11)’);
[m1 s1]=singSyllable(-11.0);
disp(‘Syllable a generated’);
%play the syllable
%syllable b
disp(‘Generating Syllable b (rho2=-11.8)’);
[m2 s2]=singSyllable(-11.8);
disp(‘Syllable c generated’);
%play the syllable
%syllable c
disp(‘Generating Syllable c (rho2=-7.1)’);
[m3 s3] = singSyllable(-7.1);
disp(‘Syllable c generated’);
%play the syllable
%stich the song up
disp(‘Stiching the song up a-b-c-c’);
song = [ s1(:,1) ;s2(:,1) ;s3(:,1); s3(:,1)];

disp(‘Saving wav file’);
disp(‘Playing wav file’);

Here is how this synthetic birdsong sounds:

This material was prepared for a graduate level course in Advanced Ordinary Differential Equations. The technical report can be found here and Matlab source code can be found on Github here.

[1] Gabriel B. Mindlin and Rodrigo Laje. The Physics of Birdsong. Series in Biological and Medical Physics,Biomedical Engineering. Springer, 2005.

[2]Rodrigo Laje, Timothy J. Gardner, and Gabriel B. Mindlin. Neuromuscular control of vocalizations in birdsong: A model. Physical Review E: Statistical,Nonlinear, and Soft Matter Physics,65:051921–8:051921–8, 2002.

[3]Fernando Nottebohm. Birdsong’s clockwork. Nature Neuroscience, 5:925–926, 2002.

[4]Rodrigo Laje and Gabriel B. Mindlin. Diversity within a birdsong. Physical Review Letters, 89:288101–1:288102–4, 2002.