[Python-modules-commits] [mmllib] 01/12: Import orig tgz.

Dominik George natureshadow-guest at moszumanska.debian.org
Sun Jan 29 13:33:41 UTC 2017


This is an automated email from the git hooks/post-receive script.

natureshadow-guest pushed a commit to branch master
in repository mmllib.

commit 85062e9538b4cfc7ffb0cc5212aacced3838e3f3
Author: Dominik George <nik at naturalnet.de>
Date:   Sun Jan 29 13:39:35 2017 +0100

    Import orig tgz.
---
 CHANGELOG.rst                        |  21 ++
 LICENCE                              |  23 ++
 MANIFEST.in                          |   6 +
 MMLFILE.rst                          |  89 ++++++
 MMLlib.egg-info/PKG-INFO             | 193 ++++++++++++
 MMLlib.egg-info/SOURCES.txt          |  27 ++
 MMLlib.egg-info/dependency_links.txt |   1 +
 MMLlib.egg-info/entry_points.txt     |   4 +
 MMLlib.egg-info/not-zip-safe         |   1 +
 MMLlib.egg-info/top_level.txt        |   1 +
 PKG-INFO                             | 193 ++++++++++++
 README.rst                           |  60 ++++
 examples/alle_meine_entchen.mml      |   4 +
 examples/bruder_jakob.mml            |  22 ++
 examples/loreley.mml                 |  73 +++++
 mmllib/__init__.py                   |   0
 mmllib/cmds.py                       |  88 ++++++
 mmllib/mml.py                        | 284 ++++++++++++++++++
 mmllib/musicxml.py                   | 384 ++++++++++++++++++++++++
 mmllib/parser.py                     | 122 ++++++++
 mmllib/playlist.py                   | 231 +++++++++++++++
 setup.cfg                            |   5 +
 setup.py                             |  76 +++++
 test/__init__.py                     |   0
 test/data/loreley.xml                |   1 +
 test/test_musicxml.py                |  43 +++
 test/test_parser.py                  | 559 +++++++++++++++++++++++++++++++++++
 test/test_playlist.py                | 398 +++++++++++++++++++++++++
 test/util.py                         |  27 ++
 29 files changed, 2936 insertions(+)

