Daqarta
Data AcQuisition And Real-Time Analysis
Scope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
The following is from the Daqarta Help system:

Features:

Oscilloscope

Spectrum Analyzer

8-Channel
Signal Generator

(Absolutely FREE!)

Spectrogram

Pitch Tracker

Pitch-to-MIDI

DaqMusiq Generator
(Free Music... Forever!)

Engine Simulator

LCR Meter

Remote Operation

DC Measurements

True RMS Voltmeter

Sound Level Meter

Frequency Counter
    Period
    Event
    Spectral Event

    Temperature
    Pressure
    MHz Frequencies

Data Logger

Waveform Averager

Histogram

Post-Stimulus Time
Histogram (PSTH)

THD Meter

IMD Meter

Precision Phase Meter

Pulse Meter

Macro System

Multi-Trace Arrays

Trigger Controls

Auto-Calibration

Spectral Peak Track

Spectrum Limit Testing

Direct-to-Disk Recording

Accessibility

Applications:

Frequency response

Distortion measurement

Speech and music

Microphone calibration

Loudspeaker test

Auditory phenomena

Musical instrument tuning

Animal sound

Evoked potentials

Rotating machinery

Automotive

Product test

Contact us about
your application!

Sound Card Monaural and Binaural Beats Mini-App

Introduction:

The Beats_Demo macro mini-app that is included with Daqarta demonstrates monaural and binaural "beats", which are heard when listening to two closely spaced tone frequencies. It also includes a fully-adjustable "isochronous beat" (tone or noise burst) generator, plus an adjustable "surf sound" generator, "moving noise", and "jet sounds". Low frequency thumping, a new auditory phenomenon, can be induced in susceptible subjects for possible future research.

