Hi, everyone (and of course @MarcEvanstein).
As I slowly learn Python and SCAMP, I challenge myself to write code to use some of the things I’ve learned to that point.
Marc’s YT videos have been invaluable. His clear, step-by-step instructions are excellent. A 10-minute video takes me several days to complete because I like to duplicate then experiment beyond what he is teaching.
As I watched Marc’s video on fork() and how it works, I created the attached code. Every time you run it, you’ll get a different result, and you can change lots of parameters to tailor the sound any way you want.
I’ve included lots of explanations and comments, which I encourage you to read. I’m hoping it’s clear enough for you to make changes to experiment.
This is a short example of a few things I’ve learned in just 3-4 weeks with SCAMP and Python.
PlayMelody.py (8.6 KB)
David Collett
Seattle
1 Like
I haven’t had time to dig through the code, but the musical result is very cool, and has interesting variety each time!
@MarcEvanstein Thanks for trying it. I’d love any comments you have to make it more efficient or other parameters I could pass to make it more versatile. SCAMP is such an amazing python module. Thanks SO much for creating it. Every day, I’m learning something new.
However, I just got a new M2 Mac yesterday, and many of the other python modules aren’t working now (such as abjad) 
—————
UPDATE: Good news! I finally got fluid-synth, abjad, Lilypond, and everything else working again. I’m not sure of the exact sequence in which I did these steps, but here’s how I got everything working fine on an M2 Mac:
-
deleted abjad and fluidsynth using Thonny
-
in Terminal, uninstalled fluidsynth
-
put Thonny and Terminal in Rosetta mode (in their Get Info windows)
-
used homebrew to install fluid-synth
-
used Thonny to install abjad 3.4
-
restarting Thonny
Now everything is working smoothly as it did on my Intel Mac.
Side note: in one of my programs, I also got error messages that it couldn’t find Numpy and mathplotlib, so I uninstalled/reinstalled those in Thonny, and they worked.
Thanks, @MarcEvanstein for helping me with fluid-synth.