Skip to main content

Binaural

A Python package for generating binaural beats and other brainwave entrainment audio.

What are Binaural Beats?

Binaural beats are an auditory illusion perceived when two slightly different frequencies are presented separately to each ear. The brain processes these two frequencies and perceives a third frequency, which is the mathematical difference between the two. This perceived beat frequency can influence brainwave activity and is often used for meditation, relaxation, and cognitive enhancement.

For example, if a 200 Hz tone is played in one ear and a 210 Hz tone is played in the other ear, the brain perceives a binaural beat of 10 Hz. This 10 Hz frequency falls within the alpha brainwave range, which is associated with relaxation and calmness.

Brainwave Frequencies and Their Effects

Brainwave Type Frequency Range Associated Effects
Delta 0.5 - 4 Hz Deep sleep, healing, unconscious mind
Theta 4 - 8 Hz Meditation, creativity, deep relaxation
Alpha 8 - 14 Hz Relaxation, visualization, calmness
Beta 14 - 30 Hz Alertness, concentration, cognition
Gamma 30 - 100 Hz Higher mental activity, problem-solving

Features

  • Generate binaural beats with customizable frequencies
  • Create isochronic tones
  • Generate monaural beats
  • Adjustable parameters (frequency, duration, amplitude, etc.)
  • Support for carrier frequency modulation
  • Smooth attack/decay envelopes to prevent audio artifacts
  • Multiple output formats (WAV, MP3, etc.)
  • Solfeggio frequencies support (UT, RE, MI, etc.)
  • Optional carrier frequency modulation
  • Customizable waveforms (sine, square, etc.)

Installation

You can install the package via pip:

pip install binaural

Quick Start

Generate a Simple Binaural Beat

from binaural import generate_binaural_beat

# Generate a 10Hz theta binaural beat at 200Hz base frequency
left, right = generate_binaural_beat(
    base_frequency=200,  # Base frequency in Hz
    beat_frequency=10,   # Desired beat frequency in Hz
    duration=5,          # Duration in seconds
)

# Save as WAV file
import scipy.io.wavfile as wavfile
import numpy as np
wavfile.write('binaural_beat.wav', 44100, np.vstack((left, right)).T)

Create an Isochronic Tone

from binaural import generate_isochronic_tone

# Generate a 10Hz isochronic tone at 200Hz
tone = generate_isochronic_tone(
    frequency=200,    # Tone frequency in Hz
    pulse_rate=10,    # Pulse rate in Hz
    duration=5        # Duration in seconds
)

Generate a Monaural Beat

from binaural import generate_monaural_beat

# Generate a 10Hz monaural beat
beat = generate_monaural_beat(
    frequency1=200,   # First frequency in Hz
    frequency2=210,   # Second frequency in Hz
    duration=5        # Duration in seconds
)

Generate SolfeggioFrequency

from binaural import SolfeggioFrequency, generate_solfeggio_tone, mix_solfeggio_frequencies

# Generate a single UT (174 Hz) tone for healing
healing_tone = generate_solfeggio_tone(SolfeggioFrequency.UT, duration=5)

# Mix multiple frequencies
mixed = mix_solfeggio_frequencies(
    frequencies=[SolfeggioFrequency.UT, SolfeggioFrequency.SOL],
    duration=5,
    amplitudes=[0.5, 0.5]
)

# Create a binaural beat based on 432 Hz (SOL)
left, right = generate_solfeggio_binaural(
    SolfeggioFrequency.SOL,
    beat_frequency=7.83,  # Schumann resonance
    duration=5
)

More

from binaural import (
    SolfeggioFrequency, 
    generate_solfeggio_tone, 
    mix_solfeggio_frequencies, 
    generate_solfeggio_binaural,
    generate_binaural_beat,
    generate_isochronic_tone,
    generate_monaural_beat
)

# Generate a single UT (174 Hz) tone for healing
healing_tone = generate_solfeggio_tone(SolfeggioFrequency.UT, duration=5)

# Mix multiple frequencies
mixed = mix_solfeggio_frequencies(
    frequencies=[SolfeggioFrequency.UT, SolfeggioFrequency.SOL],
    duration=5,
    amplitudes=[0.5, 0.5]
)

# Create a binaural beat based on 432 Hz (SOL)
left, right = generate_solfeggio_binaural(
    SolfeggioFrequency.SOL,
    beat_frequency=7.83,  # Schumann resonance
    duration=5
)

# Generate a binaural beat with a base frequency of 200 Hz and a beat frequency of 10 Hz
left, right = generate_binaural_beat(
    base_frequency=200,
    beat_frequency=10,
    duration=5
)

# Generate an isochronic tone with a frequency of 10 Hz and a pulse rate of 2 Hz
isochronic_tone = generate_isochronic_tone(
    frequency=10,
    pulse_rate=2,
    duration=5
)

# Generate a monaural beat with frequencies of 200 Hz and 210 Hz
monaural_beat = generate_monaural_beat(
    frequency1=200,
    frequency2=210,
    duration=5
)

Advanced Usage

Binaural Beat with Carrier Frequency

left, right = generate_binaural_beat(
    base_frequency=200,
    beat_frequency=10,
    duration=5,
    carrier_frequency=432,  # Add carrier frequency modulation
    attack=0.5,            # Fade in time in seconds
    decay=0.5              # Fade out time in seconds
)

API Reference

generate_binaural_beat

def generate_binaural_beat(
    base_frequency: float,
    beat_frequency: float,
    duration: float,
    sample_rate: int = 44100,
    amplitude: float = 0.5,
    carrier_frequency: Optional[float] = None,
    attack: float = 0.1,
    decay: float = 0.1
) -> Tuple[np.ndarray, np.ndarray]:
    """Generate a binaural beat."""

See function docstrings for detailed parameter descriptions and usage.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Repository Views Views

Metadata

Release files for binaural 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for binaural 0.1.2
File Size Uploaded
binaural-0.1.2.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for binaural 0.1.2
File Interpreter ABI Platform
binaural-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.8 kB

Release files / binaural-0.1.2.tar.gz

Download URL binaural-0.1.2.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
38785a7c88f0429a37a5ebbb1e8b08b40182d27db619f60491525ace70039046
BLAKE2b-256 checksum
How to use checksums
dc84d36d68a81b51657b65fce88bc260dd856140905409bac13a261c6d768b10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Release files / binaural-0.1.2-py3-none-any.whl

Download URL binaural-0.1.2-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab4a0c88e5ca8fe07d29e3b0f0f8fc69ae3fc178845f4b7c707c0e6b0319254a
BLAKE2b-256 checksum
How to use checksums
1a86404295c828a4b2519460e127f0bee592864d756fbcc3052b52f80df36580
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page