To run Beats_Demo, hit the F8 key followed by the 'B' key, or hit CTRL+F8 to open the Macro Dialog and double-click on Beats_Demo in the Macro List. Use headphones, and adjust the volume to a comfortable level. (The F9 key opens Daqarta's volume slider dialog.)

Beats_Demo provides Custom Controls for Center Frequency and Difference (beat) Frequency. It starts out with Center = 200 Hz and Difference = 1 Hz, which means the two tones are really at 199.5 and 200.5 Hz. You can change the Center and Difference via sliders, direct entry, or scrolling.

Note that there will be a "zipper" artifact as you move the slider control to change either frequency, due to repeated waveform restarts at every slider step. You can toggle the Change: Zipper button to Change: Lag, which will instead give a lag of a second or so before the change takes place.

There is also a multi-state Mode button that defaults to Binaural, and changes on successive clicks to Monaural, AM, and Burst modes, then back to Binaural.

Another button toggles between Both Ears (default) and Left Ear unless the Mode button is set to Binaural.

A Wave button toggles between Sine and Noise.

For Sine waves, a Modulation control is enabled in AM mode, as well as in Binaural and Monaural modes for Noise waves. In Burst mode it changes to Duty Cycle, and a Rise/Fall control is also enabled.

Binaural mode is the default, but the monaural beat phenomenon is probably already familiar to most people. We'll discuss it here first to help explain the difference. Then we'll cover Binaural, AM, and Burst modes.

Note that you can open this Help topic at any time by right-clicking anywhere in the Beats_Demo control dialog.


Monaural Beats:

When two Sine tones are added together (either electrically, or in the air) before they reach one or both ears (using speakers or headphones), the phenomenon is called monaural beats, or just "beats". It is heard as a single tone that slowly pulsates at the beat frequency, which is the difference between the two tone frequencies. The perceived single tone is at the frequency midway between them.

You may have encountered monaural beats in tuning musical instruments. For example, you might tune one string of a guitar to match a piano key, then tune the remaining guitar strings to track the first. You play the same note on both instruments or strings at the same time, while slowly tuning the guitar string to minimize the beat frequency. You hear a flutter when the two notes are several Hz apart, then a slow "wow" as you get close. When you no longer hear a change, the two frequencies match. Go too far, and you hear an increasing beat frequency again.

You might also have experienced monaural beats when two household electric fans are running at the same nominal speed; slight differences cause one to be slower, and beats are heard as a slow pulsation or thrum.

Monaural beats result from the summation of the two waveforms, such that the overall amplitude increases when the peaks of the two are aligned, and decreases when they are opposed. Surprisingly, although the beats are plainly audible and can be seen in a waveform display as an apparent amplitude modulation, there is no actual beat frequency component in the waveform or the sound wave; it is generated by the nonlinear action of the inner ear.

To see this for yourself, make sure Monaural mode is active and set Center to 1000 Hz and Difference to 100 Hz (maximum on each). Now toggle Spectrum mode on. You'll see a single "fat" peak at 1000 Hz since Daqarta can't resolve the separate 950 and 1050 Hz peaks very well, due to normal spectral leakage and the use of a 1024-point FFT to create the spectrum. (If you eXpand the spectrum you can see a little dimple in the top of the peak, and if you use Spectrum Peak Track the cursor will jump back and forth between 950 and 1050 Hz.)

But you won't see any peak at 100 Hz, the difference or beat frequency.

Click the Mode button once more to get true AM for comparison. You can also toggle Mode "backwards" from AM to Monaural by holding the SHIFT key down while clicking, and forward to AM again via an unshifted click. The shifted and unshifted 'M' key does the same thing without the mouse.

In AM mode, a sine wave at the Difference frequency is used to modulate the a sine wave at the Center frequency. You may notice a change in timbre... just a bit rougher and a bit lower in pitch. The fat spectrum peak is just a bit fatter than for Monaural mode. With Spectrum off, the waveform looks superficially similar in both cases: The envelope is somewhat like a chain of beads.

Hit Pause for each case to see the true waveform difference. In Monaural mode, let your eye follow the shape of the overall envelope; in particular, follow the upper profile as it goes down from the positive peak of one "bead" to the zero midline. The shape is that of the positive half of a sine wave, and as your eye follows it through zero the sine wave continues on as the negative profile of the next "bead" on the chain. In other words, the sine wave passes through zero. There is also an inverted sine that follows the negative profile of the first bead and the positive profile of the next. Together, they look like a twisted strand of DNA or a pair of entwined snakes.

Now do the same for AM mode, and notice that the upper profile is a sine wave that goes down to just touch zero, but does not cross through it; the bottom of the sine is at zero, after which it continues upward again. The negative profile does the same in reverse, so the two sine waves just touch each other at zero, instead of crossing. Because zero is approached more slowly than the Monaural case, there appears to be more "string" showing between smaller "beads" on the chain.

Those differences are easy to see (and hear) at these high frequencies. At 100 Hz difference there are no true beats, just roughness. If you go back down to the defaults of 200 Hz Center and 1 Hz Difference, you won't be able to tell Monaural mode from AM, either by eye or by ear.

You can actually use AM mode to exactly reproduce Monaural beats by setting Difference to half of the value used for Monaural (50 instead of 100 Hz) and setting Modulation to 200% instead of the 100% used above. At 200% Daqarta's special amplitude modulator becomes a true multiplier, multiplying the Center sine wave by the Difference sine wave.

When two sine waves are multiplied, the product consists of only the sum and difference frequencies... the two originals are missing entirely. Using 1000 Hz times 50 Hz, we get 1000 + 50 = 1050 Hz, and 1000 - 50 = 950 Hz... exactly the same as Monaural mode with Center at 1000 and Difference at 100.


Binaural Beats:

Binaural mode means that each ear gets a different frequency; the phenomenon is called binaural beats. Instead of actual beats, as in the Monaural case discussed above, the perception is more like a single tone that seems to rotate around your head at the beat frequency.

Headphones are best to assure complete separation between the two tones, but even with speakers the effect persists as long as your head is roughly midway between them, and not too far away overall.

In Binaural mode the waveform display shows the two waves on separate traces. The Left Out (green) trace is stationary because it is selected as the Trigger Source. The Right Out (purple) trace scrolls past it such that a relative shift of one cycle takes one second, which is the default Difference frequency.

You should notice a "motion" effect as though a single tone source revolves around your head at one complete revolution per second. The effect may be subtle; try listening with your eyes closed.

Unlike monaural beats, the effect is created entirely in your brain, not your ears. The brain normally uses timing differences between the waveforms arriving at each ear to determine the location of a sound source in space. If a single ongoing sine wave is equidistant from each ear, both waveforms match. If it is closer to one ear, then the waveform received there will be slightly ahead of that at the other ear.

If that single source was actually rotating around your head, then the relative timing would continually change. When the source was on the left, the left ear waveform would be ahead. As the source moved to the front, the waveforms at each ear would match. As it continued on to the right, the right ear would be ahead.

As shown by the Binaural mode waveform display, that's exactly the effect you get when a different frequency is applied to each ear. If the difference is slight, the brain can't tell that they are different frequencies... it just knows that the waveforms are continually shifting in the same way as a moving single sound source. The brain's erroneous conclusion shouldn't be too surprising, given that the auditory system was only exposed to natural sound sources during its evolutionary history... not signal generators and headphones.

However, this "rotating source" phenomenon is not the focus of current interest in binaural beats. Instead, most applications use somewhat higher difference frequencies, where the rotation effect is harder (or impossible) to detect.

A quick search of the Web will turn up many sites that claim interesting, therapeutic, or downright miraculous effects from listening to binaural beats at various frequencies. Many of these claims are dubious at best, but you can easily use Beats_Demo to explore them for yourself.

The general idea is based on the fact that certain brain wave frequency ranges are associated with particular mental states, and on the hypothesis that if the brain is presented with these same frequencies as external stimuli, it can become "entrained" and thereby induce the corresponding mental states.

Brain wave frequencies are loosely grouped into named ranges, associated with the following mental states (among others):

    Gamma    > 40 Hz    Problem solving, higher functions
    Beta    13-40       Concentration, anxiety, altertness
    Alpha    7-13       Relaxation, pre-sleep
    Theta    4-7        Deep relaxation, meditation, drowsy
    Delta    < 4        Deep sleep

These frequencies are typically too low to be heard by the ear as direct sound. But since binaural beats originate in the brain (not the ears) due to the difference between higher, easily audible frequencies, they can be clearly perceived down to a fraction of a hertz.

To experiment, set the Difference control to a frequency in the range of interest. Then try various Center frequencies and note the effect, if any.


Isochronous Beats:

This is a fancy name used by some purveyors of brain wave entrainment products. What they are really referring to is apparently rather ordinary tone or noise bursts. You can experiment with those via the Burst mode of Beats_Demo.

In Burst mode you will see controls for Duty Cycle and Rise/Fall as well as the usual Center and Difference frequencies. Start with Duty Cycle at 50% and Rise/Fall at 10% (defaults).

A tone at the Center frequency will be turned on and off at the Difference frequency rate. If Difference is low, say 1 Hz, you hear a distinct one-per-second "beep, beep, beep" effect. The 50% Duty Cycle means that the tone is on for 50% of the overall 1-second interval.

But for brain wave entrainment you would set Difference to an appropriate brain wave range. (Center should probably be at least several times higher.) Once the Difference (pulse rate) gets much above 10 Hz, you won't hear discrete beeps... more like fluttering of the main Center tone.

Rise/Fall determines how smoothly the tone starts and stops. 0% means it starts abruptly, while 100% means that all of the Duty Cycle "on" time is spent in the process of turning on and off, with no actual steady "on" portion. Suppose Difference is set to 10 Hz, meaning a 100 msec period. With the default 50% Duty Cycle the tone would nominally be fully on for half that time, or 50 msec. That's exactly what you'd get with Rise/Fall set to 0%, but you'd also hear a tapping sound (spectral splatter) due to the abrupt chopping of the sine wave.

At 10% Rise/Fall the tone spends 5% of the 50 msec (2.5 msec) rising at the start, and an equal amount falling at the end, with 90% of 50 msec (45 msec) of steady tone in between. That greatly reduces the spectral splatter while still preserving most of the energy of the main tone. You will probably find that it is much more pleasant to listen to.

Besides tone bursts, you can also try toggling the Wave button from Sine to Noise. (The Center frequency control is disabled since this is broadband "white" noise that contains equal proportions of all audible frequencies.)


Surf Sound Generator:

This simple surf sound generator can be used for relaxation, or for tinnitus masking or blocking out background noise.

Toggle Mode to AM and Wave to Noise. As a good starting point, set Difference frequency to 0.25 Hz and Modulation to 50%. You will probably find useful results with Modulation between about 25 and 75%.


Shifted Binaural Noise (Moving Noise):

With Wave set to Noise in Binaural and Monaural modes, there are actually two separate noise sources. They are nominally identical, except that one can be dynamically shifted in time relative to the other. The Difference frequency controls the rate at which the shift cycles between advanced and delayed, while the Modulation control sets the peak shift in each direction. 100% Modulation is a shift of +/-50 samples, or about +/-1 msec at 48000 Hz sample rate. The upper limit is 200%, or +/-2 msec.

In Binaural mode with headphones this gives the effect of a noise source rotating around your head, similar to the apparent motion of a binaural sine wave, but much more pronounced. Or instead of rotation it may seem like a freight train going back and forth through your head; in fact, even with speakers this is fairly robust effect.

The explanation for this effect is similar to the pure sine case: When the relative shift is at 0, any given feature of the noise reaches both ears at the same time. When the shift is such that the left ear hears an advanced version of the noise, it is as if the sound is reaching the left ear before the right, so the sound seems to be closer to the left ear. When the left ear hears a delayed version, the sound seems to be closer to the right.

This may seem pretty amazing, implying that each ear is following the fine structure of the noise even though we normally don't notice that structure... the noise just sounds like a continuous hiss. But the brain is apparently able to determine the relative timing to decide which ear is hearing the earlier sound, and by how much.

The ear works by mechanically separating incoming sound into its component frequencies, distributed along the basilar membrane of the cochlea. The vibration at each location is sharply tuned, such that for the purpose of this discussion we can think of it (and the hair cell sensors that ride on it, and the neurons they connect to) as responding to only only one specific frequency. The many frequencies present in the noise source are thus handled as individual sine waves by their respective neurons.

A neuron for a given frequency fires more often when stimulated by sound. At frequencies below about 1500 Hz it can "follow" a sine wave. This is true even though it can't fire on every cycle at these frequencies, but when it does fire it is most likely to do so when the sine wave is at its peak (or some other particular phase of its cycle).

It is this "phase locking" property that allows the brain to determine relative timing between the ears, since it can tell when a spike from the neuron for a particular frequency from one ear comes earlier or later than one from the corresponding neuron of the other. It can do this for the pure sine wave case used in Binaural Beats, and since noise is just the presence of many different frequencies we shouldn't be surprised that the brain can do the same trick with many separate "channels" for an even stronger effect.


Shifted Monaural Noise ("Jet Sounds"):

In Monaural mode with Noise waves, there are two separate noise sources, with one of them undergoing shift modulation, as described above. However, here they are summed together before being converted to a single sound stream.

As the relative delay between the sources changes, frequencies that would have been in phase without the delay (and hence add constructively) will eventually become 180 degrees out of phase and cancel. At any given delay time, frequencies that have an integer number of full cycles in that time will be in phase, while frequencies with an odd number of half-cycles will be 180 degrees out of phase.

The result is that the spectrum of the combined noise contains multiple peaks and dips, called "comb-filtered noise" or "jet sounds". To view this, set Modulation to 100% (default) and Difference to 0.1 Hz. Then toggle Spectrum mode on. (See also Comb Filtering and "Flanger" Effects.)


Middle Ear Thumping:

This phenomenon seems to be uncommon, and may in fact indicate some unknown pathological problem, so don't be discouraged if it doesn't work for you.

In Sine wave Binaural mode, set the Center frequency to 300 Hz, and Difference to 1 Hz. After listening for a while (a minute or so), you may experience a mildly unpleasant "thumping" effect at the beat frequency, probably in one ear only, which sounds somewhat like a heartbeat. This may or may not be in exact synchrony with the binaural beat; it may sometimes skip or double-beat. The effect seems to happen over a certain range of center frequencies; for the author it is about 250-550 Hz.

At difference frequencies lower than 0.5 Hz the thumping effect may become jittery. At frequencies below 0.2 Hz or so it may vanish completely, as does the rotational "beat" effect. At difference frequencies above about 2-3 Hz the thumps can no longer sync to the beat rate and may skip cycles or vanish completely.

The effect can also be produced with binaural shifted noise, but seems to be less pronounced.

The author is unaware of any description of this effect in the scientific literature. The exact cause of the effect, or its significance, is not known. It is apparently not experienced by everyone; its incidence in the general population is unknown. A working hypothesis is that the thumping is caused by spasms (myoclonus) of the tensor tympani (and/or possibly the stapedius) middle ear muscles.

If you experience this effect, the author would welcome a report of your findings via the Contact form on the Daqarta Website (www.daqarta.com/contact.htm). Does the effect happen over the same frequency ranges mentioned above? One ear, or both? Any known neurological or hearing problems in the affected ear?

Even if you don't experience this effect yourself, it might make a great science fair, honors, senior, or even a doctoral project. Since this is apparently unknown territory, there is a lot of room for original work. Some ideas:

1) Consider screening the general population for this effect.

