music.binaural_beats

music.binaural_beats(carrier_freq=200.0, beat_freq=10.0, duration=2.0, waveform_table=array([0., 0.0003835, 0.00076699, ..., -0.00115049, -0.00076699, -0.0003835], shape=(16384,)), number_of_samples=0, sample_rate=44100)[source]

Synthesize a binaural beat: sstim-v:techBinauralBeats.

Two sine tones at slightly different frequencies presented dichotically, one per ear, producing a perceived beat at their difference frequency that arises centrally rather than in the air [2]. The two carriers are placed symmetrically about carrier_freq, at carrier_freq -/+ beat_freq / 2, so the perceived pitch stays where the caller put it.

Parameters:
carrier_freqscalar

The centre frequency of the two carriers, in Hertz.

beat_freqscalar

The difference between the two carriers, in Hertz, which is the rate of the perceived beat.

durationscalar

The duration in seconds.

waveform_tablearray_like

The table the carriers are looked up in.

number_of_samplesinteger

The number of samples of the sound, taken instead of duration when it is given.

sample_rateinteger

The sampling frequency in Hertz.

Returns:
ndarray

A (2, n) stereo array: the lower carrier in the left channel, the higher in the right.

Parameters:
  • carrier_freq (float)

  • beat_freq (float)

  • duration (float)

  • waveform_table (ArrayLike)

  • number_of_samples (int)

  • sample_rate (int)

Return type:

NDArray[float64]

See also

monaural_beats

the same two tones in one channel, where the beat is physically present.

Notes

The beat is not in the signal. SSTIM records this technique as producing a perceptually constructed rather than a physically present modulation. Each channel here is a steady tone, and a spectrum of either one alone does not contain the beat: it is a neural construct from dichotic presentation.

Channel separation is therefore the mechanism, not a packaging detail, and the stimulus only works over headphones. Summing the two channels does not preserve it – it produces a real envelope at the difference frequency, numerically identical to monaural_beats(), which is a different technique with a different mechanism and a different evidence base. Anything that downmixes this output has silently substituted one for the other.

References

[1]

Fabbri, Renato, et al. “Musical elements in the discrete-time representation of sound.” arXiv preprint arXiv:abs/1412.6853 (2017)

Examples

>>> stimulus = binaural_beats(carrier_freq=200, beat_freq=10)
>>> stimulus.shape[0]
2