This program is highly unstable/experimental. Use with caution, feel free to jump in and help :). I built it one or two years ago and never touched it again.
I couldn't wait for a new version of sonic-pi-cli or sonic-pi-tool following the release of Sonic Pi 4.0 so I quickly hacked a CLI tool that allows strings to be piped from the command line to the Sonic Pi Server. The script is a proof of concept based on information gathered from the Sonic Pi Forum. Feel free to change anything and to push changes to the repo :). I don't pretend to replace or do better than the tools mentioned above. Use them if you can once they will be updated!
Sonic Pipe is a project aiming to propose an alternative to the official Sonic Pi GUI. It targets advanced users that are already familiar with the usage of the terminal and/or who prefer to use the command line. Alternatively, it can also be interesting for people willing to play with Sonic Pi directly from Python.
- Control logs verbosity (less printing).
- Restore Ableton Link functionality (??).
- connect with a custom vim/neovim plugin.
- Install the tool using the
setup.py
file.git clone https://github.com/Bubobubobubobubo/sonic_pipe
cd sonic_pipe
pip install -e .
orpip3 install -e .
depending on your Python installation.
Required dependencies will be automatically installed. A CLI tool will be added to your path: sonic-pipe
. In forward versions, you will also be able to import SonicPipe as a library for usage in your own Python programs. The rest of the installation process is dependent on the OS you are using. Please refer to the corresponding section.
Currently not tested and unsupported. However, this should work already! Please let me know if it doesn't!
Please locate the daemon.rb
file that comes installed with Sonic Pi. This file should be located in the /server/bin
folder) not far from the actual sonic-pi
binary. The path to daemon.rb
can be given to sonic-pipe
using the --daemon_path
flag when executing the CLI.
sonic-pipe
should work out of the box without additional configuration.
In order to use Sonic Pipe, you will need a tool able to pipe commands from a terminal buffer to another terminal buffer. I recommend using Vim/Neovim Slime plugin. Very easy to setup and straightforward to use. If you are using vim.plug, you can add the slime
plugin like so:
call plug#begin()
Plug 'jpalardy/vim-slime'
call plug#end()
For convenience, please also add the following line to your init.vim
or .vimrc
file:
let g:slime_target = 'neovim'
You are now good to go. Follow this quick tutorial to start your first Sonic Pipe session:
- start
neovim
and split the screen in two separate buffers (:vs
or:sp
). - in one of the buffers, type
:terminal
to open a new embedded terminal. - start Sonic Pipe:
sonic-pipe --daemon=True --repl=True
.
Some basic commands are available:
- stop : stop currently running code.
- exit : exit the REPL/CLI tool.
- help : display help files.
Sonic Pipe includes an auto-save tool for your Sonic Pipe sessions. Sessions will be automatically saved whatever happens as .rb
files located at $HOME/.sonic-pi/sonic-pipe-sessions/
. Files are named in accordance with the current local time of your computer for easy retrieval.
- history : print current session history.
- purge-history : delete all files from history.
- save-history : save the current Sonic Pipe session.
Sonic Pipe includes an embedded documentation system that you can invoke directly from your playing buffer. Some help files are installed by default with the package. Your own help files can be added to SonicPipe by placing them in the $HOME/.sonic-pi/sonic-pipe-help/
folder in the MarkDown format. This
functionality is helpful to add custom documentation to your own libraries or to save code snippets that you wish to retrieve quickly.
- help : display the list of available help files.
- help [name] : print the selected help file.