2) What age groups are most affected?

3) Can you correlate it with any known conditions?

4) If so, is a binaural beat test quicker or cheaper to administer than existing tests for such conditions?

5) Can the binaural beat test be streamlined or otherwise improved for screening purposes?

6) How can you test whether the middle ear muscles are involved?


Beats_Demo Macro Listing:

The Beats_Demo macro uses a Custom Controls dialog to implement the various controls. Beats_Demo first sets a known system state, then loads the BeatsDemo.GEN Generator setup that will be acted upon by the controls. The controls are labeled and initialized, and then the dialog is opened while setting the _Beats_Ctrls macro to handle control changes. _Beats_Ctrls returns to this Beats_Demo caller when the dialog is closed via its OK or [x] buttons.

Note that the button labels start with an ampersand (&), as in Btn0="&Mode: Binaural". This sets the following letter ('M' in this case) as a "hot-key" to operate that button from the keyboard.

;<Help=H4907
Close=
Sgram=0
Spect=0
SpectWindOn=1
E.IF.Input=
    Input=0
ENDIF.
TrigMode=Norm
TrigLevel=0
TrigHyst=0
Trig=1
SmplSec=Smpl
A.LoadGEN="BeatsDemo"
TrigSrc=LO
Ctrls="<<Binaural / Monaural Beats"
Ctrl0="<<Center Frequency"
Ctrl0="<S(40,1000)"
Ctrl0=200
Ctrl1="<<Difference Frequency"
Ctrl1="<S(0,100)"
Ctrl1=1
Ctrl2="<<Modulation %"
Ctrl2="<S(0,200)"
Ctrl2="<D"
M=100
Ctrl2=M
D=50
Ctrl3="<<Burst Rise/Fall %"
Ctrl3="<S(0,100)"
Ctrl3="<D"
Btn0="&Mode:  Binaural"
Btn0="<M(3)"
Btn1="Both &Ears"
Btn1="<T"
Btn1="<D"
Btn2="&Change:  Zipper"
Btn2="<T"
Btn3="&Wave:  Sine"
Btn3="<T"
@_Beats_Ctrls=Ctrls


