Yikai-Liao / symusic

A cross platform note level midi decoding library with lightening speed, based on minimidi.
https://yikai-liao.github.io/symusic/
MIT License
108 stars 8 forks source link

Experimental ABC support #21

Closed Yikai-Liao closed 5 months ago

Yikai-Liao commented 5 months ago

We add an experimental abc notation support using abcmidi project. you could load it by

Score("xxx.abc")
Score("xxx.txt", fmt="abc")

Score.from_file("xxx.abc")
Score.from_file("xxx.txt", fmt="abc")

Score.from_abc("you abc notation")

The 2 clis we need are precompiled with the package, and stored in symusic/bin

Yikai-Liao commented 5 months ago

@Natooz I add abc2midi and midi2abc cli to support abc format, and they were put into the symusic/bin folder.

They work well for normal installation, pip install .

But in the test, it seems these two clis are not put into the right folder. I have tried to remove -e and add rm -rf symusic. But the test still failed.

Can you help me figure out how to fix this?

Natooz commented 5 months ago

I tried locally (macOS) and it works as it should (installing without -e then renaming ./symusic).

I'm not sure why it's failing here. The issue occurs when importing symusic.Score, a temporary path seems to be created. '/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/symusic/tmp' https://github.com/Yikai-Liao/symusic/actions/runs/7586422609/job/20664542580?pr=21#step:5:106

Do you know what is its purpose ?

Yikai-Liao commented 5 months ago

Since abc2midi and midi2abc are 2 cli programs, I need to store some temporarily midi and abc files.

(abcmidi project uses gpl v2 license while symusic uses mit license. It means I can't use it as a static lib, )

Currently, I store them in the tmp dir I created in factory.py. @lzqlzzq told me that I could directly use the system's tmp directory, and I'll try this.

Natooz commented 5 months ago

The system’s tmp directory would probably be a better option, as it would avoid to write things in the python lib directory. Also here you could probably use the exist_ok=True argument when creating the directory, it could maybe make the tests pass