AM Posted September 6, 2019 Share Posted September 6, 2019 dear all is there a quick way to import (or filter) only pitches and chords from a midi-file? if i only use these (nothing else from midi/xml) thanx for a hint andré JulioHerrlein and opmo 2 Quote Link to comment Share on other sites More sharing options...
JulioHerrlein Posted September 6, 2019 Share Posted September 6, 2019 Yes, interesting. And importing MusicXML is also important and desirable. Quote Link to comment Share on other sites More sharing options...
opmo Posted September 6, 2019 Share Posted September 6, 2019 Not directly. First you need to import the midi file to score and then extract the pitches with OMN function. I like the idea, maybe we will add this functionality in the future. JulioHerrlein 1 Quote Link to comment Share on other sites More sharing options...
AM Posted September 7, 2019 Author Share Posted September 7, 2019 oh, this was simple here is a small program, it works... (defun get-pitch-from-midi (midipath) (loop for i in (flatten (compile-score (midi-to-score midipath) :output :score)) when (or (chordp i) (pitchp i)) collect i)) (get-pitch-from-midi "path/filename") also with length?! (defun get-length-from-midi (midipath) (loop for i in (flatten (compile-score (midi-to-score midipath) :output :score)) when (and (lengthp i) (not (integerp i))) collect i)) (get-length-from-midi "path/filename") but will not work with more then one voice / its not necessary for MY needs, so i coded only this simple solution - perhaps janusz will do it? Quote Link to comment Share on other sites More sharing options...
opmo Posted September 7, 2019 Share Posted September 7, 2019 What you are doing Andre is quite bad and unsafe. I made already a function for it and it will be part of the next release: (setf 000504b "~/Opusmodus/Media/MIDI/Bach/Chorals/000504b_") (midi-to-omn 000504b :instrument 1) => ((-e g4 ff e. b4 s c5 e d5 f4 ab4 g4) (q e4 -s e4 g4 c4 e f4 ab4 ab4 f4) (e db4 db4 - c4 bb4 bb4 db5 c5) (e ab4 ab4 -s c4 f4 g4 e ab4 f4 e. b4 s c5) (q d5 -e g4 c5 a4 e. gb4 s g4) (e g4 d4 -h -e bb4) (e. bb4 s f4 e e g4 ab4 f4 d5 f4) (e eb4 c4 - c4 bb4 s c5 db5 -e c5) (q a4 -e bb4 bb4 g4 eb4 g4) (q ab4 -e eb4 s db5 bb4 e c5 - eb4) (e eb4 bb3 -q. e g4 bb4 eb4) (e ab4 -s f4 e d5 f4 q eb4 -e c4) (e. g4 s a4 bb4 bb4 bb4 c5 q db5 -e c5) (e a4 a4 c5 f4 ab4 ab4 b3 d4) (e f4 f4 - d4 g4 c4 e. b4 s c5) (e c5 g4)) (midi-to-omn 000504b :type :pitch :instrument 2) => ((c5 c5 d5) (eb5 f5 g5) (g5) (g5 f5 eb5 eb5) (d5) (d5) (eb5 f5 g5 g5) (f5 g5 g5) (eb5 f5 g5 g5) (f5 eb5) (g5) (bb5 g5 g5 g5) (f5 f5 f5) (g5 f5 eb5 f5) (d5 c5)) (midi-to-omn 000504b :type :length :instrument 2) => ((-1) (-1/4 1/4 1/4 1/4) (1/4 1/4 1/2) (-3/4 1/4) (1/4 1/4 1/4 1/4) (1/2 -1/2) (-3/4 1/4) (1/4 1/4 1/4 1/4) (1/2 1/4 1/4) (1/4 1/4 1/4 1/4) (1/2 1/4 -1/4) (-3/4 1/4) (1/4 1/4 1/4 1/4) (1/2 1/4 1/4) (1/4 1/4 1/4 1/4) (1/2 1/2)) (midi-to-omn 000504b :type :pitch) => (((g4 b4 c5 d5 f4 ab4 g4) (e4 e4 g4 c4 f4 ab4 ab4 f4) (db4 db4 c4 bb4 bb4 db5 c5) (ab4 ab4 c4 f4 g4 ab4 f4 b4 c5) (d5 g4 c5 a4 gb4 g4) (g4 d4 bb4) (bb4 f4 f4 g4 ab4 f4 d5 f4) (eb4 c4 c4 bb4 c5 db5 c5) (a4 bb4 bb4 g4 eb4 g4) (ab4 eb4 db5 bb4 c5 eb4) (eb4 bb3 g4 bb4 eb4) (ab4 f4 d5 f4 eb4 c4) (g4 a4 bb4 bb4 bb4 c5 db5 c5) (a4 a4 c5 f4 ab4 ab4 b3 d4) (f4 f4 d4 g4 c4 b4 c5) (c5 g4)) ((c5 c5 d5) (eb5 f5 g5) (g5) (g5 f5 eb5 eb5) (d5) (d5) (eb5 f5 g5 g5) (f5 g5 g5) (eb5 f5 g5 g5) (f5 eb5) (g5) (bb5 g5 g5 g5) (f5 f5 f5) (g5 f5 eb5 f5) (d5 c5)) ((b2) (bb2 ab2 f2) (g2 ab2 e2) (d2) (b2 c3) (d3 g2) (d3 b2) (c3 ab3 e3) (eb3 d3 db3) (c3 b2 bb2 a2) (bb2 eb2) (b2 c3) (db3 e2) (eb2 d2) (b2 c3 ab2) (gb2 g2 c2))) (midi-to-omn 000504b) => (((-e g4 ff e. b4 s c5 e d5 f4 ab4 g4) (q e4 -s e4 g4 c4 e f4 ab4 ab4 f4) (e db4 db4 - c4 bb4 bb4 db5 c5) (e ab4 ab4 -s c4 f4 g4 e ab4 f4 e. b4 s c5) (q d5 -e g4 c5 a4 e. gb4 s g4) (e g4 d4 -h -e bb4) (e. bb4 s f4 e e g4 ab4 f4 d5 f4) (e eb4 c4 - c4 bb4 s c5 db5 -e c5) (q a4 -e bb4 bb4 g4 eb4 g4) (q ab4 -e eb4 s db5 bb4 e c5 - eb4) (e eb4 bb3 -q. e g4 bb4 eb4) (e ab4 -s f4 e d5 f4 q eb4 -e c4) (e. g4 s a4 bb4 bb4 bb4 c5 q db5 -e c5) (e a4 a4 c5 f4 ab4 ab4 b3 d4) (e f4 f4 - d4 g4 c4 e. b4 s c5) (e c5 g4)) ((-w) (-q c5 ff c5 d5) (q eb5 f5 h g5) (-h. q g5) (q g5 f5 eb5 eb5) (h d5 -) (-h. q d5) (q eb5 f5 g5 g5) (h f5 q g5 g5) (q eb5 f5 g5 g5) (h f5 q eb5 -) (-h. q g5) (q bb5 g5 g5 g5) (h f5 q q) (q g5 f5 eb5 f5) (h d5 c5)) ((w b2 ff) (h bb2 q ab2 f2) (q g2 ab2 h e2) (w d2) (h b2 c3) (-q d3 h g2) (h d3 b2) (q c3 ab3 h e3) (q eb3 d3 h db3) (q c3 b2 bb2 a2) (-q bb2 h eb2) (h b2 c3) (h db3 e2) (h eb2 d2) (h b2 q c3 ab2) (q gb2 g2 h c2))) (midi-to-omn 000504b :instrument 1 :bars '(1..4)) => ((-e g4 ff e. b4 s c5 e d5 f4 ab4 g4) (q e4 -s e4 g4 c4 e f4 ab4 ab4 f4) (e db4 db4 - c4 bb4 bb4 db5 c5) (e ab4 ab4 -s c4 f4 g4 e ab4 f4 e. b4 s c5)) Janusz Stephane Boussuge 1 Quote Link to comment Share on other sites More sharing options...
AM Posted September 7, 2019 Author Share Posted September 7, 2019 "What you are doing Andre is quite bad and unsafe" very friendly, your answer ...and i knew that, but i didn't found some hints (jn the tutorials) how to extract OMN from def-score. of course it is not good, but it took me only 2 minutes to briefly the problem for my specific application. i have not written any official opusmodus-function (which can do anything) but a simple solution which helps me. Quote Link to comment Share on other sites More sharing options...
opmo Posted September 7, 2019 Share Posted September 7, 2019 The midi system and the conversion to score is very complex indeed. There is not an easy solutions to extract individual midi instruments (tracks). Anyway, it is done MIDI-TO-OMN and hopefully useful to others. "What you are doing Janusz is quite bad and unsafe" - I heard this very often and still I am, it is part of programming loopyc 1 Quote Link to comment Share on other sites More sharing options...
Stephane Boussuge Posted September 8, 2019 Share Posted September 8, 2019 midi-to-omn will be super useful for me, thanks ! Stéphane JulioHerrlein and torstenanders 2 Quote Link to comment Share on other sites More sharing options...
AM Posted September 15, 2019 Author Share Posted September 15, 2019 dear janusz when will be the next update (with midi-to-omn)? and it would be also nice to GET from midi: bpm duration (of the whole midi, as a result of tempo/bpm and the lengths/rests) ...if possible... thanx a. Quote Link to comment Share on other sites More sharing options...
opmo Posted September 16, 2019 Share Posted September 16, 2019 Shortly. JulioHerrlein and AM 1 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.