Created
June 13, 2020 22:06
-
-
Save jedberg/37e9680806bc517925daeaae4798eb9e to your computer and use it in GitHub Desktop.
Make a random music URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import random | |
import sys | |
base_url="https://music-grid.surge.sh/#" | |
def make_notes(rows=10): | |
notes_string = "" | |
# for each row... | |
for i in range(rows): | |
# build a list of all possible values for a row | |
# seperated out so you can add bias if desired | |
note_choices = range(2049) | |
# make a series of random notes | |
notes_string = notes_string + str(random.choice(note_choices)) + "-" | |
return notes_string | |
def make_url(rows=10, beats="200"): | |
return base_url + make_notes(rows) + "&" + beats | |
if __name__ == "__main__": | |
rows=10 | |
beats="200" | |
if len(sys.argv) > 1: | |
rows = int(sys.argv[1]) | |
if len(sys.argv) > 2: | |
beats = str(sys.argv[2]) | |
print(make_url(rows=rows, beats=beats)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment