Skip to content

Commit

Permalink
REPL - add command to set amp
Browse files Browse the repository at this point in the history
Also, set deafult to 0.3 to reduce distortion
  • Loading branch information
samaaron committed Jul 29, 2024
1 parent c270d27 commit 2f7cfb3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/server/ruby/bin/repl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def initialize(init_code=nil)
@server_started_prom.get
@supercollider_started_prom.get
puts "-- Sonic Pi Server started"
puts "-- Setting amplitude to 0.3"
repl_eval_osc_client.send("/mixer-amp", daemon_token, 0.3, 1)
print_ascii_art
repl_eval_osc_client.send("/run-code", daemon_token, init_code) if init_code
puts ""
Expand All @@ -98,6 +100,7 @@ def initialize(init_code=nil)
force_puts " , - Multiline edit mode"
force_puts " . - Stop all runs"
force_puts " .l - Toggle log output"
force_puts " .a 0.5 - Set the amplitude to 0.5 (range 0 -> 1), default 0.3."
force_puts " .q - Quit"
when "."
repl_puts "Stopping all runs..."
Expand All @@ -110,8 +113,11 @@ def initialize(init_code=nil)
force_puts "Disabling log output..."
end
when ".q"
repl_puts "Quitting the REPL..."
force_puts "Quitting the REPL..."
exit
when /^\.a\s+([0-9.]+)$/
force_puts "Setting amplitude to #{$1}"
repl_eval_osc_client.send("/mixer-amp", daemon_token, $1.to_f, 1)
when ","
force_puts "Multiline edit mode. Finish with a comma on a new line."
force_puts ""
Expand Down Expand Up @@ -317,6 +323,7 @@ def print_ascii_art
puts " , - Multiline edit mode"
puts " . - Stop all runs"
puts " .l - Toggle log output"
puts " .a 0.5 - Set the amplitude to 0.5 (range 0 -> 1)"
puts " .q - Quit"
puts ""
puts "Note: set the SONIC_PI_HOME env variable to specify the location of the log files"
Expand Down

0 comments on commit 2f7cfb3

Please sign in to comment.