_Beats_Ctrls Macro Listing:

This macro runs in the background to handle changes to controls in the Custom Controls dialog that was launched by the Beats_Demo caller macro. On any change, _Beats_Ctrls is called with the Ctrls variable holding an event code to identify the changed control.

If either Center Frequency Ctrl0 or Difference Frequency Ctrl1 (events 0 or 1) is changed, the first IF block calls the _Beats_Update subroutine macro to set the relevant tone frequencies. It also sets the noise shift modulation frequency to Ctrl1. If Btn2 has previously been set to Change: Lag mode, GenUpdate is turned off during the update, and turned on afterward.

Ctrl2 (event 2) is Modulation unless Burst mode is active, when it becomes Duty Cycle. In that case, the value is just saved to variable D for later restore after a mode change. Otherwise, the new Modulation value is used to set the modulation depth directly for use in AM mode. Noise shift depth is set to half the Ctrl2 value (so that 100% = +/-50 samples of shift) for use by for Binaural or Monaural modes. No test is used to distinguish Binaural, Monaural, and AM since the settings here don't interact: If AM is active, shift modulation has already been turned off, while if Binaural or Monaural are active AM has been turned off. (Depths can be changed even when the overall function is off.)

Ctrl3 (event 3) is Rise/Fall and is handled completely by _Beats_Update if Burst mode is active.

