{"id":28397950,"url":"https://github.com/labsound/labsoundpy","last_synced_at":"2025-06-28T12:31:46.150Z","repository":{"id":285072628,"uuid":"956986977","full_name":"LabSound/LabSoundPy","owner":"LabSound","description":"Python bindings for LabSound","archived":false,"fork":false,"pushed_at":"2025-05-03T22:05:08.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-01T12:11:56.114Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LabSound.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-29T09:31:41.000Z","updated_at":"2025-05-03T22:05:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"d9b8c0ce-34bb-48d8-811d-6408ca7fa97e","html_url":"https://github.com/LabSound/LabSoundPy","commit_stats":null,"previous_names":["labsound/labsoundpy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LabSound%2FLabSoundPy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LabSound%2FLabSoundPy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LabSound%2FLabSoundPy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LabSound%2FLabSoundPy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LabSound","download_url":"https://codeload.github.com/LabSound/LabSoundPy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LabSound%2FLabSoundPy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258655647,"owners_count":22736644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-01T03:10:19.060Z","updated_at":"2025-06-28T12:31:46.144Z","avatar_url":"https://github.com/LabSound.png","language":"Python","readme":"# LabSoundPy\n\nPython bindings for the LabSound audio engine.\n\nThis project is very much work in progress and does not yet compile. It's published in case anyone wants to pitch in to help write it.\n\n\n## Overview\n\nLabSoundPy provides a Pythonic interface to LabSound's audio processing capabilities, making it as simple and intuitive to use as JavaScript-based Web Audio API while leveraging Python's strengths and ecosystem.\n\n## Features\n\n- **Pythonic Interface**: A wrapper that feels natural to Python developers\n- **Graph-Based Audio Processing**: Node-based programming model for audio processing\n- **NumPy Integration**: Seamless integration with NumPy for audio data manipulation\n- **Comprehensive Node Types**: Support for all standard Web Audio API node types\n- **Custom Processing**: Create custom audio processing with Python functions\n- **Context Management**: Use Python's context managers for resource handling\n\n## Installation\n\n```bash\n# Coming soon\npip install labsoundpy\n```\n\n## Quick Start\n\n```python\nimport labsound as ls\n\n# Create an audio context with context manager\nwith ls.AudioContext() as ctx:\n    # Create nodes\n    osc = ctx.create_oscillator()\n    gain = ctx.create_gain()\n    \n    # Set parameters\n    osc.frequency.value = 440  # A4 note\n    gain.gain.value = 0.5      # Half volume\n    \n    # Connect nodes\n    ctx.connect(osc, gain)\n    ctx.connect(gain, ctx.destination)\n    \n    # Start and stop the oscillator\n    osc.start(0)\n    osc.stop(2)\n    \n    # Wait for completion\n    ctx.wait(2.5)\n```\n\n## Node Types\n\nLabSoundPy supports the following node types:\n\n- **AnalyzerNode**: For real-time frequency and time-domain analysis\n- **AudioBufferSourceNode**: For playing back pre-recorded audio\n- **BiquadFilterNode**: For filtering audio with various filter types\n- **ChannelMergerNode**: For combining multiple audio channels\n- **ChannelSplitterNode**: For splitting audio into multiple channels\n- **ConstantSourceNode**: For generating a constant value\n- **ConvolverNode**: For applying convolution effects (e.g., reverb)\n- **DelayNode**: For delaying audio\n- **DynamicsCompressorNode**: For dynamic range compression\n- **FunctionNode**: For custom audio processing with Python functions\n- **GainNode**: For controlling audio volume\n- **OscillatorNode**: For generating audio tones\n- **PannerNode**: For 3D audio positioning\n- **StereoPannerNode**: For simple stereo panning\n- **WaveShaperNode**: For non-linear distortion effects\n\nIt's intended that all LabSound nodes will be wrapped. Please see STATUS.md for details.\n\n## Examples\n\n### Spatial Audio\n\n```python\nimport time\nimport math\nfrom labsound import AudioContext\n\n# Create an audio context\nwith AudioContext() as context:\n    # Create an oscillator as our sound source\n    oscillator = context.create_oscillator()\n    oscillator.frequency.value = 440  # A4 note\n    \n    # Create a panner node for 3D positioning\n    panner = context.create_panner()\n    panner.panning_model = \"HRTF\"  # Head-related transfer function\n    \n    # Connect the oscillator to the panner, and the panner to the destination\n    context.connect(oscillator, panner)\n    context.connect(panner, context.destination)\n    \n    # Start the oscillator\n    oscillator.start()\n    \n    # Move the sound source in a circle around the listener\n    radius = 5  # 5 units away from the listener\n    for i in range(100):\n        angle = (i * 0.1) % (2 * math.pi)\n        x = radius * math.sin(angle)\n        z = radius * math.cos(angle)\n        \n        # Update the panner position\n        panner.set_position(x, 0, z)\n        \n        # Wait a bit before the next update\n        time.sleep(0.1)\n    \n    # Stop the oscillator\n    oscillator.stop()\n```\n\n### Custom Processing with NumPy\n\n```python\nimport numpy as np\nfrom labsound import AudioContext\n\n# Create an audio context\nwith AudioContext() as context:\n    # Create an oscillator as our sound source\n    oscillator = context.create_oscillator()\n    oscillator.frequency.value = 220  # A3 note\n    \n    # Create a function node for custom processing\n    function_node = context.create_function(channels=1)\n    \n    # Define a custom processing function\n    def bit_crusher(channel, buffer):\n        # Apply a bit crusher effect (reduces bit depth)\n        bits = 4  # Reduced bit depth\n        step = 2.0 ** (bits - 1)\n        \n        for i in range(len(buffer)):\n            # Quantize the sample to the reduced bit depth\n            buffer[i] = np.floor(buffer[i] * step) / step\n    \n    # Set the processing function\n    function_node.set_process_function(bit_crusher)\n    \n    # Connect the nodes\n    context.connect(oscillator, function_node)\n    context.connect(function_node, context.destination)\n    \n    # Start the oscillator\n    oscillator.start()\n    \n    # Let it play for 3 seconds\n    context.wait(3)\n```\n\n## Documentation\n\nFor more detailed documentation, see the [API Reference](docs/api_reference.md) and [Examples](examples/).\n\n## Development\n\n### Building from Source\n\nThere are two ways to build LabSoundPy from source:\n\n#### Option 1: Using Git Submodules (Recommended)\n\nThis approach automatically fetches and builds the required dependencies (nanobind and LabSound) as git submodules.\n\n```bash\n# Clone the repository with submodules\ngit clone --recursive https://github.com/yourusername/labsoundpy.git\ncd labsoundpy\n\n# Or if you've already cloned without --recursive\ngit submodule update --init --recursive\n\n# Install development dependencies\npip install -e \".[dev]\"\n\n# Build the extension (this will use submodules by default)\npython setup.py build_ext --inplace\n```\n\n#### Option 2: Using Installed Dependencies\n\nIf you prefer to use system-installed versions of the dependencies:\n\n```bash\n# Clone the repository\ngit clone https://github.com/yourusername/labsoundpy.git\ncd labsoundpy\n\n# Install development dependencies\npip install -e \".[dev]\"\n\n# Build using installed dependencies\nUSE_SUBMODULES=0 python setup.py build_ext --inplace\n```\n\nNote: This approach requires that you have LabSound installed and findable by CMake.\n\n### Running Tests\n\n```bash\npytest\n```\n\n## License\n\nLabSoundPy is licensed under the same license as LabSound. See the [LICENSE](LICENSE) file for details.\n\n## Acknowledgements\n\nLabSoundPy is built on top of [LabSound](https://github.com/LabSound/LabSound), a C++ audio engine.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabsound%2Flabsoundpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flabsound%2Flabsoundpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabsound%2Flabsoundpy/lists"}