analitics

Pages

Saturday, December 17, 2022

Python 3.10.2 : Suite for Computer-Assisted Music in Python known as SCAMP.

SCAMP is an computer-assisted composition framework in Python designed to act as a hub, flexibly connecting the composer-programmer to a wide variety of resources for playback and notation. SCAMP allows the user to manage the flow of musical time, play notes either using FluidSynth or via MIDI or OSC messages to an external synthesizer, and ultimately quantize and export the result to music notation in the form of MusicXML or Lilypond. Overall, the framework aims to address pervasive technical challenges while imposing as little as possible on the aesthetic choices of the composer-programmer.
Let's install with pip3 python tool in Windows O.S..
pip3 install --user scamp
I created a python script named music001_test001.py with this source code:
from scamp import *
import random

s = Session()

guitar = s.new_part("Guitar")

text = "this is a test text"

for char in text:
    if char == " ":
        wait(0.2)
    elif char.isalnum():
        for x in range (0,10):
            guitar.play_note(ord(char) - random.randrange(50, 75), random.randint(0,5), random.random()/5)
    else:
        wait(0.2)
        guitar.play_note(ord(char), 0.8, 0.06)
        wait(0.2)
The source code is easy to understand. I use random to play into for loop.
I play these with preset Jazz Guitar for Guitar.
I could say that the result is quite good for the random function.
In my internet searches, I also found a rather interesting PDF file about this Python module and other enhancements. You can find it here.