Topic: Automatically load specific instrument with Raspberry Pi shell script?

Hello,

I am setting up a dedicated Raspberry Pi 5 to work with Pianoteq. I mostly use it headlessly, as I don't want to dive through menus every time I want to play piano. But I would like to select between a few instruments (a steinway, a rhodes, a wurlitzer). I'm thinking about building a selector (rotary encoder) that would run a script and allow me to switch between instruments with a physical action. Sort of recreating this functionality found in e.g. the Yamaha Reface CP (but with my own midi controller and speakers etc.):

Reface CP

My question is — does anyone know if it is possible to open Pianoteq into a specific instrument / preset / patch via a script (specifically within linux / pi os)? I'd like to have one script (shell script?) that opens into the Rhodes, one that opens into a Piano, etc.

Thanks

Last edited by tedp (18-01-2024 16:11)

Re: Automatically load specific instrument with Raspberry Pi shell script?

I’m not at my computer right now but I think you can pass “—help” without the quotes into the executable at the command line to see what commands are available.

I know you can start Pianoteq in server mode and send requests to switch pianos.

Last edited by stephenll (18-01-2024 21:39)

Re: Automatically load specific instrument with Raspberry Pi shell script?

Ah thanks, that's exactly what I needed. Sure enough, it can be done. Here's the --help info:

```
Copyright (c) 2023 Modartt.
Options from command-line:
--help             : show this help, and quit
--version          : show current version number and date, and quit
--no-prefs         : start Pianoteq without using any saved preference
--no-audio-prefs   : start Pianoteq with a clean audio/midi configuration
--prefs FILENAME   : stores the preferences in the specified file
--fxp FILENAME     : load an FXP file on startup
--preset NAME      : load a preset on startup
--list-presets     : display the list of all presets
--midimapping NAME : load a midimapping preset on startup
--midi-channel CH  : listen only to MIDI events on the specified channel (1<=value<=16 or 'all')
--midi-transpose x : transpose note events by the specified amount (-36<=x<=36)
--midi FILENAME    : load a midi file, or a *.m3u playlist content. If filename is a folder,
                      the midi files contained in that folder
--open file1 file2 ...     : load files, which can be midi, fxp, mfxp, ptq, scl or kbm files.
                      Must be used as the *last* option
--wav FILENAME     : export midi file as WAV file, and quit
--flac FILENAME    : export as FLAC
--mp3 FILENAME     : export as MP3
--rate FREQ        : change the sample rate for the exported wav
--bit-depth D      : change the bit-depth for the exported wav (16,24 or 32)
--dither ON/OFF    : turn dithering when exporting on or off
--normalize        : turn on volume normalization for the exported wav
--normalize-db DB  : change the normalization level (default value is -1dB)
--mono             : export the wav file as mono
--headless         : do not show the graphical interface
--fullscreen       : start in fullscreen mode
--export-lv2-presets PATH : export all presets as LV2 presets
--export-lv2-presets-std  : export lv2 preset to their default location, which is:
                    /home/tedpower/.lv2/
--export-presets-filter all|builtin|ptq|user : select which presets are exported, default is 'builtin'
--restore-windows  : restore the a previously saved set of windows
--do-not-block-screensaver : prevent Pianoteq from keeping the screen on
--quiet            : be less verbose
--play             : immediately start playing the midi file
--play-and-quit    : start playing the midi file, and quit when it ends
--serve [IP:]PORT  : start a JSON-RPC server for remote control of Pianoteq.
                      When using --serve "" , the server listens on localhost:8081

Example of use: Pianoteq --preset "U4 Small" --midi foo.mid --wav foo.wav
```