Constructor
new SonicPiAPI()
Creates an instance of the SonicPiAPI
Class
- Source:
Members
settings :Object
User settings
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
log_synths |
boolean | Default: true |
log_cues |
boolean | Default: true |
enable_external_synths |
boolean | Default: false |
enforce_timing_guarantees |
boolean | Default: false |
check_args |
boolean | Default: false |
default_midi_channel |
number | Note that any number less than 0 corresponds to all channels. Must be an integer. Default: -1 |
- Source:
Methods
buffer_new_line_and_indent(point_line, point_index, first_line, code, file_name)
Buffer new line and indent
Parameters:
Name | Type | Description |
---|---|---|
point_line |
number | |
point_index |
number | |
first_line |
number | |
code |
string | |
file_name |
string |
- Source:
(async) init(root) → {Result}
Initialise the Sonic Pi server
Parameters:
Name | Type | Description |
---|---|---|
root |
string | Root path of Sonic Pi |
- Source:
Returns:
The result of the initialisation process
- Type
- Result
load_workspaces()
Load workspaces
- Source:
run_code(code)
Run code
Parameters:
Name | Type | Description |
---|---|---|
code |
string | The code to run |
- Source:
save_and_run_buffer(buffer, code)
Save and run buffer
Parameters:
Name | Type | Description |
---|---|---|
buffer |
string | Buffer identifier |
code |
string | The code to save and run |
- Source:
save_workspaces(workspaces)
Save workspaces
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
workspaces |
Array.<Object> |
Properties
|
- Source:
set_volume(vol, silentopt)
Set the main volume
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
vol |
number | A number from 0 to 200 indicating the volume percentage |
||
silent |
number |
<optional> |
0 |
- Source:
Throws:
-
Argument vol must be between 0 and 200 inclusive.
- Type
- RangeError
shutdown()
Shuts down the Sonic Pi server
- Source:
stop_all_jobs()
Stop all jobs
- Source:
Type Definitions
Result
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
success |
boolean | Whether the operation was successful |
error_message |
string | An error message if something went wrong - only present if |
- Source:
Events
received_ports
Emits the ports used for communicating with different parts of the server
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
daemon |
number | Port for sending commands to boot daemon |
gui_listen_to_spider |
number | Port for Spider (Ruby Server) to GUI communications |
gui_send_to_spider |
number | Port for GUI to Spider communications |
scsynth |
number | Port for sending commands to scsynth |
tau_osc_cues |
number | Port for receiving OSC cues |
tau |
number | Port for sending messages to Tau (Elixir Server) |
phx_http |
number | Port that the Tau webpage is served on |
- Source:
shutdown_complete
Emitted when the shutdown process is complete (i.e. when the boot daemon has exited)
- Source: