jxmorris12 / synthviz

visualize MIDI files from piano MIDI or audio
12 stars 1 forks source link

keys selection feature #2

Open sugizo opened 10 months ago

sugizo commented 10 months ago

background piano have several keyboard (keys) :

49 Keys 61 Keys 76 Keys 88 Keys etc

nice to have piano keys selection feature e.g. for 88 Keys create_video('river.midi', 88_keys)

best regards

sugizo commented 10 months ago

trying to modify your code to change into 24 keys (for learning purpose just set 2 octave),

synthviz/main.py

#width_per_white_key = image_width / 52
width_per_white_key = image_width / 18 # 2 octaves to make it bigger keys

and

#for i in range(21, 109):
for i in range(24, 48): # 2 octaves

but no luck for the visual of note sound,
no error occured but the result it's not expected the sound is correct, but the visual key_pressed and note_falling is wrong,

1st attempt (trying to show the chord in clef f) e.g. c major chord (note : c2, e2, g2), result it goes to second octave (after green line on picture below)

expected result on 1st attempt it goes to first octave (after red line on picture below)

2nd attempt (trying to show the scale in clef g)
e.g. c major scale (note : c4, d4, e4, f4, g4, a4, b4, c5), result it not shown on 24 keys

expected result on 2nd attempt it goes to first octave for c4, d4, e4, f4, g4, a4, b4 (after red line on picture below) and c5 (after green line on picture below)

image

best regards

jxmorris12 commented 10 months ago

Sorry that a lot of the values are hardcoded for a standard 88-key piano. I agree this would be really nice – hope you keep working on it!