Btn0 (event 4) is the Mode button. When changed, the button label is updated to the new state, and Generator controls are set as needed. In Burst mode, the old Ctrl2 Modulation setting is saved to variable M, the label is changed to Duty Cycle, and the control range is changed to 0-100% instead of 0-200%.

Note that Mode is a multi-state button since it was set by Beats_Demo via Btn0="<M(3)". It automatically increases by one state for each click, wrapping from 3 back to 0 as needed. Alternatively, it decreases by one state if SHIFT is down at the click, wrapping from 0 to 3. But there is no way to get from 3 to 1 without going through 0 or 2, so the state 1 (Monaural) code does not need to insure that Ctrl2 is properly set for Modulation... that was already done when passing through state 0 or 2.

Btn1 (event 5) calls _Beats_Ears to set the Both Ears / Left Ear states, and also calls _Beats_Update.

Btn2 (event 6) simply sets its label to Change: Zipper Change: Lag according to the new state. The Btn2 state itself will be used on subsequent Ctrl0-3 changes.

Btn3 (event 7) sets the Generator Wave type to Sine or White for Left Stream 0 and 1, as well as Right Stream 0. In Binaural mode only Left and Right Stream 0 will be used, otherwise only Left Stream 0 and 1. When Noise is toggled on, R.0.TmRand=L0 and L.1.TmRand=L0 synchronize the Right Stream 0 and Left Stream 1 noise sources to Left Stream 0 before shift modulation is set.

