5 ms·
Ask HN: Is there a OS tool which queries MIDI datasets by chord progression/key?
I'm about to build a MIDI data query tool if it doesn't already exist. I need a simple tool that brute-force searches midi clips from public domain datasets. For example, I want to say my progression is in `C - 4/4 - Am7-Am7-G7-Dm7` And the system offers midi clips that match that exact criteria.
ps - I'm fully aware of generative music AIs (in fact I maintain one: https://signalsandsorcery.org/ , but in this case I'm interested in brute-force searching datasets.
- sargstuff 4y agoSome combination/variation from command line of grep/sed/awk script(s) using regular expressions & local file(s)/db containing relevant dataset(s) to search. example unix shell command line: cat midi.data.file | grep 'C - 4/4 - Am7-Am7-G7-Dm7' Pearl / python / ruby / go / lisp shell etc. make for easier paring with gui & on-line use of public domain datasets (vs. downloading dataset file/db)
- stevehiehn 4y agoPretty sure I know how to build it I just don't want to have to LOL. MIDI isn't text. You have to use something like: https://pypi.org/project/MIDIUtil/ https://pypi.org/project/MIDIUtil/ to go inside the midi file and read the notes which match the criteria, then generate a new midi clip that matches the query.
- sargstuff 4y agoOld school programmer, of the mind set of DIY/roll own tool. My experience/backround: pipy / python is more complex setup than using midi2tex,awk to format for grep search. Awk typically used to convert files between formats. There are readily available midi to text conversion tool(s) finable via a search engine. In this case, using awk to convert midi file to text format (or make use of a format from a midi to text tool) that can be use with grep would be the implied step.
- sargstuff 4y agomidi2text dumped format that can be piped to jq to use jq search functions might be what looking for.
- stevehiehn 4y agoAh, I see what you are saying. Just tried some midi to text tools I get results like: "0 On ch=1 n=44 v=118 138 Off ch=1 n=44 v=0 240 On ch=1 n=46 v=63 377 Off ch=1 n=46 v=0 ..." Which is cool, but from there I still need a layer to interpret the raw MIDI instruction into tonal harmony so a musician could query chords etc (i.e Cm9-G7-Bbmaj7), and thats where the midi to harmony libs come in
- sargstuff 4y agoSimilar to what a multi-pass programming language compiler does. at each step, cololess things into groups, until reach appropriate level of usefullness. 1) pull out the midi notes (ideally with some way to tag as a visual vertical group). 2) Regular expression pattern match/convert verticals to chord 3) Repeat with chord groupings & which groups looking for. Ummm.... midi 2 nyquest 2 python AI automation starting to sound like a more rational way to go. ;)
- sargstuff 4y agomidi2tones [1] can generate a streem of note sequences which can be awk/grep'd/reg-expression searched. Midi 2 Nyquest[2] dumped to python AI used to visual identify requested cord progression (aka automate what a human reading a musical score would do) would be pretty cool (get location & stats of where progression occures) ------ [1] nyquest : https://en.wikipedia.org/wiki/Nyquist https://en.wikipedia.org/wiki/Nyquist [2] midi2tones : https://github.com/MLXXXp/midi2tones/blob/master/midi2tones.c https://github.com/MLXXXp/midi2tones/blob/master/midi2tones....
- stevehiehn 4y agonice, gonna play with midi2tones, thanks
- thesnide 4y agothere is also midicsv that unlocks all the excel macros on midi data. And SQL/OLAP if you are so inclined. https://www.fourmilab.ch/webtools/midicsv/ https://www.fourmilab.ch/webtools/midicsv/
- LunarAurora 4y agoThe crucial step is extracting the (best) harmony progression from each midi. Look at Chordino [1] with the vamp Python wrapper [2] [1] https://code.soundsoftware.ac.uk/projects/nnls-chroma https://code.soundsoftware.ac.uk/projects/nnls-chroma [2] https://pypi.org/project/vamp/ https://pypi.org/project/vamp/
- stevehiehn 4y agonice, both of these are very cool, thanks. digging in now.
- LunarAurora 4y agoFYI MetaMIDI Dataset is the best (I found). you can request access here https://zenodo.org/record/5142664 https://zenodo.org/record/5142664 if you haven’t already. Lakh MIDI Dataset https://colinraffel.com/projects/lmd https://colinraffel.com/projects/lmd is smaller but directly downloadable
- stevehiehn 4y agoI haven't but I will, really useful stuff, thanks
- stevehiehn 4y agoyo, correction vamp is more than cool. I was imagining already knowing what the progression is and then searching for matching midi clips. Vamp alludes to the possibility of auto feature extracting the progression and then searching for possible matches!!
- sargstuff 4y agomisc mix of other things (theory & practice): https://www.cnmat.berkeley.edu/sites/default/files/attachments/2016_Learning_and_Visualizing_Music_Specifications_Using_Pattern_Graphs.pdf https://www.cnmat.berkeley.edu/sites/default/files/attachmen... https://openaccess.city.ac.uk/id/eprint/1306/1/Wissmann%2C_Jens.pdf https://openaccess.city.ac.uk/id/eprint/1306/1/Wissmann%2C_J... https://extemporelang.github.io/docs/guides/pattern-language/ https://extemporelang.github.io/docs/guides/pattern-language... https://github.com/topics/chord-progression https://github.com/topics/chord-progression
- peterkos 4y agoA little manual, but music21[0] can do the analysis! [0]: http://web.mit.edu/music21/ http://web.mit.edu/music21/
- stevehiehn 4y agomanual is ok, very useful thanks
- stevehiehn 4y agoJust to follow up: I started building a python CLI tool. I'm only 2 days in but the 'happy path' is working: https://github.com/shiehn/midi_query https://github.com/shiehn/midi_query