diff --git a/CHANGELOG.rst b/CHANGELOG.rst
new file mode 100644
index 0000000..cae7339
--- /dev/null
+++ b/CHANGELOG.rst
@@ -0,0 +1,21 @@
+Changelog for MMLlib
+====================
+
+0.3
+---
+
+-  Enable Python 3 compatibility.
+-  Add new mmllint script.
+-  Include example MML songs.
+-  Add first parts of test suite.
+-  Some bugfixes.
+
+0.2
+---
+
+-  Add mml2musicxml script.
+
+0.1
+---
+
+-  Separate from Floppi-Music.
diff --git a/LICENCE b/LICENCE
new file mode 100644
index 0000000..d171514
--- /dev/null
+++ b/LICENCE
@@ -0,0 +1,23 @@
+MMLlib is published under The MirOS Licence:
+
+Copyright © 2013, 2016
+	mirabilos <m at mirbsd.org>
+Copyright © 2013, 2016, 2017
+	Dominik George <nik at naturalnet.de>
+Copyright © 2013
+	Eike Tim Jesinghaus <eike at naturalnet.de>
+
+Provided that these terms and disclaimer and all copyright notices
+are retained or reproduced in an accompanying document, permission
+is granted to deal in this work without restriction, including un‐
+limited rights to use, publicly perform, distribute, sell, modify,
+merge, give away, or sublicence.
+
+This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
+the utmost extent permitted by applicable law, neither express nor
+implied; without malicious intent or gross negligence. In no event
+may a licensor, author or contributor be held liable for indirect,
+direct, other damage, loss, or other issues arising in any way out
+of dealing in the work, even if advised of the possibility of such
+damage or existence of a defect, except proven that it results out
+of said person’s immediate fault when using the work as intended.
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..1dbf062
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,6 @@
+include README.rst
+include CHANGELOG.rst
+include LICENCE
+include MMLFILE.rst
+recursive-include examples *
+recursive-include test *
diff --git a/MMLFILE.rst b/MMLFILE.rst
new file mode 100644
index 0000000..7d174c4
--- /dev/null
+++ b/MMLFILE.rst
@@ -0,0 +1,89 @@
+Description of the (extended) music macro language
+==================================================
+
+Based on http://www.antonis.de/qbebooks/gwbasman/play.html and
+https://www.mirbsd.org/man4/spkr .
+
+Symbols of MML
+--------------
+
+:A-G[#,+,-][length]:
+    A-G are notes. # or + following a note produces a sharp; - produces a
+    flat.
+
+:L(n):
+
+    Sets the length of each note. L4 is a quarter note, L1 is a whole note,
+    and so on. n may be from 1 to 64. Length may also follow the note to
+    change the length for that note only. A16 is equivalent to L16A. Default
+    is L4.
+
+:ML:
+    Music legato. Each note plays the full period set by L.
+
+:MN:
+    Music normal. Each note plays seven-eighths of the time determined by L
+    (length).
+
+:MS:
+    Music staccato. Each note plays three-quarters of the time determined by
+    L.
+
+:N(n):
+    Play note n. n may range from 0 to 84. In the 7 possible octaves, there
+    are 84 notes. n set to 0 (or omitted) indicates a rest.
+
+:O(n):
+    Octave 0 sets the current octave. There are 7 octaves (0 through 6).
+    Default is 4. Middle C is at the beginning of octave 2.
+
+:P(n):
+    Pause. n may range from 1-64; the current L value is used if omitted.
+
+:T(n):
+    Tempo. T sets the number of L4s in a minute. n may range from 32-255.
+    Default is 120.
+
+:. (period):
+    A period after a note increases the playing time of the note by 3/2
+    times the period determined by L (length of note) times T (tempo).
+    Multiple periods can appear after a note, and the playing time is scaled
+    accordingly. For example, A. will cause the note A to play one and half
+    times the playing time determined by L (length of the note) times T (the
+    tempo); two periods placed after A (A..) will cause the note to be
+    played at 9/4 times its ascribed value; an A with three periods (A...)
+    at 27/8, etc. Periods may also appear after a P (pause), and increase
+    the pause length as described above.
+
+:>:
+    A greater-than symbol raises the current octave by one.
+
+:<:
+    A less-than symbol lowers the current octave by one.
+
+:\|:
+    Optionally used as a synchronisation mark for multi-track music. This is
+    a proprietary extension in the Floppi-Music project.
+
+Comments
+--------
+
+Lines starting with # are comments. At the beginning of the file,
+comments may be used to encode metadata. This is yet to be specified.
+The current implementation parses key/value pairs separated by a colon
+and a space, strips both key and value, lower-cases the key and adds it
+to a dictionary.
+
+The MusicXML export currently specifically recognises these keys:
+
+-  Title, Copyright, Encoder (person), Source
+-  Composer, Lyrics, Arranger, Translator *xor* Artist (deprecated, only
+   one)
+
+Any other key is treated as miscellaneous field.
+
+Voices
+------
+
+The voices of a song are interleaved. They are grouped per notation
+system, and the notation systems are seperated by empty lines.
diff --git a/MMLlib.egg-info/PKG-INFO b/MMLlib.egg-info/PKG-INFO
new file mode 100644
index 0000000..77c4e02
--- /dev/null
+++ b/MMLlib.egg-info/PKG-INFO
@@ -0,0 +1,193 @@
+Metadata-Version: 1.1
+Name: MMLlib
+Version: 0.3.0.post1
+Summary: Modern library for handling Music Macro Language
+Home-page: http://github.com/Natureshadow/mmllib
+Author: Dominik George
+Author-email: nik at naturalnet.de
+License: MirOS
+Description: MMLlib - Modern library for handling Music Macro Language
+        =========================================================
+        
+        About
+        -----
+        
+        MMLlib is a pure Python implementation of functionality related to the
+        `Music Macro
+        Language <https://en.wikipedia.org/wiki/Music_Macro_Language>`__ as
+        implemented by Microsoft® GW-BASIC® and compatibles, which is its most
+        common form, also implemented by the PC speaker driver in Linux and
+        `BSD <http://www.mirbsd.org/man4/spkr>`__, with a number of extensions
+        and changes:
+        
+        -  ``|`` denotes a bar line, ignored by the Linux/BSD driver
+        -  support for multiple (parallel) instrument tracks
+        -  a per-file header with work metadata (optional)
+        -  lines starting with a ``#`` are comments
+        -  the alias ``~`` is not supported
+        
+        The library currently contains functions to:
+        
+        -  parse an (extended) MML file into metadata and individual tracks
+        -  a duration estimate and the number of tracks is added to the metadata
+        -  return a list of tuples (frequency, duration) to play (in a threaded
+           interpreter, such as Floppi-Music)
+        -  bar lines are indicated separately as integer ``1``
+        -  return an event-oriented list of measures / bars across all tracks;
+           each measure has a duration and a list of time-fixed tone on/off
+           events; facilitates playing in non-threaded interpreters and,
+           possibly, MIDI export
+        -  export (extended) MML to MusicXML
+        -  which can be imported by e.g. `MuseScore <https://musescore.org/>`__
+           to…
+        
+           -  double-check the MML score for mistakes in a visual representation
+           -  play, arrange, etc. the music
+           -  beautify the score to print it as sheet music
+           -  export into other formats or share on their website
+        
+        -  check tracks for synchronisation error
+        -  missing tracks, i.e. with 0 bars
+        -  missing bars (can only be detected at the end, of course)
+        -  missing notes within a bar, relative to other tracks
+        
+        Examples
+        --------
+        
+        Some example extended MML files are contained within the examples/
+        directory, in lieu of better documentation for the extended format, in
+        addition to the `MML format documentation
+        <http://www.mirbsd.org/man4/spkr>`__.
+        
+        Projects using MMLlib
+        ---------------------
+        
+        ::Floppi-Music::
+            `Floppi-Music <https://github.com/Natureshadow/Floppi-Music>`__ has
+            MML as input format for floppy drive music on Raspberry Pi and uses
+            MMLlib for processing. Floppi-Music is also the origin of MMLlib.
+        
+        Description of the (extended) music macro language
+        ==================================================
+        
+        Based on http://www.antonis.de/qbebooks/gwbasman/play.html and
+        https://www.mirbsd.org/man4/spkr .
+        
+        Symbols of MML
+        --------------
+        
+        :A-G[#,+,-][length]:
+            A-G are notes. # or + following a note produces a sharp; - produces a
+            flat.
+        
+        :L(n):
+        
+            Sets the length of each note. L4 is a quarter note, L1 is a whole note,
+            and so on. n may be from 1 to 64. Length may also follow the note to
+            change the length for that note only. A16 is equivalent to L16A. Default
+            is L4.
+        
+        :ML:
+            Music legato. Each note plays the full period set by L.
+        
+        :MN:
+            Music normal. Each note plays seven-eighths of the time determined by L
+            (length).
+        
+        :MS:
+            Music staccato. Each note plays three-quarters of the time determined by
+            L.
+        
+        :N(n):
+            Play note n. n may range from 0 to 84. In the 7 possible octaves, there
+            are 84 notes. n set to 0 (or omitted) indicates a rest.
+        
+        :O(n):
+            Octave 0 sets the current octave. There are 7 octaves (0 through 6).
+            Default is 4. Middle C is at the beginning of octave 2.
+        
+        :P(n):
+            Pause. n may range from 1-64; the current L value is used if omitted.
+        
+        :T(n):
+            Tempo. T sets the number of L4s in a minute. n may range from 32-255.
+            Default is 120.
+        
+        :. (period):
+            A period after a note increases the playing time of the note by 3/2
+            times the period determined by L (length of note) times T (tempo).
+            Multiple periods can appear after a note, and the playing time is scaled
+            accordingly. For example, A. will cause the note A to play one and half
+            times the playing time determined by L (length of the note) times T (the
+            tempo); two periods placed after A (A..) will cause the note to be
+            played at 9/4 times its ascribed value; an A with three periods (A...)
+            at 27/8, etc. Periods may also appear after a P (pause), and increase
+            the pause length as described above.
+        
+        :>:
+            A greater-than symbol raises the current octave by one.
+        
+        :<:
+            A less-than symbol lowers the current octave by one.
+        
+        :\|:
+            Optionally used as a synchronisation mark for multi-track music. This is
+            a proprietary extension in the Floppi-Music project.
+        
+        Comments
+        --------
+        
+        Lines starting with # are comments. At the beginning of the file,
+        comments may be used to encode metadata. This is yet to be specified.
+        The current implementation parses key/value pairs separated by a colon
+        and a space, strips both key and value, lower-cases the key and adds it
+        to a dictionary.
+        
+        The MusicXML export currently specifically recognises these keys:
+        
+        -  Title, Copyright, Encoder (person), Source
+        -  Composer, Lyrics, Arranger, Translator *xor* Artist (deprecated, only
+           one)
+        
+        Any other key is treated as miscellaneous field.
+        
+        Voices
+        ------
+        
+        The voices of a song are interleaved. They are grouped per notation
+        system, and the notation systems are seperated by empty lines.
+        
+        Changelog for MMLlib
+        ====================
+        
+        0.3
+        ---
+        
+        -  Enable Python 3 compatibility.
+        -  Add new mmllint script.
+        -  Include example MML songs.
+        -  Add first parts of test suite.
+        -  Some bugfixes.
+        
+        0.2
+        ---
+        
+        -  Add mml2musicxml script.
+        
+        0.1
+        ---
+        
+        -  Separate from Floppi-Music.
+        
+        
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Console
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: Science/Research
+Classifier: License :: OSI Approved
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python
+Classifier: Topic :: Artistic Software
+Classifier: Topic :: Multimedia :: Sound/Audio :: Conversion
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff --git a/MMLlib.egg-info/SOURCES.txt b/MMLlib.egg-info/SOURCES.txt
new file mode 100644
index 0000000..45160e7
--- /dev/null
+++ b/MMLlib.egg-info/SOURCES.txt
@@ -0,0 +1,27 @@
+CHANGELOG.rst
+LICENCE
+MANIFEST.in
+MMLFILE.rst
+README.rst
+setup.py
+MMLlib.egg-info/PKG-INFO
+MMLlib.egg-info/SOURCES.txt
+MMLlib.egg-info/dependency_links.txt
+MMLlib.egg-info/entry_points.txt
+MMLlib.egg-info/not-zip-safe
+MMLlib.egg-info/top_level.txt
+examples/alle_meine_entchen.mml
+examples/bruder_jakob.mml
+examples/loreley.mml
+mmllib/__init__.py
+mmllib/cmds.py
+mmllib/mml.py
+mmllib/musicxml.py
+mmllib/parser.py
+mmllib/playlist.py
+test/__init__.py
+test/test_musicxml.py
+test/test_parser.py
+test/test_playlist.py
+test/util.py
+test/data/loreley.xml
\ No newline at end of file
diff --git a/MMLlib.egg-info/dependency_links.txt b/MMLlib.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/MMLlib.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/MMLlib.egg-info/entry_points.txt b/MMLlib.egg-info/entry_points.txt
new file mode 100644
index 0000000..a60e999
--- /dev/null
+++ b/MMLlib.egg-info/entry_points.txt
@@ -0,0 +1,4 @@
+[console_scripts]
+mml2musicxml = mmllib.cmds:mml2musicxml
+mmllint = mmllib.cmds:mmllint
+
diff --git a/MMLlib.egg-info/not-zip-safe b/MMLlib.egg-info/not-zip-safe
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/MMLlib.egg-info/not-zip-safe
@@ -0,0 +1 @@
+
diff --git a/MMLlib.egg-info/top_level.txt b/MMLlib.egg-info/top_level.txt
new file mode 100644
index 0000000..74c4e6e
--- /dev/null
+++ b/MMLlib.egg-info/top_level.txt
@@ -0,0 +1 @@
+mmllib
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..77c4e02
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,193 @@
+Metadata-Version: 1.1
+Name: MMLlib
+Version: 0.3.0.post1
+Summary: Modern library for handling Music Macro Language
+Home-page: http://github.com/Natureshadow/mmllib
+Author: Dominik George
+Author-email: nik at naturalnet.de
+License: MirOS
+Description: MMLlib - Modern library for handling Music Macro Language
+        =========================================================
+        
+        About
+        -----
+        
+        MMLlib is a pure Python implementation of functionality related to the
+        `Music Macro
+        Language <https://en.wikipedia.org/wiki/Music_Macro_Language>`__ as
+        implemented by Microsoft® GW-BASIC® and compatibles, which is its most
+        common form, also implemented by the PC speaker driver in Linux and
+        `BSD <http://www.mirbsd.org/man4/spkr>`__, with a number of extensions
+        and changes:
+        
+        -  ``|`` denotes a bar line, ignored by the Linux/BSD driver
+        -  support for multiple (parallel) instrument tracks
+        -  a per-file header with work metadata (optional)
+        -  lines starting with a ``#`` are comments
+        -  the alias ``~`` is not supported
+        
+        The library currently contains functions to:
+        
+        -  parse an (extended) MML file into metadata and individual tracks
+        -  a duration estimate and the number of tracks is added to the metadata
+        -  return a list of tuples (frequency, duration) to play (in a threaded
+           interpreter, such as Floppi-Music)
+        -  bar lines are indicated separately as integer ``1``
+        -  return an event-oriented list of measures / bars across all tracks;
+           each measure has a duration and a list of time-fixed tone on/off
+           events; facilitates playing in non-threaded interpreters and,
+           possibly, MIDI export
+        -  export (extended) MML to MusicXML
+        -  which can be imported by e.g. `MuseScore <https://musescore.org/>`__
+           to…
+        
+           -  double-check the MML score for mistakes in a visual representation
+           -  play, arrange, etc. the music
+           -  beautify the score to print it as sheet music
+           -  export into other formats or share on their website
+        
+        -  check tracks for synchronisation error
+        -  missing tracks, i.e. with 0 bars
+        -  missing bars (can only be detected at the end, of course)
+        -  missing notes within a bar, relative to other tracks
+        
+        Examples
+        --------
+        
+        Some example extended MML files are contained within the examples/
+        directory, in lieu of better documentation for the extended format, in
+        addition to the `MML format documentation
+        <http://www.mirbsd.org/man4/spkr>`__.
+        
+        Projects using MMLlib
+        ---------------------
+        
+        ::Floppi-Music::
+            `Floppi-Music <https://github.com/Natureshadow/Floppi-Music>`__ has
+            MML as input format for floppy drive music on Raspberry Pi and uses
+            MMLlib for processing. Floppi-Music is also the origin of MMLlib.
+        
+        Description of the (extended) music macro language
+        ==================================================
+        
+        Based on http://www.antonis.de/qbebooks/gwbasman/play.html and
+        https://www.mirbsd.org/man4/spkr .
+        
+        Symbols of MML
+        --------------
+        
+        :A-G[#,+,-][length]:
+            A-G are notes. # or + following a note produces a sharp; - produces a
+            flat.
+        
+        :L(n):
+        
+            Sets the length of each note. L4 is a quarter note, L1 is a whole note,
+            and so on. n may be from 1 to 64. Length may also follow the note to
+            change the length for that note only. A16 is equivalent to L16A. Default
+            is L4.
+        
+        :ML:
+            Music legato. Each note plays the full period set by L.
+        
+        :MN:
+            Music normal. Each note plays seven-eighths of the time determined by L
+            (length).
+        
+        :MS:
+            Music staccato. Each note plays three-quarters of the time determined by
+            L.
+        
+        :N(n):
+            Play note n. n may range from 0 to 84. In the 7 possible octaves, there
+            are 84 notes. n set to 0 (or omitted) indicates a rest.
+        
+        :O(n):
+            Octave 0 sets the current octave. There are 7 octaves (0 through 6).
+            Default is 4. Middle C is at the beginning of octave 2.
+        
+        :P(n):
+            Pause. n may range from 1-64; the current L value is used if omitted.
+        
+        :T(n):
+            Tempo. T sets the number of L4s in a minute. n may range from 32-255.
+            Default is 120.
+        
+        :. (period):
+            A period after a note increases the playing time of the note by 3/2
+            times the period determined by L (length of note) times T (tempo).
+            Multiple periods can appear after a note, and the playing time is scaled
+            accordingly. For example, A. will cause the note A to play one and half
+            times the playing time determined by L (length of the note) times T (the
+            tempo); two periods placed after A (A..) will cause the note to be
+            played at 9/4 times its ascribed value; an A with three periods (A...)
+            at 27/8, etc. Periods may also appear after a P (pause), and increase
+            the pause length as described above.
+        
+        :>:
+            A greater-than symbol raises the current octave by one.
+        
+        :<:
+            A less-than symbol lowers the current octave by one.
+        
+        :\|:
+            Optionally used as a synchronisation mark for multi-track music. This is
+            a proprietary extension in the Floppi-Music project.
+        
+        Comments
+        --------
+        
+        Lines starting with # are comments. At the beginning of the file,
+        comments may be used to encode metadata. This is yet to be specified.
+        The current implementation parses key/value pairs separated by a colon
+        and a space, strips both key and value, lower-cases the key and adds it
+        to a dictionary.
+        
+        The MusicXML export currently specifically recognises these keys:
+        
+        -  Title, Copyright, Encoder (person), Source
+        -  Composer, Lyrics, Arranger, Translator *xor* Artist (deprecated, only
+           one)
+        
+        Any other key is treated as miscellaneous field.
+        
+        Voices
+        ------
+        
+        The voices of a song are interleaved. They are grouped per notation
+        system, and the notation systems are seperated by empty lines.
+        
+        Changelog for MMLlib
+        ====================
+        
+        0.3
+        ---
+        
+        -  Enable Python 3 compatibility.
+        -  Add new mmllint script.
+        -  Include example MML songs.
+        -  Add first parts of test suite.
+        -  Some bugfixes.
+        
+        0.2
+        ---
+        
+        -  Add mml2musicxml script.
+        
+        0.1
+        ---
+        
+        -  Separate from Floppi-Music.
+        
+        
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Console
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: Science/Research
+Classifier: License :: OSI Approved
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python
+Classifier: Topic :: Artistic Software
+Classifier: Topic :: Multimedia :: Sound/Audio :: Conversion
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..dc0176b
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,60 @@
+MMLlib - Modern library for handling Music Macro Language
+=========================================================
+
+About
+-----
+
+MMLlib is a pure Python implementation of functionality related to the
+`Music Macro
+Language <https://en.wikipedia.org/wiki/Music_Macro_Language>`__ as
+implemented by Microsoft® GW-BASIC® and compatibles, which is its most
+common form, also implemented by the PC speaker driver in Linux and
+`BSD <http://www.mirbsd.org/man4/spkr>`__, with a number of extensions
+and changes:
+
+-  ``|`` denotes a bar line, ignored by the Linux/BSD driver
+-  support for multiple (parallel) instrument tracks
+-  a per-file header with work metadata (optional)
+-  lines starting with a ``#`` are comments
+-  the alias ``~`` is not supported
+
+The library currently contains functions to:
+
+-  parse an (extended) MML file into metadata and individual tracks
+-  a duration estimate and the number of tracks is added to the metadata
+-  return a list of tuples (frequency, duration) to play (in a threaded
+   interpreter, such as Floppi-Music)
+-  bar lines are indicated separately as integer ``1``
+-  return an event-oriented list of measures / bars across all tracks;
+   each measure has a duration and a list of time-fixed tone on/off
+   events; facilitates playing in non-threaded interpreters and,
+   possibly, MIDI export
+-  export (extended) MML to MusicXML
+-  which can be imported by e.g. `MuseScore <https://musescore.org/>`__
+   to…
+
+   -  double-check the MML score for mistakes in a visual representation
+   -  play, arrange, etc. the music
+   -  beautify the score to print it as sheet music
+   -  export into other formats or share on their website
+
+-  check tracks for synchronisation error
+-  missing tracks, i.e. with 0 bars
+-  missing bars (can only be detected at the end, of course)
+-  missing notes within a bar, relative to other tracks
+
+Examples
+--------
+
+Some example extended MML files are contained within the examples/
+directory, in lieu of better documentation for the extended format, in
+addition to the `MML format documentation
+<http://www.mirbsd.org/man4/spkr>`__.
+
+Projects using MMLlib
+---------------------
+
+::Floppi-Music::
+    `Floppi-Music <https://github.com/Natureshadow/Floppi-Music>`__ has
+    MML as input format for floppy drive music on Raspberry Pi and uses
+    MMLlib for processing. Floppi-Music is also the origin of MMLlib.
diff --git a/examples/alle_meine_entchen.mml b/examples/alle_meine_entchen.mml
new file mode 100644
index 0000000..86c8108
--- /dev/null
+++ b/examples/alle_meine_entchen.mml
@@ -0,0 +1,4 @@
+# Title:     Alle meine Entchen
+# Copyright: MML scores (c) 2013, Dominik George <nik at naturalnet.de>, The MirOS Licence
+
+o2 c d e f g2 g2 aaaa g1 aaaa g1 ffff e2 e2 dddd c1
diff --git a/examples/bruder_jakob.mml b/examples/bruder_jakob.mml
new file mode 100644
index 0000000..6c3805a
--- /dev/null
+++ b/examples/bruder_jakob.mml
@@ -0,0 +1,22 @@
+# Title:     Bruder Jakob
+# Copyright: MML scores (c) 2015, Dominik George <nik at naturalnet.de>, The MirOS Licence
+
+o2l4t120 f g a f | f g a f | a b- >c2 | <a b- >c2 |
+o2l4t120 p1      | p1      | f g a f  | f g a f   |
+o2l4t120 p1      | p1      | p1       | p1        |
+o2l4t120 p1      | p1      | p1       | p1        |
+
+l8 c d c <b- l4 a f | l8 >c d c <b- l4 a f |
+   a b- >c2         | <a b- >c2            |
+   f g a f          | f g a f              |
+   p1               | p1                   |
+
+g c f2              | g c f2               | p1                  |
+l8 c d c <b- l4 a f | l8 >c d c <b- l4 a f | g c f2              |
+a b- >c2            | <a b- >c2            | l8 c d c <b- l4 a f |
+f g a f             | f g a f              | a b- >c2            |
+
+p1                   | p1                  | p1                   | p1     | p1     ||
+g c f2               | p1                  | p1                   | p1     | p1     ||
+l8 >c d c <b- l4 a f | g c f2              | g c f2               | p1     | p1     ||
+<a b- >c2            | l8 c d c <b- l4 a f | l8 >c d c <b- l4 a f | g c f2 | g c f2 ||
diff --git a/examples/loreley.mml b/examples/loreley.mml
new file mode 100644
index 0000000..7fe1b25
--- /dev/null
+++ b/examples/loreley.mml
@@ -0,0 +1,73 @@
+# Title:          Loreley
+# Composer:       Ph. Friedrich Silcher (1789–1860), 1837
+# Lyrics:         Heinrich Heine (1797–1856), 1824
+# Arranger:       Klavier: August Linder; MML: mirabilos
+# Encoder:        mirabilos, 2016
+# Copyright:      MML encoding & arrangement © 2016 mirabilos, published under The MirOS Licence; copyright for text, music, and piano arrangement has expired
+# Source:         Linder, August (Hrsg.): Deutsche Weisen : Die beliebtesten Volks- und geistlichen Lieder. Stuttgart: Albert Auer’s Musikverlag, n.d., c. 1900.
+# Instruments:    Piano, Voice
+# MML Tracks:     4 (5)
+# Verses:         3
+# Language:       German
+# Tempo:          Andante
+# Time Signature: 6/8
+# Key Signature:  C Major
+# Pickup Measure: 1/8
+# Measures:       16
+
+## Structure:
+# Track 1: voice track
+# Text embedded here, as comments (not exported) – roughly note-aligned
+# Track 2: usually lowest voice double, except in bar 12
+# Track 3: occasional helper
+# Track 4: bass background
+
+o2t76l8 g | mlg.   mna16 g ml>c<  mnb   a |   g4.            f4         f |
+# ⒈   Ich   weiß  nicht, was soll  es  be-    deu-           ten,     daß
+# ⒉   Die   schön-______ ste Jung-___frau     si-            tzet    dort
+# ⒊   Den   Schif-______ fer im  klei-nen     Schif-         fe       er-
+o2t76l8 p | mle.   mnf16 e mlf    mnf   f |   e4.            d4         d |
+o1t76l8 p | p2.                           | p2.                           |
+o1t76l8 p | mlc16g16>c<mng mlc16a16>d<mnb | mlc16g16>c<mng ml<f16>f16amnf |
+
+   e.    e16 e mldmnc d  | mle4. mnep g | mlg.   mna16 g ml>c<  mnb   a |
+#  ich______ so trau-_rig  bin?_____  Ein Mähr-  chen  aus  al-____ ten
+#  o-_______ ben wun-_der- bar,_____  ihr gold’- nes   Ge-  schmei-_ de
+#  greift es mit wil-_dem  Weh,_____  er  schaut nicht die  Fel-___ sen-
+   c.    c16 c<mlbmna b> | mlc4. mncp p | mle.   mnf16 e mlf    mnf   f |
+p4.              g4   g  | mlg ppmnp4 p | p2.                           |
+ml<g16>e16gmne  <g4   g> | mlc<gemnc4>p | mlc16g16>c<mng mlc16a16>d<mnb |
+
+  g4.            f4         f | e.   e16 e   g     f   d  | mlc4. mncp e |
+# Zei-           ten,     das kommt_____ mir nicht aus dem Sinn._____  Die
+# bli-           tzet,    sie kämmt_____ ihr gol-  de- nes Haar._____  Sie
+# rif-           fe,       er schaut nur hin-auf   in  die Höh’._____  Ich
+  e4.            d4         d | c.   c16 c  <b     b   b  | p2.          |
+p2.                           | p   p    p   d     d   f  | mle ppmnp4 p |
+mlc16g16>c<mng ml<f16>f16amnf |<g>  g    c  <g     g   g> | mlc<egmnc4 p |
+
+mld.  mne16  d   g    d   d  |   b4.      a4   a |    g4   g mlf#mng   a   |
+# Luft_____  ist kühl und es     dun-   kelt und      ru-hig fließt___ der
+# kämmt es   mit gol- de- nem    Kam-     me und   singt ein Lied_____ da-
+# glau- be,  die Wel- len ver-   schlin- gen  am      En- de Schif-fer und
+mlb.> mnc16< b   b    b   b  |  >d4.      c4   c |   <b4   p mlamn b>  c<< |
+  p   p      p  >d    p   p  |   g4.      e4   e |    d4   d<d4        d   |
+mlg>  d    mng<mlg>   d mng< | mlg>dmng<mlc>emna | ml<d>dmnb p4        f#  |
+
+# The next measure missed an o1g as last eighth, to fit on four tracks
+# (but it’s doubled by the o2g in the vocals, so it’s okay musically)
+mlg4.mng4  g  |   g.     a16 g>mlc<mn   b   a |
+# Rhein;__ der    Gi-   pfel des Ber-____ ges
+# bei;____ das    hat     ei-ne wun-_____ der-
+# Kahn,___ und    das    hat mit ih-_____ rem
+mlgb>cdc<mnb  | >>e.     f16 e mlfmn    f   f |
+mld4.mnd4> f< | p2.                           |
+mlb>defe mnd< | mlc16g16>c<mng mlc16a16>d<mnb | l16
+
+mlg4mn>   e     d4       d  |    c.     c16c ml<b mna b | ml>c4.mncp ||
+# fun-______    kelt     im      A-_______ bend-son-_ nen-schein.__
+# sa-_______    me,      ge-     wal-   ti-ge   Me-__ lo- dei._____
+# Sin-______    gen     die      Lo-______ re-_ ley__ ge- than.____
+mle4mn    g     f4       f  |    e.     e16e ml f mnf f | ml e4.mnep ||
+p2.                         |    p     p   p    g   g g | ml gppmnpp ||
+mlcg>mnc<pp8 ml<f>a>mnd<pp8 | ml<g>g>mncpl8p    d   c d | ml<cegmncp ||
diff --git a/mmllib/__init__.py b/mmllib/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/mmllib/cmds.py b/mmllib/cmds.py
new file mode 100644
index 0000000..df22a36
--- /dev/null
+++ b/mmllib/cmds.py
@@ -0,0 +1,88 @@
+# ~*~ coding: utf-8 ~*~
+#-
+# Copyright © 2013, 2016, 2017
+#       Dominik George <nik at naturalnet.de>
+# Copyright © 2013, 2016
+#       mirabilos <m at mirbsd.org>
+#-
+# Provided that these terms and disclaimer and all copyright notices
+# are retained or reproduced in an accompanying document, permission
+# is granted to deal in this work without restriction, including un‐
+# limited rights to use, publicly perform, distribute, sell, modify,
+# merge, give away, or sublicence.
+#
+# This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
+# the utmost extent permitted by applicable law, neither express nor
+# implied; without malicious intent or gross negligence. In no event
+# may a licensor, author or contributor be held liable for indirect,
+# direct, other damage, loss, or other issues arising in any way out
+# of dealing in the work, even if advised of the possibility of such
+# damage or existence of a defect, except proven that it results out
+# of said person’s immediate fault when using the work as intended.
+
+""" Script entry points for use by setuptools """
+
+import argparse
+import sys
+from pprint import pprint
+
+from .musicxml import convert_mml_file
+from .mml import mml
+from .parser import mml_file
+from .playlist import convert_to_timedlist, timedlist_duration, timedlist_ntracks
+
+def mml2musicxml():
+    """ Entry point for converting MML to MusicXML
+
+    Returns 0 on success, >0 on error.
+    """
+
+    # parse arguments
+    aparser = argparse.ArgumentParser()
+    aparser.add_argument("path", help="path to the file to convert")
+    args = aparser.parse_args()
+
+    if hasattr(sys.stdout, "buffer"):
+        sys.stdout.buffer.write(convert_mml_file(args.path))
+    else:
+        sys.stdout.write(convert_mml_file(args.path))
+    sys.stdout.write("\n")
+    return 0
+
+def mmllint():
+    """ Entry point for checking MML
+
+    Returns 0 on success, >0 on error.
+    """
+
+    aparser = argparse.ArgumentParser()
+    aparser.add_argument("path_or_mml", help="path to the file to check or mml string")
+    aparser.add_argument("-q", "--quiet", help="only output final state", action="store_true")
+    args = aparser.parse_args()
+    if not args.path_or_mml.endswith(".mml"):
+        playlist = [mml(args.path_or_mml)]
+    else:
+        playlist = mml_file(args.path_or_mml)
+    timedlist, errors = convert_to_timedlist(playlist)
+
+    if not args.quiet:
+        pprint(timedlist)
+    if len(timedlist):
+        (highesttrack, ntracks) = timedlist_ntracks(timedlist)
+        print("Tracks  : " + str(ntracks) + ", up to #" + str(highesttrack))
+        print("Measures: " + str(len(timedlist)))
+        print("Duration: " + str(timedlist_duration(timedlist)))
+    if len(errors):
+        for (track, barno, delta) in errors:
+            if barno == 0:
+                print("Error: missing track " + str(track))
+            elif delta == 0:
+                print("Error: track " + str(track) + " missing measure " + str(barno))
+            else:
+                print("Error: underfull measure (-" +
+                      str(delta) + "s) in track " + str(track) +
+                      ", measure " + str(barno))
+        return 1
+    else:
+        print("No errors.")
+        return 0
diff --git a/mmllib/mml.py b/mmllib/mml.py
new file mode 100644
index 0000000..cb725e7
--- /dev/null
+++ b/mmllib/mml.py
@@ -0,0 +1,284 @@
+# ~*~ coding: utf-8 ~*~
+#-
+# Copyright © 2016
+#       mirabilos <m at mirbsd.org>
+# Copyright © 2013, 2016
+#       Dominik George <nik at naturalnet.de>
+# Copyright © 2013
+#       Eike Tim Jesinghaus <eike at naturalnet.de>
+#-
+# Provided that these terms and disclaimer and all copyright notices
+# are retained or reproduced in an accompanying document, permission
+# is granted to deal in this work without restriction, including un‐
+# limited rights to use, publicly perform, distribute, sell, modify,
+# merge, give away, or sublicence.
+#
+# This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
+# the utmost extent permitted by applicable law, neither express nor
+# implied; without malicious intent or gross negligence. In no event
+# may a licensor, author or contributor be held liable for indirect,
+# direct, other damage, loss, or other issues arising in any way out
+# of dealing in the work, even if advised of the possibility of such
+# damage or existence of a defect, except proven that it results out
+# of said person’s immediate fault when using the work as intended.
+
+"""Functions and data to deal with Music Macro Language parsing
+and conversion into frequency and duration tuples, as well as
+generic tools for dealing with MML.
+"""
+
+# Pre-calculated note frequencies
+#
+# The list comprehension creates a list of 84 frequencies
+# from C2 (C, o0c) to B8 (h''''', o6b) mapping the MML note
+# number (minus one) to its 12-EDO, A=440 Hz, frequency
+_MML_NOTE2FREQ = [(440.0 * pow(2, (n - 33) / 12.)) for n in range(0, 84)]
+
+# Note offsets
+# Map pitch names to half-tone steps from the current C
+_MML_NAME2STEP = {'C': 0,
+                  'D': 2,
+                  'E': 4,
+                  'F': 5,
+                  'G': 7,
+                  'A': 9,
+                  'B': 11}
+
+# Note offsets, reverse
+#
+# Map MML note numbers (minus one) to tuple (MML octave, pitch name,
+# accidental sign)
+#
... 2142 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/mmllib.git



More information about the Python-modules-commits mailing list