Run as Server and Render Scores

Example script (scamp): examples/Notation & engraving/From live input/run_as_server_render_scores.py

Download: run_as_server_render_scores.py

Runs the session as a server, repeatedly recording short fragments and popping up a score for each.

Topics: Notation & engraving › From live input

Score #1
score
Score #2
score
Score #3
score
import random
import time
from scamp import *

s = Session().run_as_server()

piano = s.new_part("piano")


def some_music():
    for _ in range(6):
        piano.play_note(random.randint(60, 70), 1.0, random.choice([0.5, 1.0, 1.5]))


score_num = 1

for _ in range(3):
    # wait some random length of time
    time.sleep(random.uniform(1, 3))
    s.start_transcribing()
    s.fork(some_music)
    time.sleep(8)
    performance = s.stop_transcribing()
    performance.to_score(title=f"Score #{score_num}").show()
    score_num += 1