Coder Social home page Coder Social logo

musicscore's Introduction

musicscore

Tested with python 3.9, 3.10 and 3.11

musicscore is a python library for generating musicxml data in an intuitive and easy but nevertheless comprehensive way. The generated files can be imported in several music notation programs and be processed further if necessary. The preferred software is Finale which seems at the moment to have the best implementation of musicxml format files and supports version 4.0.

For documentation see: https://musicscore.readthedocs.io

The project can be found on GitHub under: https://github.com/alexgorji/musicscore

musicscore can be installed via pip:

(.venv) $ pip install musicscore

musicxml can also be found in a separate repository under: <https://github.com/alexgorji/musicxml> and be installed via pip:

(.venv) $ pip install musicxml

musicscore's People

Contributors

alexgorji avatar farhadilaghihosseini avatar kisp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

musicscore's Issues

Does not build on Python3.11

Hi,
This is more of a heads-up than a bug. This module does not build on Python 3.11. It doesn't seem to be a problem with this module at all, but with the quicktions dependency, which does not appear to support 3.11 at this time.

Thanks,

Paul

Staff attribute not created during `part.add_chord()`

I was following the tutorial examples. Example 2 claims that the exact same XML is generated as Example 1. However, I noticed a difference when doing a diff between the two XMLs, being that the staff parent is not present on the note in Example 2's XML (see below the last diff line; the other diffs are expected e.g. HW1 vs. HW2).

Screenshot 2024-01-27 at 7 14 00 pm

I looked at the expectation in https://github.com/alexgorji/musicscore/blob/master/musicscore/tests/test_part.py#L357 and just wanted to confirm that this is expected? If so, why would the staff attribute not be present on the note? If not expected, I am happy to help fix the issue.

`import musictree` fails with UnicodeDecodeError

I'm testing on Debian 11, pypy.

$ pypy --version
Python 3.7.10 (7.3.5+dfsg-2+deb11u2, Nov 01 2022, 20:16:36)
[PyPy 7.3.5 with GCC 10.2.1 20210110]

I installed pypy-dev, pypy3-dev (required to find Python.h) and after the installation I got this:

$ python
Python 3.7.10 (7.3.5+dfsg-2+deb11u2, Nov 01 2022, 20:16:36)
[PyPy 7.3.5 with GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>> import musictree
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/maciej/src/pypy/site-packages/musictree/__init__.py", line 1, in <module>
    from musictree.accidental import *
  File "/home/maciej/src/pypy/site-packages/musictree/accidental.py", line 3, in <module>
    from musicxml.xmlelement.xmlelement import XMLAccidental
  File "/home/maciej/src/pypy/site-packages/musicxml/xmlelement/xmlelement.py", line 10, in <module>
    from musicxml.generate_classes.utils import musicxml_xsd_et_root, ns
  File "/home/maciej/src/pypy/site-packages/musicxml/generate_classes/utils.py", line 11, in <module>
    musicxml_et_tree = ET.parse(file)
  File "/usr/lib/pypy3/lib-python/3/xml/etree/ElementTree.py", line 1197, in parse
    tree.parse(source, parser)
  File "/usr/lib/pypy3/lib-python/3/xml/etree/ElementTree.py", line 601, in parse
    data = source.read(65536)
  File "/usr/lib/pypy3/lib-python/3/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 311: ordinal not in range(128)

I didn't do a deeper dive on this, just recording that there seems to be a problem.

Error during first use of library after installing with pip on python3.10

When I first tried to use this library after I installed it with pip I got the following error:

File "/lib/python3.10/site-packages/musicxml/xmlelement/xmlchildcontainer.py", line 399, in add_element
    self.reset_frozen()
AttributeError: 'XMLChildContainer' object has no attribute 'reset_frozen'

I worked around it by commenting out line 399 in the specified python script.
It would be cool to fix this issue though, so there's no need to comment out the line every time after a fresh install of the library.

Add: Chord.break_beam()

For example needed for melismata (see: LilyPondUnofficialXMLTestSuite/test_61h_Lyrics_BeamsMelismata.py)

Nested Tuplets

We need a bit more information in the Tuplet class to allow nested tuplet, such as tuplet type and an id number

as in:


<note>
 <pitch>...</pitch>
 <duration>...</duration>
 <time-modification>
   <actual-notes>3</actual-notes>
   <normal-notes>2</normal-notes>
 </time-modification>
 <notations>
   <tuplet type="start" number="1"/>
 </notations>
</note>

<!-- Inner Tuplet Start -->
<note>
 <pitch>...</pitch>
 <duration>...</duration>
 <time-modification>
   <actual-notes>5</actual-notes>
   <normal-notes>4</normal-notes>
 </time-modification>
 <notations>
   <tuplet type="start" number="2"/>
 </notations>
</note>
<!-- More notes of the inner tuplet -->
<note>
 <!-- Note details -->
 <notations>
   <tuplet type="stop" number="2"/>
 </notations>
</note>
<!-- Inner Tuplet End -->

<!-- More notes of the outer tuplet -->
<note>
 <!-- Note details -->
 <notations>
   <tuplet type="stop" number="1"/>
 </notations>
</note>

Allow for public cloning of the repo including submodules

Public cloning of the repo currently fails. Let's make this work :)

[vagrant@arch ~]$ git clone --recursive https://github.com/alexgorji/musicscore.git
Cloning into 'musicscore'...
remote: Enumerating objects: 5488, done.
remote: Counting objects: 100% (933/933), done.
remote: Compressing objects: 100% (329/329), done.
remote: Total 5488 (delta 755), reused 711 (delta 598), pack-reused 4555
Receiving objects: 100% (5488/5488), 15.06 MiB | 11.26 MiB/s, done.
Resolving deltas: 100% (4241/4241), done.
Submodule 'musicxml' ([email protected]:alexgorji/musicxml.git) registered for path 'musicxml'
Cloning into '/home/vagrant/musicscore/musicxml'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:alexgorji/musicxml.git' into submodule path '/home/vagrant/musicscore/musicxml' failed
Failed to clone 'musicxml'. Retry scheduled
Cloning into '/home/vagrant/musicscore/musicxml'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:alexgorji/musicxml.git' into submodule path '/home/vagrant/musicscore/musicxml' failed
Failed to clone 'musicxml' a second time, aborting

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.