-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsimple_host.py
37 lines (26 loc) · 919 Bytes
/
simple_host.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import argparse
from pyvst import SimpleHost
def _print_params(vst, max_params=10):
"""Prints the parameters of a VST with its current value."""
for i in range(min(vst.num_params, max_params)):
print('{}: {}'.format(
vst.get_param_name(i),
vst.get_param_value(i),
))
def main(vst_filename):
host = SimpleHost(vst_filename, sample_rate=48000.)
_print_params(host.vst)
sound = host.play_note(note=64, note_duration=1.)
print(sound)
print(sound.shape)
host.vst.set_param_value(index=0, value=1.)
host.vst.set_param_value(index=1, value=0.5)
_print_params(host.vst)
sound = host.play_note(note=64, note_duration=1.)
print(sound)
print(sound.shape)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('vst', help='path to .so file')
args = parser.parse_args()
main(args.vst)