Phase amplitude coupling?

Hello - I’m a cognitive neuroscientist interested in phase amplitude coupling in audio sensory stimulation.
My question is what might be the best strategy to create the attached wave - where theta (4hz) are combined with gamma (40hz) where the amplitude of the gamma is phase locked to the (peak) theta. I understand from another forum post how to create binaural beats with independent input to both ears. For these TWO waves, would I create two binaural inputs per ear (one for each wave) and then modulate the amplitude of the gamma wave in phase with the theta wave?
Any help greatly appreciated. I think others may be interested in this in the neural oscillation entrainment field.
Mark
phase-amplitude-coupling - theta-gamma.PNG

Do you want the 4 Hz Sine wave to be present, or do you just want the amplitude modulated 40 Hz Sine?

In your image, the 40 Hz Sine wave appears to be amplitude modulated by around 80%. Do you want 80% amplitude modulation, or do you want it to be completely modulated?

The best strategy would be to generate the sound using Nyquist (Nyquist - Audacity Manual)

Tracks000.png
The upper track shows a 40 Hz signal modulated at 4 Hz.
The lower track shows the modulated signal mixed with the 4 Hz Sine tone.

I used this Nyquist code:

(setf low-hz 4)
(setf low-amp 0.5)
(setf hi-hz 40)
(setf hi-amp 0.5)
(setf mod-depth 80)  ;modulation depth %

(setf depth (/ mod-depth 200.0))
(setf offset (- 1 depth))
(setf low (hzosc low-hz))
;; derive modulation signal from low frequency sine
(setf mod (sum offset (mult depth low)))

(setf modulated (mult mod hi-amp (hzosc hi-hz)))

;; Mix the modulated signal with the low frequency Sine.
(sim modulated
    (mult low-amp low))

(This is not the most efficient way, but it’s probably the easiest to follow.)

Hello Steve,
That’s a great help - thanks. I’ll have a look at the Nyquist code and play around with it.
80% looks good. The modulated signal mixed with the 4 Hz Sine tone (your lower wave) is exactly what’s needed for this research yes.
Cheers
Mark

I assume that you are aware that unless your playback transducer (speakers / headphones) can go down to 4 Hz, the 4 Hz component will be filtered out by the playback system, so you will essentially get the same output from either the upper or lower tracks.

Yes, that’s what I found. There are numerous studies such as this one showing the benefits of e.g. theta wave entrainment for memory.
https://pubmed.ncbi.nlm.nih.gov/30198823/
This is of course a composite wave, but is there any way to recreate your bottom panel wave in Audacity using a binaural beats approach - with e.g. two inputs per ear?
Mark

Sorry, but you need to be more scientific in how you describe what you want. I can show you how to generate frequencies, apply modulation, and many other things, but I can’t design your experiment for you.

Right.
Well, with binaural beats you can create a perception of e.g. 4 hz by taking the following steps;

  1. Generate → Tone
    Choose e.g. 300 hz

  2. Select the drop down arrow at the beginning of the newly created audio track and the select “Left Channel”

  3. Next repeat step 1 - only set the frequency higher or lower than the base tone by 4 Hz

  4. Repeat step 2 - but select ‘Right Channel’

  5. Export mp3 file as ‘stereo’.

Binaural beats is the name given to the perceptual effect where our auditory system perceives this combination of times as a 4 hz wave.

So I just tried, for instance, assigning 300hz to the left channel and a 304hz and 340 hz track to the right channel. The sound file attached.

I wonder if I could try amplitude modulating these tracks as you have done using Nyquist.

Mark

This is what the beautiful 4hz theta sounds like using this method. (Attached)

My best bet may be using monoaural beats given the difficulty in specifying amplitude and phase objectively with binaural beats. Anyway, I’ll experiment with the code -thanks!
fpsyt-06-00070-g001.jpg

Hi Steve,
I’ve got another question about this code: how can I mix the modulated signal with the low frequency sinewave but shifted 90deg in phase - such that the peak amplitude of the 40Hz wave is not at 90 deg but at 180 deg of the 4hz wave?
Cheers - Mark

(setf low-hz 4)
(setf low-amp 0.5)
(setf hi-hz 40)
(setf hi-amp 0.5)
(setf mod-depth 80) ;modulation depth %

(setf depth (/ mod-depth 200.0))
(setf offset (- 1 depth))
(setf low (hzosc low-hz))
;; derive modulation signal from low frequency sine
(setf mod (sum offset (mult depth low)))

(setf modulated (mult mod hi-amp (hzosc hi-hz)))

;; Mix the modulated signal with the low frequency Sine.
(sim modulated
(mult low-amp low))

If Steve does not see your post here, he has a website dedicated to Nyquist code … https://audionyq.com/

To create a phase shifted sine wave, use the OSC function rather than HZ-OSC to generate the waveform.
As you can see in the manual (Nyquist Functions), the OSC function has optional arguments for duration, table, and phase.

Optional arguments are positional, meaning that the “phase” argument must be the 4th argument.
Also note that whereas for HZ-OSC the frequency is passed as Hz, for OSC the the frequency is passed as a “pitch” value, so to create a 4Hz sine we have to convert the Hz value to a pitch value.

;; Low frequency sin wave with 90 degrees phase shift
(setf low-hz-sin-90 (osc (hz-to-step low-hz) 1 *sine-table* 90))

So, to mix the modulated signal with a 90 degree phase shifted sine, we add the modulated signal with the 90 degree phase shifted sine.

Here is the full code (I’ve commented out the original “mix” line so that you can compare the new code with the old):


(setf low-hz 4)
(setf low-amp 0.5)
(setf hi-hz 40)
(setf hi-amp 0.5)
(setf mod-depth 80) ;modulation depth %

(setf depth (/ mod-depth 200.0))
(setf offset (- 1 depth))
(setf low-hz-sin (hzosc low-hz))
;; derive modulation signal from low frequency sine
(setf mod (sum offset (mult depth low-hz-sin)))

(setf modulated (mult mod hi-amp (hzosc hi-hz)))

;; Low frequency sin wave with 90 degrees phase shift
(setf low-hz-sin-90 (osc (hz-to-step low-hz) 1 *sine-table* 90))

;; Mix the modulated signal with the low frequency Sine.
;(sim modulated (mult low-amp low-hz-sin))
(sim modulated (mult low-amp low-hz-sin-90))

That’s very helpful indeed - many thanks Steve!