Create a randomly generated melody based on the chord-progression playing?

Are there any good tutorials, guides or examples that shows how to create a melody based on the current chord playing, with consideration to stuff like pauses and harmony, so that the melody doesn’t sound completely random? I know I sound pretty shallow in my request, but I am very new to programming and only have a simple knowledge of basic music theory.

Hi,

this comes up quite often in variants, so I’m repeating my answer from here:

https://www.listarc.bham.ac.uk/lists/sc-users-2019/msg66280.html

see the data sharing chapter of the Practical Guide

http://doc.sccode.org/Tutorials/A-Practical-Guide/PG_06g_Data_Sharing.html

here a more recent example from the list

https://www.listarc.bham.ac.uk/lists/sc-users-2019/msg65459.html

and three threads on the forum with related examples

There are countless other examples in the old archive if you search “data sharing”

https://www.listarc.bham.ac.uk/lists/sc-users-old/search/

In any case note the time-shift, which is necessary in most examples for order of execution.