PyObjC Framework: PHASE

12.1 · active · verified Tue Apr 14

`pyobjc-framework-phase` provides Python wrappers for Apple's PHASE (Physical Audio Spatialization Engine) framework on macOS. It is part of the larger PyObjC project, allowing Python applications to interact with Objective-C APIs and leverage native macOS functionalities. The current version is 12.1, with releases typically aligning with macOS SDK updates and Python version support changes.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import a class from the `PHASE` framework and attempt to instantiate a `PHASEEngine`. While a complete audio application using PHASE is complex, this example verifies that the framework bindings are correctly installed and accessible from Python. Output will appear in the macOS system log (viewable via Console.app) due to `NSLog` usage.

import objc
from Foundation import NSObject, NSLog
from PHASE import PHASEEngine, PHASE_ENGINE_SOUND_EVENT_TYPE_NONE

def quick_phase_check():
    NSLog("Attempting to create a PHASEEngine instance...")
    try:
        # PHASEEngine requires an identifier for instantiation
        engine = PHASEEngine.alloc().initWithIdentifier_("MyPythonPHASEEngine")
        if engine:
            NSLog("Successfully created PHASEEngine instance: %@", engine)
            # A real PHASE application would continue with configuration and playback.
            # This example only verifies the binding's accessibility.
        else:
            NSLog("Failed to create PHASEEngine instance.")
    except Exception as e:
        NSLog("Error creating PHASEEngine: %@", str(e))

if __name__ == "__main__":
    quick_phase_check()

view raw JSON →