SBaGen -- Sequenced BinAural Generator
This is a utility, released under the GNU GPL (see the file COPYING), that generates pink noise and binaural tones through your soundcard in real-time according to a 24-hour programmed sequence read from a file. It can also be used to play a sequence immediately, rather than according to the clock, or even a combination of the two.
The original idea was to program a set of tones to play overnight as I slept, hoping to improve dreaming, and dream-recall. This way, I can also program a sequence to bring me up into alpha rhythms to hopefully have a good start to the day. I'm still experimenting with all of this, by the way.
Some of the more interesting uses (for me) of binaural tones I've read about include: improving dream-recall, entering lucid dreaming, facilitating meditation, accessing intuition, exploring consciousness.
USE AND EXPERIMENT AT YOUR OWN RISK !
If you make any changes or improvements to the code, let me know so that I can keep a master copy of all the best bits. Also, if you come up with any interesting tone-sets or sequences that you would like to share, along with their story, let me know or post them on the mailing list (see http://sbagen.sf.net/). I'm considering collecting people's experiences together onto the site, if there is enough interest.
Jim Peters, Jan-1999
(updated Sep-2001 and Apr-2002)
Theory
------
The basic idea of binaural beats is that by applying slightly different frequency sine waves to each ear, a beating affect is created in the mind itself, due to the internal wiring of the brain. If, in the presence of these tones, you relax and let your mind go, your mind will naturally synchronize with the beat frequency. In this way it is possible to accurately get into various brain-states, once you know what the frequencies are.
It is also possible to play several different tones together, giving
several different beat frequencies, and programming quite a complex
brain-state based on several frequencies (in several different bands).
These complex mixtures of frequencies are the basis of the Hemi-Sync
(TM) process from the Monroe Institute
For the complete theory of binaural beats and how they affect the
mind, it's best to see the Monroe Institute site, particularly the
pages at
I am just starting to experiment with this stuff, and I wrote this utility to help me set up sounds and sequences to experiment on myself. If you want to experiment with this, feel free to use my utility, but don't blame me if you program it wrong and lose your job because you were chilling comfortably in Theta until 11:00am and then missed a vital meeting at work, or something like that.
You know what I'm saying -- USE AT YOUR OWN RISK ! If a little bit of fun/risk puts you off, I believe that The Monroe Institute sells pre- packaged tapes (although I've never tried them).
Some more theory. The oscillations in the brain are split into four 'bands' according to frequency:
Delta (0.5 to 4 Hz). This is normally generated in deep sleep, or when unconsious. Those experienced in deep trance states can generate these waves whilst remaining conscious.
Theta (4 to 8 Hz). This is the region between sleep and wakefulness, in which *dreaming* and other dream-like (or 'hypnagogic') experiences occur. It's that bit just before you actually fall asleep at night, or just before you are really awake in the morning. They say it's in this band that the unconscious talks to the conscious mind. It also seems to be connected with psychic or ESP-type functioning.
Alpha (8 to 13 Hz). This is produced when you are awake and fully conscious, but with your awareness focussed inside, such as when trying to remember something, or when your eyes are closed.
Beta (13 to 30 Hz). This is normally generated when you are awake, with the attention focussed outside, dealing with the outside world. It is also generated when you are solving logical problems, such as mental arithmetic.
It is interesting to note that in normal dreams, a combination of Theta, Alpha and Beta waves are produced, just as if the person was awake.
Anyway, it looks like Theta is the place to be, connected with all kinds of ESP functioning, such as direct 'knowing', and other such stuff. I'm sure I've been there many times, but I'm looking to explore this area much further now using this utility.
References:
My source for a lot of the information on brain waves is the book: "How to build a lie detector, brain wave monitor and other secret parapsychological electronics projects" by Mike and Ruth Wolverton, TAB books, 1981.
I became interested in The Monroe Institute and their activities through the writings of Ken Eagle Feather, and from attending several courses of his. He talks briefly about Hemi-Sync (TM) in "Tracking Freedom", mentioning some of the 'Focus Levels' (tone-sets) discovered by the Monroe Institute, which include ones related to out-of-body experiences and even 'other worlds'. I believe he also talks about some of his experiences on Monroe Institute workshops in his first book "Travelling with Power", although I've not read it (yet).
Sequence-file format
--------------------
This section describes the format of the sequence files (the prog-*
files, for example). You'll need this if you want to modify these
files, or create your own sequences. For Windows users, you can edit
these files using EDIT or NotePad (or any simple text editor). Mac
users will have to use an editor that respects UNIX line-endings
(e.g. 'emacs').
Within the sequence file, blank lines, and any leading/trailing white
space are ignored. Comments are introduced with a '#', and extend to
the end of the line.
There are several types of entries that may appear in the file:
* Tone-set definition lines
* Time-sequence lines
* Block definition lines
These are described below. The example sequence-files (prog-*) are
useful to see how all these work together.
* The tone-set definition line. This takes the form of:
Examples:
theta6: pink/40 150+6/30
test10: pink/40 100+1.5/30 200-4/27 400+8/1.5
all-off: -
The name starts with a letter, and may continue with letters,
numbers, '_' or '-'. Following the colon is a list of one or more
tone-specifications. There are a maximum of 8 of these. There are
five types:
- # Channel not in use
pink/
bell+
spin:
wave
# defined waveform (see later)
The amplitudes are expressed on a scale 0-100. The total of all the
amplitudes
will be distortion on output as the waveforms are clipped.
The pink noise is probably not 100% pure pink noise -- but it is
fairly pink, with everything from rumbling to hissing, and it
doesn't have too many noticeable distractions such as repeating
cycles or distant melodies or whatever. If you listen really hard,
though, you may be able to hear the fairies playing by the
waterfall.
The binaural tones are based on a carrier frequency (in Hz), which
should be in the range 100 to 1000. Frequencies above 1000-1500 or
so are of no use because the brain does not react to higher pitches
in the same way (see the Monroe Institute pages). The actual beat
frequency
range 0.5 to 30 Hz. This corresponds to the ranges for Delta up to
Beta as described above.
The two tones generated are different by
either side of
decides which channel carries the higher frequency. I don't think
this matters, but in case it does, you can change it here. So, for
example, 100+4/20 generates tones of 102 and 98 Hz, whereas 100-4/20
generates tones of 98 and 102 Hz.
The bell sound can be used to give cues and signals during the
sequence. A simple 'ping' is generated at the given frequency at
the start of the period in which the tone-set is used.
The spinning pink noise generates a binaural effect in a completely
different way, by shifting the phase of pink noise in opposite
directions for each ear, at a given beat frequency. In this case,
the first number is the width of the maximum phase shift from centre
in microseconds. Values from 100 to 500 seem good to me, although
you might want to experiment with this. The second number is the
beat frequency and the third is the amplitude, as above.
Binaural tones generated using wave
normal binaural tones. See the section later on for details.
Once a tone-set has been defined, it may be used in time-sequence
lines.
* Time-sequence lines. These take the form of:
Examples:
16:00 theta6
NOW theta6
+00:03:30 == theta4 ->
NOW+04:00 <> theta4
12:00 theta-bursts
In it's simplest form, this specifies a clock time, and which
tone-set should be played at that time. This tone-set continues
until the next clock-time that is specified.
Time-sequence lines should always appear in order -- you will get an
error if things appear out of order.
More complex examples give time relative to the program start time
(NOW, or NOW+04:00), or relative to the last absolute time mentioned
(+00:03:30). They also use different varieties of fade-in or
fade-out (== or <>), and use '->' to slide to the next time-
sequence. You can also name blocks instead of tone-sets. These
more complex options are described below.
Take a simple example such as this one:
11:00 theta6
12:00 alpha8
13:00 alpha10
14:00 off
This indicates three tone-sets that will play for an hour each
between 11am and 2pm. The tone-sets do not change suddenly on the
hour. Rather, SBAGEN starts to fade out one tone-set 30 secs before
the hour, fading in the next for the first 30 secs of the next hour.
By default, SBAGEN will attempt to keep common things playing from
one tone-set to the next. So if, for example, all of them use pink
noise on the first channel, then this will keep on playing the whole
time, whilst the tones that change will fade out and in.
To change the fading in/out behaviour, include a
specification before the name. This consists of two characters, one
for fading in this tone-set, the second for fading it out. The
fade-in character may be:
< Always fade in from silence.
- Fade from previous to this, fading out all tones not
continuing, fading in all new tones, and adjusting the
amplitude of any tones continuing.
= Slide from previous to this, fading out all tones ending,
fading in all new tones, and sliding the frequency and
adjusting the amplitude of all other tones.
As an example, using '=' you can smoothly slide from a 4 Hz
frequency all the way up to a 12 Hz frequency, rather than fading
one out, and fading a new one in. The fade-out characters are
similar, and may be:
> Fade out to silence
- Fade to next, as above
= Slide to next, as above
What fades/slides actually occur between two tone-sets depends on
what both of them are asking for. If one wants to fade out to
silence, then the other one can't slide to it. They both have to
want to slide for this to occur.
The default
keep playing anything that is the same frequency (adjusting the
amplitude if necessary), but fade everything else in or out.
By default fading and sliding only occur during the 60 second period
within 30 seconds either side of the change-over time. However,
using '->', the entire period from the start time to the time on the
next time-sequence line becomes a transition period. This way you
can have a gentle frequency slide that goes on for an hour, if you
like:
15:00 == theta4 ->
16:00 == alpha10
Assuming these tone-sets do what their names suggest, this will
produce a gentle change in binaural beat frequency from 4 Hz up to
10 Hz over the hour from 3pm to 4pm.
The time-specification in its simplest form may be in the form
'hh:mm' or 'hh:mm:ss'. This counts as an absolute time.
Another form of time-specification is 'NOW' which indicates the time
at which SBaGen was started. This is useful for sequence-files that
are intended to play from the time that they are run, rather than
always at the same time of day. 'NOW' is another absolute time.
The other form of time-spec is a relative time, either '+hh:mm' or
'+hh:mm:ss'. This, if used alone, is taken relative to the
last-mentioned absolute time, for example the three relative times
below are all relative to 'NOW', the last-mentioned absolute time:
NOW+00:10 theta4
+00:20 off
+00:30 theta4
+00:40 off
Any number of relative times may also be used with an absolute time,
to modify it, for example 'NOW+04:00+01:12:04' or '12:00+00:00:20'.
* The block definition line. This introduces a set of lines, and
takes the form:
::
}
For example:
theta-burst: {
+00:00 theta4
+00:10 off
}
A block definition associates a name with a group of time-sequence
lines. All the time-specs on these lines should be relative,
because when the block is called on, all the times will be combined
with the time-spec from the calling line.
For example, using the above definition:
NOW theta-burst
expands to:
NOW+00:00 theta4
NOW+00:10 off
Or for another example:
+01:00 theta-burst
expands to:
+01:00+00:00 theta4
+01:00+00:10 off
This should be enough information to allow you to design and write
your own sequences now. Playing around with the example sequences
(the prog-* files) will also probably help.
Happy experimenting !!
--------------------------------------------------------------------------------
(VERY) EXPERIMENTAL FEATURE: User-defined waveforms
---------------------------------------------------
This is a more complex form of binaural synthesis (maybe too complex!),
and right at this moment, I'm not sure whether it really works or not
either, so this section is only for die-hard (b)leading-edge hackers
and experimenters. The code is in place to do this synthesis, but it
might still have bugs or other problems. If you're still interested,
read on ...
The purest form of binaural beat synthesis is based on two sine waves
of slightly differing frequency. The interference between these two
within the brain generates a resultant wave with a slow modulation.
Assuming the interference within the brain is similar to normal wave
interference, then the resultant amplitude wave is shaped by what
looks like a full-wave rectified sine wave (like the +ve half of a
sine wave repeated endlessly).
There is a line of thinking that suggests that if we replace this
amplitude envelope with one based on the shape of a measured
brain-wave, then we should be able to reproduce that brain-wave in the
brain -- i.e. we play a measured alpha wave to entrain the brain
precisely to an alpha wave. Does this work ? I really don't know.
This is how it is used in the sequence-file. You provide the shape of
the brain-wave to the program in a waveform definition line:
wave<2-digits>:
There can be at most 100 waveforms defined in a sequence, numbered 00
to 99. For example:
wave00: 0 5.5 10 8 10 7.2 4.7 2
The samples are values from the waveform shape taken at regular
intervals over one cycle. They can be in any units you wish --
floating point numbers, negative, whatever -- and there may be as many
samples as you wish (currently only limited by line length). They
will be rescaled to fit between the amplitudes of 0% and 100% and
smoothed using a sin(x)/x function. See here for more details on the
smoothing used:
http://www-ccrma.stanford.edu/~jos/resample/
This waveform now becomes the amplitude envelope of any binaural tones
generated from it:
wave00:200+4/50
This is just the same as 200+4/50, except it uses the new waveform for
the amplitude envelope.
That's all you need to know to be able to use it. All you have to do
now (according to the theory, at least) is to go and measure some
waveforms -- off the 'net if like most of us you don't have an EEG --
feed them into waveNN: lines, and then play them at appropriate
beat-frequencies.
Well, that's the theory, but not everything seems to be working
according to plan from my experiments. Here is the basis on which the
code works to generate the tones:
If you take the 0-100% scaled and smoothed amplitude waveform, and
draw it twice, and invert the second version, you have a wave that can
be played at audio frequencies. If you play this in the left ear at
102Hz (for example), and in the right ear you play the same thing at
98Hz BUT WITH THE SAMPLE REVERSED, then in theory you should get the
correct amplitude envelope. Here is the mathematical basis for this
(from the mailing list):
> Let's say we have a brain-wave waveform of f(T) (T is theta),
> expressed as a fourier series (using complex maths because it's
> easier):
>
> f(T) = sigma(n= -inf to +inf) ( Cn . e^(inT) )
>
> What we want to end up with is a resultant function something like
> this:
>
> g(t) = sigma(n= -inf to +inf) ( Cn . e^(inbt) . 2 cos nat )
>
> where 'a' is the resultant carrier frequency (in rad/s here), and 'b'
> is the beat frequency. This means that the phase information is
> connected with the beat waveform, and the phase of the carriers are
> fixed. The factor 2 comes in handy lower down:
>
> g(t) = sigma(n= -inf to +inf) ( Cn . e^(inbt) . (e^(inat) + e^(-inat)) )
>
> g(t) = sigma(n= -inf to +inf) ( Cn . e^(in(b+a)t) + Cn . e^(in(b-a)t) )
>
> g(t) = f((b+a)t) + f((b-a)t)
>
> So we just need to play the original waveform at frequencies (b+a) and
> (b-a). But 'b' will typically be small (1-30Hz), and 'a' will be
> large (100-1500Hz). So (b-a) is negative, which means playing the
> sample backwards.
>
> So if we play the required brainwave forwards at the higher
> frequency, and backwards at the lower frequency, it should all come
> out with what we want.
However, with my experiments I don't get the expected resultant
amplitude envelope. I get bits of it, but not a perfect result.
What's going on, I don't know. Anyway, if you're up for experimenting
with this, at least the code is there now for you to play with and
modify. If you make any progress, let me have the improved code, and
I'll include it in the next release.
Cheers --
Jim
--------------------------------------------------------------------------------
Taken from SBaGen documentation