;<Help=H4907
IF.Ctrls=<2
    IF.Btn2=1
        GenUpdate=0
    ENDIF.
    @_Beats_Update
    L.0.Shift.TmModFreq=Ctrl1
    GenUpdate=1
ENDIF.

IF.Ctrls=2
    IF.Btn2=1
        GenUpdate=0
    ENDIF.
    IF.Btn0=3
        D=Ctrl2
    ELSE.
        M=Ctrl2
        L.0.AMdepth=M
        L.0.Shift.TmModDepth=M / 2
    ENDIF.
    @_Beats_Update
    GenUpdate=1
ENDIF.

IF.Ctrls=3
    IF.Btn2=1
        GenUpdate=0
    ENDIF.
    @_Beats_Update
    GenUpdate=1
ENDIF.

IF.Ctrls=4
    IF.Btn0=0
        Btn0="&Mode:  Binaural"
        Ctrl2="<<Modulation %"
        Ctrl2="<S(0,200)"
        Ctrl2=M
        L.0.AM=0
        L.0.Level=100
        L.0.StreamOn=1
        R.0.StreamOn=1
        L.0.Burst=0
        L.0.Shift.TmModOn=1
        Btn1="<D"
        IF.Btn3=0
            Ctrl2="<D"
        ELSE.
            Ctrl2="<N"
        ENDIF.
        Ctrl3="<D"
    ENDIF.
    IF.Btn0=1
        Btn0="&Mode:  Monaural"
        L.0.Level=50
        L.0.AM=0
        L.0.Shift.TmModOn=1
        IF.Btn3=0
            Ctrl2="<D"
        ELSE.
            Ctrl2="<N"
        ENDIF.
        Btn1="<N"
    ENDIF.
    IF.Btn0=2
        Btn0="&Mode:  AM"
        Ctrl2="<N"
        Ctrl2="<<Modulation %"
        Ctrl2="<S(0,200)"
        Ctrl2=M
        Ctrl3="<D"
        Btn1="<N"
        L.0.Burst=0
        L.0.AM=1
        L.0.Level=100
        L.1.StreamOn=0
        R.0.StreamOn=0
        L.0.Shift.TmModOn=0
    ENDIF.
    IF.Btn0=3
        Btn0="&Mode:  Burst"
        M=Ctrl2
        Ctrl2="<<Duty Cycle %"
        Ctrl2="<S(0,100)"
        Ctrl2=D
        Ctrl3="<N"
        Btn1="<N"
        L.0.AM=0
        L.0.Burst=1
        L.0.Shift.TmModOn=0
    ENDIF.
    @_Beats_Ears
    @_Beats_Update
ENDIF.

IF.Ctrls=5
    @_Beats_Ears
    @_Beats_Update
ENDIF.

IF.Ctrls=6
    IF.Btn2=1
        Btn2="&Change:  Lag"
    ELSE.
        Btn2="&Change:  Zipper"
    ENDIF.
ENDIF.

IF.Ctrls=7
    IF.Btn3=0
        Btn3="&Wave:  Sine"
        L.0.Wave=Sine
        L.1.Wave=Sine
        R.0.Wave=Sine
        Ctrl0="<N"
        IF.Btn0=<2
            Ctrl2="<D"
        ELSE.
            Ctrl2="<N"
        ENDIF.
    ELSE.
        Btn3="&Wave:  Noise"
        L.0.Wave=White
        L.1.Wave=White
        R.0.Wave=White
        R.0.TmRand=L0
        L.1.TmRand=L0
        L.0.Shift.TmModDepth=Ctrl2/2
        L.0.Shift.TmModFreq=Ctrl1
        Ctrl0="<D"
        Ctrl2="<N"
    ENDIF.
