Hello to whom it may concern.
Hello My name is Dion Marinos
I have been a musician now for almost 40 years and now.
imdb link below.
for the last 18 months I have been getting into python coding.
As a python newb I have been working on a midi generator that generates midi
and places them in a folder of my choice on my computer.
As time went on my midi generator has become quite powerful as I continue to program my understanding of musical theory into the code.
Now this has nothing to do with AI as I know there are a lot of ai music generator coming onto the scene.
So this brings me to the question. I have been thinking about developing my app further to making it a service for other musicians around the world.
But I have no idea how how I would alter the code so as to have the midi file generated to the anvil website instead of my computer.
So right now the midi generator will make the midi file and place it in a folder on my computer , but if I use the anvil web site to run my app where would the midi file go ? A user logging into the site would be able to click a simple button then a file would be generated and made available for download.
Here is a simple script that would create a midi file and place it into a folder.
import os
import mido
from mido import Message, MidiFile, MidiTrack
def create_midi(folder_path, filename, ticks_per_note):
# Define the Ionian scale (C Major for simplicity)
ionian_scale = [60, 62, 64, 65, 67, 69, 71, 72] # MIDI notes for C4 to C5
# Create a new MIDI file and a track
mid = MidiFile()
track = MidiTrack()
mid.tracks.append(track)
# Add notes to the track
for note in ionian_scale:
# Note on
track.append(Message('note_on', note=note, velocity=64, time=0))
# Note off (after the specified number of ticks)
track.append(Message('note_off', note=note, velocity=64, time=ticks_per_note))
# Save the MIDI file
os.makedirs(folder_path, exist_ok=True)
mid.save(os.path.join(folder_path, filename))
Usage
create_midi(râC:\Users\12369\PycharmProjects\midi soloâ, âionian_scale.midâ, 240)
If anyone has any Idea on how to proceed or any insight on how file storage to the anvil server via user downloadability works , your help would be appreciated
.