MMMAudio¶
MMMAudio with Dedicated Process Runs audio processing in a separate process on its own CPU core
MMMAudio
¶
MMMAudio class that runs in its own dedicated process. All audio processing happens in a separate process, while the main process can send commands and parameter changes.
compile(graph_name, package_name)
classmethod
¶
Compile the Mojo graph and create the bridge module.
exit_all()
classmethod
¶
Stop all instances and exit
fake_mouse(x_size=300, y_size=300)
classmethod
¶
Create a GUI slider that sends fake mouse positions to all instances.
get_audio_devices(print_them=True)
classmethod
¶
Get a list of available audio devices with their input/output capabilities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
print_them
|
If True, prints the devices to the console. |
True
|
Returns:
| Type | Description |
|---|---|
list
|
A named tuple containing two dictionaries: (in_devices, out_devices). |
list
|
Each dictionary maps device index to a list of [name, max_channels, sample_rate]. |
get_samples(samples)
¶
Get samples from the audio process (blocking call).
is_process_alive()
¶
Check if the audio process is alive
is_running()
¶
Check if audio is currently running
plot(samples, clear=True)
¶
Plot samples from the audio process.
send_bool(key, value)
¶
Send a bool message to the Mojo audio engine.
send_bools(key, values)
¶
Send a list of bool messages to the Mojo audio engine.
send_float(key, value)
¶
Send a float to the Mojo audio engine.
send_floats(key, values)
¶
Send a list of floats to the Mojo audio engine.
send_int(key, value)
¶
Send an integer to the Mojo audio engine.
send_ints(key, values)
¶
Send a list of integers to the Mojo audio engine.
send_string(key, value)
¶
Send a string message to the Mojo audio engine.
send_strings(key, args)
¶
Send a list of string messages to the Mojo audio engine.
send_trig(key)
¶
Send a trigger message to the Mojo audio engine.
set_screen_dims(width, height)
¶
Send screen dimensions to the audio process.
start_audio()
¶
Start audio streaming in the audio process
start_mouse()
classmethod
¶
Start mouse tracking in the main process and send updates to all instances.
start_process(audio_init_timeout=10.0)
¶
Start the audio process
stop_audio()
¶
Stop audio streaming in the audio process
stop_mouse()
classmethod
¶
Stop the mouse tracking thread.
stop_process()
¶
Stop the audio process and clean up resources
update_mouse_pos(x, y)
¶
Send mouse position update to the audio process.