ENDIF.


_Beats_Update Macro Listing:

When Ctrl0 through Ctrl3 or Btn0 or Btn1 is changed, the _Beats_Ctrls macro calls this subroutine macro to update the Generator tone frequencies, AM modulator frequency, or Burst parameters depending on the current Mode.

In Binaural mode (Btn0 = 0) the Left and Right Stream 0 frequencies are changed, but in Monaural mode Btn0 = 1 the two frequencies are Left Stream 0 and Left Stream 1.

The lower frequency is set to the Center minus half of the Difference, and the upper is set to the Center plus half of the Difference.

In Burst mode, the overall cycle is first computed by finding the number of samples in one cycle of Difference frequency Ctrl1, limited to 0.1 Hz here. That's just the sample rate divided by the frequency. The value is stored in variable C and not set immediately. Then the number of samples H in the nominal "on" (High) part of the burst is computed from the Duty Cycle Ctrl2 as a percentage of the cycle time C. The number of Rise samples is half of the Ctrl3 Rise/Fall setting as a percentage of H, and the number of Fall samples is the same. Then the total of those two is subtracted from H to find the samples remaining for High.

Finally, the burst Cycle is set from C. This could not be done at the outset because Cycle can never be less than the total of the other intervals; if a smaller value is attempted, it will be limited to the total. Consider that when the Difference frequency is reduced, all values need to be reduced proportionally... but since Rise, High, and Fall start out with their old larger values, Cycle can't be set or it may be limited. Setting it last solves the problem.

;<Help=H4907
IF.Btn0=0
    L.0.ToneFreq=Ctrl0 - Ctrl1 / 2
    R.0.ToneFreq=Ctrl0 + Ctrl1 / 2
ENDIF.

IF.Btn0=1
    IF.Btn3=0
        L.0.ToneFreq=Ctrl0 - Ctrl1 / 2
        L.1.ToneFreq=Ctrl0 + Ctrl1 / 2
    ENDIF.
ENDIF.

IF.Btn0=2
    L.0.AMmodFreq=Ctrl1
    IF.Btn3=0
        L.0.ToneFreq=Ctrl0
    ENDIF.
ENDIF.

IF.Btn0=3
    L.0.ToneFreq=Ctrl0
    IF.Ctrl1=<0.1
        Ctrl1=0.1
    ENDIF.
    C=SmplRate / Ctrl1
    H=Ctrl2 * C / 100
    L.0.BurstRise=Ctrl3 * H / 200
    L.0.BurstFall=L.0.BurstRise
    L.0.BurstHigh=H - 2 * L.0.BurstRise
    L.0.BurstCycle=C
ENDIF.


_Beats_Ears Macro Listing:

This is called by _Beats_Ctrls when the Both Ears / Left Ear button Btn1 is clicked, and also when the Mode changes. If Mode is Binaural, then the Both Ears state is always set, forcing the generator Left Solo state off, the Right output on, and Left Stream 1 off.

In other modes, the Right output is always off. Left Solo is off for Both Ears, and on for Left Ear. Left Stream 1 is always on for Monaural (Btn0 = 1), otherwise off.

;<Help=H4907
IF.Btn0=0
    Btn1=0
    Btn1="Both &Ears"
    GenSoloL=0
    GenR=1
    L.1.StreamOn=0
ELSE.
    GenR=0
    IF.Btn1=0
        Btn1="Both &Ears"
        GenSoloL=0
    ELSE.
        Btn1="Left &Ear"
        GenSoloL=1
    ENDIF.
    IF.Btn0=1
        L.1.StreamOn=1
    ELSE.
        L.1.StreamOn=0
    ENDIF.
ENDIF.


See also Auditory Phenomena and Experiments, Macro Examples and Mini-Apps

GO:

Questions? Comments? Contact us!

We respond to ALL inquiries, typically within 24 hrs.
INTERSTELLAR RESEARCH:
Over 30 Years of Innovative Instrumentation
© Copyright 2007 - 2017 by Interstellar Research
All rights reserved