diff -Nru mingus-0.4.2.0/AUTHORS mingus-0.4.2.3/AUTHORS --- mingus-0.4.2.0/AUTHORS 1970-01-01 01:00:00.000000000 +0100 +++ mingus-0.4.2.3/AUTHORS 2009-07-07 13:25:24.000000000 +0100 @@ -0,0 +1,8 @@ +mingus was started in the summer of 2008 and is currently maintained by two people: + +Bart Spaans, who has written most of the modules and is currently writing +this little text about himself in the third person (awkward). + +And Javier Palanca who has joined the project officially in July, 2009 and +currently works on adding full MusicXML support in the extra package. + diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/CHANGELOG /tmp/E5VggasSKF/mingus-0.4.2.3/CHANGELOG --- mingus-0.4.2.0/CHANGELOG 2009-07-01 23:57:18.000000000 +0100 +++ mingus-0.4.2.3/CHANGELOG 2009-07-07 13:56:16.000000000 +0100 @@ -2,6 +2,45 @@ CHANGELOG ================================================================================ + 0.4.2.3 + + * extra/MusicXML.py: Applied Javier's patch fixing beat divisions. + * Almost every file: Updated copyright information. Closes issue #78. + * Added something resembling an AUTHORS file. With only two main + developers this doesn't make much sense, but, err, at least we are + prepared for a glorious future! Closes issue #79. + * Added a THANKS file and went through past issues and mails to gather + full names and addresses. If you have been left out or don't want to + be listed; let me know. (closes issue #80). + * Added a copy of the full GPL v3 license. (closes issue #81) + +================================================================================ + + 0.4.2.2 + Jul 3, 2009 + + * extra/MusicXML.py: MusicXML exporting functions by Javier Palanca. + (started issue #63). + * containers/Track.py: Added `return self` to methods in Track. + Check for None in chords, in method from_chords. + * midi/Sequencer.py: Fixed bug. Added support for rests in + play_NoteContainer and stop_NoteContainer. + +================================================================================ + + 0.4.2.1 + Jul 2, 2009 + + * midi/SequencerObserver.py: A new easy to extend base class that + can be used to observe Sequencer objects (closes issue #46). + * midi/tunings.py: Added find_chord_fingering to StringTuning. + (closes issue #70). + * core/chords.py: Raise FormatError in from_shorthand if shorthand is + invalid. + * containers/Track.py: Added from_chords (started issue #74). + +================================================================================ + 0.4.2.0 Jul 2, 2009 diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/debian/changelog /tmp/E5VggasSKF/mingus-0.4.2.3/debian/changelog --- mingus-0.4.2.0/debian/changelog 2009-07-07 18:12:18.000000000 +0100 +++ mingus-0.4.2.3/debian/changelog 2009-07-07 18:12:18.000000000 +0100 @@ -1,3 +1,18 @@ +mingus (0.4.2.3-0ubuntu1) karmic; urgency=low + + * new upstream version + * this release includes a copy of the gpl lisence + * updated copyright file (upstream authors/copyright) + + -- Stefan Huchler Tue, 07 Jul 2009 18:41:22 +0200 + +mingus (0.4.2.0-0ubuntu5) karmic; urgency=low + + * closes (LP: #317541) + * adds a debian watch file + + -- Stefan Huchler Sat, 04 Jul 2009 18:28:22 +0200 + mingus (0.4.2.0-0ubuntu4) karmic; urgency=low * Distribute package for karmic koala diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/debian/copyright /tmp/E5VggasSKF/mingus-0.4.2.3/debian/copyright --- mingus-0.4.2.0/debian/copyright 2009-07-07 18:12:18.000000000 +0100 +++ mingus-0.4.2.3/debian/copyright 2009-07-07 18:12:18.000000000 +0100 @@ -3,9 +3,9 @@ It was downloaded from http://mingus.googlecode.com/ -Upstream Author: Bart Spaans +Upstream Authors: Bart Spaans , Javier Palance , Nathan Whitehead -Copyright: 2008, 2009 Bart Spaans +Copyright: 2008, 2009 Bart Spaans , Javier Palance , Nathan Whitehead License: diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/debian/watch /tmp/E5VggasSKF/mingus-0.4.2.3/debian/watch --- mingus-0.4.2.0/debian/watch 1970-01-01 01:00:00.000000000 +0100 +++ mingus-0.4.2.3/debian/watch 2009-07-07 18:12:18.000000000 +0100 @@ -0,0 +1,2 @@ +version=3 +opts="uversionmangle=s/luks-//;s/-pre/~pre/;s/-rc/~rc/" http://code.google.com/p/mingus/downloads/list http://mingus.googlecode.com/files/mingus-(.*)\.tar\.gz diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/LICENSE /tmp/E5VggasSKF/mingus-0.4.2.3/LICENSE --- mingus-0.4.2.0/LICENSE 1970-01-01 01:00:00.000000000 +0100 +++ mingus-0.4.2.3/LICENSE 2007-07-01 23:55:35.000000000 +0100 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/containers/Bar.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/containers/Bar.py --- mingus-0.4.2.0/mingus/containers/Bar.py 2009-07-01 23:47:35.000000000 +0100 +++ mingus-0.4.2.3/mingus/containers/Bar.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package, Bar class - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -153,6 +153,14 @@ max = note return (min, max) + def space_left(self): + """Returns the space left on the Bar.""" + return self.length - self.current_beat + + def value_left(self): + """Returns the value left on the Bar.""" + return 1.0 / self.space_left() + def augment(self): """Calls augment on the NoteContainers in Bar.""" for cont in self.bar: diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/containers/Composition.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/containers/Composition.py --- mingus-0.4.2.0/mingus/containers/Composition.py 2008-09-07 06:24:11.000000000 +0100 +++ mingus-0.4.2.3/mingus/containers/Composition.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package, composition module - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/containers/__init__.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/containers/__init__.py --- mingus-0.4.2.0/mingus/containers/__init__.py 2008-12-28 16:47:55.000000000 +0000 +++ mingus-0.4.2.3/mingus/containers/__init__.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package, containers package - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/containers/Instrument.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/containers/Instrument.py --- mingus-0.4.2.0/mingus/containers/Instrument.py 2008-12-28 16:45:13.000000000 +0000 +++ mingus-0.4.2.3/mingus/containers/Instrument.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package, Instrument module - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -39,6 +39,7 @@ name = 'Instrument' range = (Note('C', 0), Note('C', 8)) clef = 'bass and treble' + tuning = None # optional StringTuning object def __init__(self): pass diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/containers/mt_exceptions.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/containers/mt_exceptions.py --- mingus-0.4.2.0/mingus/containers/mt_exceptions.py 2008-09-07 06:24:11.000000000 +0100 +++ mingus-0.4.2.3/mingus/containers/mt_exceptions.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package, container exceptions - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/containers/NoteContainer.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/containers/NoteContainer.py --- mingus-0.4.2.0/mingus/containers/NoteContainer.py 2009-06-28 17:44:39.000000000 +0100 +++ mingus-0.4.2.3/mingus/containers/NoteContainer.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package, note containers. - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/containers/Note.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/containers/Note.py --- mingus-0.4.2.0/mingus/containers/Note.py 2009-06-29 01:41:02.000000000 +0100 +++ mingus-0.4.2.3/mingus/containers/Note.py 2009-07-07 13:50:10.000000000 +0100 @@ -2,7 +2,7 @@ ================================================================================ mingus - Music theory Python package, Note class. - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/containers/Suite.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/containers/Suite.py --- mingus-0.4.2.0/mingus/containers/Suite.py 2009-06-28 19:55:09.000000000 +0100 +++ mingus-0.4.2.3/mingus/containers/Suite.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package, Suite module - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/containers/Track.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/containers/Track.py --- mingus-0.4.2.0/mingus/containers/Track.py 2009-07-01 23:17:11.000000000 +0100 +++ mingus-0.4.2.3/mingus/containers/Track.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package, Track module - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,7 +23,9 @@ """ from mt_exceptions import InstrumentRangeError +from mingus.containers.NoteContainer import NoteContainer from mingus.containers.Bar import Bar +import mingus.core.value as value class Track: """The Track class can be used to store [refMingusContainersBar Bars] \ @@ -43,6 +45,7 @@ def add_bar(self, bar): """Adds a [refMingusContainersBar Bar] to the current track""" self.bars.append(bar) + return self def add_notes(self, note, duration = None): @@ -75,8 +78,42 @@ if last_bar.is_full(): self.bars.append(Bar(last_bar.key, last_bar.meter)) + #warning should hold note if it doesn't fit return self.bars[-1].place_notes(note, duration) + def from_chords(self, chords, duration = 1): + """Adds chords to the Track. `chords` should be a list of shorthand strings or +list of list of shorthand strings, etc. Each sublist divides the value by 2. If a tuning is set, +chords will be expanded so they have a proper fingering. +{{{ +>>> t = Track().from_chords(["C", ["Am", "Dm"], "G7", "C#"], 1) +}}}""" + tun = self.get_tuning() + + def add_chord(chord, duration): + if type(chord) == list: + for c in chord: + add_chord(c, duration * 2) + else: + chord = NoteContainer().from_chord(chord) + if tun: + chord = tun.find_chord_fingering(chord, return_best_as_NoteContainer = True) + + if not self.add_notes(chord, duration): + # This should be the standard behaviour of add_notes + dur = self.bars[-1].value_left() + self.add_notes(chord, dur) + #warning should hold note + self.add_notes(chord, value.subtract(duration, dur)) + + for c in chords: + if c is not None: + add_chord(c, duration) + else: + self.add_notes(None, duration) + + return self + def get_tuning(self): """Returns a StringTuning object. If an instrument is set and has a \ tuning it will be returned. Otherwise the track's one will be used.""" @@ -96,26 +133,31 @@ """Transposes all the notes in the track up or down the interval. Calls transpose() on every [refMingusContainersBar Bar].""" for bar in self.bars: bar.transpose(interval, up) + return self def to_minor(self): """Calls to_minor on all the bars in the Track.""" for bar in self.bars: bar.to_minor() + return self def to_major(self): """Calls to_major on all the bars in the Track.""" for bar in self.bars: bar.to_major() + return self def augment(self): """Calls augment on all the bars in the Track.""" for bar in self.bars: bar.augment() + return self def diminish(self): """Calls diminish on all the bars in the Track.""" for bar in self.bars: bar.diminish() + return self def __add__(self, value): """Overloads the + operator for Tracks. Accepts \ diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/core/chords.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/core/chords.py --- mingus-0.4.2.0/mingus/core/chords.py 2009-03-07 10:50:07.000000000 +0000 +++ mingus-0.4.2.3/mingus/core/chords.py 2009-07-07 13:50:10.000000000 +0100 @@ -2,7 +2,7 @@ ================================================================================ Music theory Python package, chords module - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -101,7 +101,7 @@ import intervals import notes import diatonic -from mt_exceptions import NoteFormatError +from mt_exceptions import NoteFormatError, FormatError @@ -1055,8 +1055,7 @@ return res else: - #warning raise exception: shorthand not known - return False + raise FormatError, "Unknown shorthand: %s" % shorthand_string diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/core/diatonic.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/core/diatonic.py --- mingus-0.4.2.0/mingus/core/diatonic.py 2009-06-05 09:21:35.000000000 +0100 +++ mingus-0.4.2.3/mingus/core/diatonic.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ Music theory Python package, diatonic module. - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/core/__init__.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/core/__init__.py --- mingus-0.4.2.0/mingus/core/__init__.py 2009-01-12 06:24:07.000000000 +0000 +++ mingus-0.4.2.3/mingus/core/__init__.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ Mingus - Music theory Python module, core package - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/core/intervals.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/core/intervals.py --- mingus-0.4.2.0/mingus/core/intervals.py 2009-06-19 17:06:23.000000000 +0100 +++ mingus-0.4.2.3/mingus/core/intervals.py 2009-07-07 13:50:10.000000000 +0100 @@ -2,7 +2,7 @@ ================================================================================ Music theory Python package, intervals module. - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/core/meter.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/core/meter.py --- mingus-0.4.2.0/mingus/core/meter.py 2009-03-01 07:06:31.000000000 +0000 +++ mingus-0.4.2.3/mingus/core/meter.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ Music theory Python package, meter module - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/core/mt_exceptions.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/core/mt_exceptions.py --- mingus-0.4.2.0/mingus/core/mt_exceptions.py 2009-07-01 20:11:32.000000000 +0100 +++ mingus-0.4.2.3/mingus/core/mt_exceptions.py 2009-07-07 13:50:10.000000000 +0100 @@ -2,7 +2,7 @@ ================================================================================ Music theory Python package, exceptions. - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,6 +24,9 @@ class Error(Exception): pass +class FormatError(Error): + pass + class NoteFormatError(Error): pass diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/core/notes.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/core/notes.py --- mingus-0.4.2.0/mingus/core/notes.py 2008-09-07 06:24:01.000000000 +0100 +++ mingus-0.4.2.3/mingus/core/notes.py 2009-07-07 13:50:10.000000000 +0100 @@ -2,7 +2,7 @@ ================================================================================ mingus - Music theory Python package, notes module. - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/core/progressions.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/core/progressions.py --- mingus-0.4.2.0/mingus/core/progressions.py 2009-03-02 06:26:35.000000000 +0000 +++ mingus-0.4.2.3/mingus/core/progressions.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package, progressions module - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/core/scales.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/core/scales.py --- mingus-0.4.2.0/mingus/core/scales.py 2008-09-07 06:24:01.000000000 +0100 +++ mingus-0.4.2.3/mingus/core/scales.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ Music theory Python package, scales module - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/core/value.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/core/value.py --- mingus-0.4.2.0/mingus/core/value.py 2009-06-05 09:33:16.000000000 +0100 +++ mingus-0.4.2.3/mingus/core/value.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ Music theory Python package, note value module - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans, Javier Palanca This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -62,6 +62,18 @@ sixty_fourth = 64 hundred_twenty_eighth = 128 +#MusicXML conversion table +musicxml = { +1 : "whole", +2 : "half", +4 : "quarter", +8 : "eighth", +16 : "16th", +32 : "32th", +64 : "64th", +128: "128th" +} + base_values = [ 0.25, 0.5, 1, 2, 4, 8, 16, 32, 64, 128] base_quintuplets = [0.3125, 0.625, 1.25, 2.5, 5, 10, 20, 40, 80, 160] diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/extra/fft.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/extra/fft.py --- mingus-0.4.2.0/mingus/extra/fft.py 2009-06-26 02:15:40.000000000 +0100 +++ mingus-0.4.2.3/mingus/extra/fft.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package, fft module - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ import struct import numpy from mingus.containers.Note import Note -from numpy.fft import fft +from numpy.fft import fft as _fft import operator # Making a frequency-amplitude table @@ -94,7 +94,7 @@ # Fast fourier transform n = len(data) - p = fft(data) + p = _fft(data) uniquePts = numpy.ceil((n + 1) / 2.0) # Scale by the length (n) and square the value to get the amplitude diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/extra/__init__.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/extra/__init__.py --- mingus-0.4.2.0/mingus/extra/__init__.py 2009-07-01 21:03:37.000000000 +0100 +++ mingus-0.4.2.3/mingus/extra/__init__.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package, extra package - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,6 +23,7 @@ """ import LilyPond +from tunings import StringTuning -__all__ = ["LilyPond", "fft", "MusicXML", "tunings", "tablature"] +__all__ = ['LilyPond', 'fft', 'MusicXML', 'tunings', 'tablature', 'StringTuning'] diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/extra/LilyPond.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/extra/LilyPond.py --- mingus-0.4.2.0/mingus/extra/LilyPond.py 2009-03-02 06:01:39.000000000 +0000 +++ mingus-0.4.2.3/mingus/extra/LilyPond.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package, LilyPond module - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/extra/MusicXML.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/extra/MusicXML.py --- mingus-0.4.2.0/mingus/extra/MusicXML.py 2008-12-28 19:13:20.000000000 +0000 +++ mingus-0.4.2.3/mingus/extra/MusicXML.py 2009-07-07 13:50:10.000000000 +0100 @@ -4,7 +4,7 @@ ================================================================================ mingus - Music theory Python package, MusicXML - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans, Javier Palanca This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,29 +36,290 @@ import xml from xml.dom.minidom import Document +from mingus.core import notes +from mingus.core.diatonic import basic_keys +from mingus.containers.Instrument import MidiInstrument +from mingus.containers.Composition import Composition +from mingus.containers.Track import Track +from mingus.core import value + +import datetime + +def _gcd(a=None,b=None, terms=None): + """Return greatest common divisor using Euclid's Algorithm.""" + if terms: + return reduce(lambda a,b: _gcd(a,b), terms) + else: + while b: + a, b = b, a % b + return a + +def _lcm(a=None,b=None, terms=None): + """Return lowest common multiple.""" + if terms: return reduce(lambda a,b: _lcm(a,b), terms) + else: return (a*b)/_gcd(a,b) + + +def _note2musicxml(note): + doc = Document() + note_node = doc.createElement("note") + if note==None: + #note is a rest + rest = doc.createElement("rest") + note_node.appendChild(rest) + else: + #add pitch info + pitch = doc.createElement("pitch") + step = doc.createElement("step") + step.appendChild(doc.createTextNode(note.name[:1])) + pitch.appendChild(step) + octave = doc.createElement("octave") + octave.appendChild(doc.createTextNode(str(note.octave))) + pitch.appendChild(octave) + #check for alterations + count = 0 + for i in note.name[1:]: + if i=="b": count-=1 + elif i=="#": count +=1 + if count != 0: + alter = doc.createElement("alter") + alter.appendChild(doc.createTextNode(str(count))) + pitch.appendChild(alter) + + note_node.appendChild(pitch) + + return note_node + +def _bar2musicxml(bar): + doc = Document() + bar_node = doc.createElement("measure") + #bar attributes + attributes = doc.createElement("attributes") + #calculate divisions by using the LCM + l=list() + for nc in bar: + l.append(int(value.determine(nc[1])[0])) + lcm = _lcm(terms=l)*4 + + divisions = doc.createElement("divisions") + divisions.appendChild(doc.createTextNode(str(lcm))) + attributes.appendChild(divisions) + if bar.key.name in basic_keys: + key = doc.createElement("key") + fifths = doc.createElement("fifths") + #now we are going to guess which is the key of the bar + index = basic_keys.index(bar.key.name) + if index>13: index -= 12 + fifths.appendChild(doc.createTextNode(str(index-6))) + mode = doc.createElement("mode") + mode.appendChild(doc.createTextNode("major")) #does mingus support more modes? + key.appendChild(fifths) + key.appendChild(mode) + attributes.appendChild(key) + time = doc.createElement("time") + beats = doc.createElement("beats") + beattype = doc.createElement("beat-type") + beats.appendChild(doc.createTextNode(str(bar.meter[0]))) + beattype.appendChild(doc.createTextNode(str(bar.meter[1]))) + time.appendChild(beats) + time.appendChild(beattype) + attributes.appendChild(time) + + bar_node.appendChild(attributes) + + chord=doc.createElement("chord") + + for nc in bar: + time = value.determine(nc[1]) + beat = time[0] + note_cont = nc[2] + is_chord=False + if note_cont: + #is a note_container with 2 or more notes a chord? + if len(note_cont)>1: is_chord=True + else: note_cont = [None] + for n in note_cont: + note = _note2musicxml(n) + if is_chord: + note.appendChild(chord) + #convert the duration of the note + duration = doc.createElement("duration") + duration.appendChild(doc.createTextNode(str(int(lcm*(4.0/beat))))) + note.appendChild(duration) + #check for dots + dot = doc.createElement("dot") + for i in range(0,time[1]): + note.appendChild(dot) + + if beat in value.musicxml.keys(): + type_node = doc.createElement("type") + type_node.appendChild(doc.createTextNode(value.musicxml[beat])) + note.appendChild(type_node) + + #check for non-standard ratio + if time[2]!=1 and time[3]!=1: + modification = doc.createElement("time-modification") + actual = doc.createElement("actual-notes") + actual.appendChild(doc.createTextNode(str(time[2]))) + normal = doc.createElement("normal-notes") + normal.appendChild(doc.createTextNode(str(time[3]))) + modification.appendChild(actual) + modification.appendChild(normal) + note.appendChild(modification) + + bar_node.appendChild(note) + + + return bar_node + +def _track2musicxml(track): + doc = Document() + clef = None + track_node = doc.createElement("part") + track_node.setAttribute("id",str(id(track))) + if track.instrument: #try to guess the clef of the instrument + if "treble" in track.instrument.clef.lower(): + clef = ("G","2") + elif "bass" in track.instrument.clef.lower(): + clef = ("F","4") + elif "french" in track.instrument.clef.lower(): + clef = ("G", "1") + elif "baritone" in track.instrument.clef.lower(): + clef= ("F","3") + elif "subbass" in track.instrument.clef.lower(): + clef = ("F","5") + elif "alto" in track.instrument.clef.lower(): + clef = ("C","3") + elif "tenor" in track.instrument.clef.lower(): + clef = ("C","4") + elif "mezzo-soprano" in track.instrument.clef.lower(): + clef = ("C","2") + elif "soprano" in track.instrument.clef.lower(): + clef = ("C","1") + + + counter = 1 + for b in track.bars: + bar = _bar2musicxml(b) + bar.setAttribute("number",str(counter)) + if clef: + attrs = bar.getElementsByTagName("attributes") + for attr in attrs: + clef_node = doc.createElement("clef") + sign = doc.createElement("sign") + line = doc.createElement("line") + sign.appendChild(doc.createTextNode(clef[0])) + line.appendChild(doc.createTextNode(clef[1])) + clef_node.appendChild(sign) + clef_node.appendChild(line) + attr.appendChild(clef_node) + track_node.appendChild(bar) + counter += 1 + return track_node -def write_Note(file, note): - try: - f = open(file, "w") - except: - raise IOError, "Couldn't open '%s' for writing" % file - +def _composition2musicxml(comp): doc = Document() - score_partwise = doc.createElement("score-partwise") - score_partwise.setAttribute("version", "2.0") - doc.append_child(score_partwise) + score = doc.createElement("score-partwise") + score.setAttribute("version","2.0") + #set title information + if comp.title: + title = doc.createElement("movement-title") + title.appendChild(doc.createTextNode(str(comp.title))) + score.appendChild(title) + identification = doc.createElement("identification") + #set author information + if comp.author: + author = doc.createElement("creator") + author.setAttribute("type","composer") + author.appendChild(doc.createTextNode(str(comp.author))) + identification.appendChild(author) + #set additional info + encoding = doc.createElement("encoding") + software = doc.createElement("software") + software.appendChild(doc.createTextNode("mingus")) + encoding.appendChild(software) + enc_date = doc.createElement("encoding-date") + enc_date.appendChild(doc.createTextNode(str(datetime.date.today()))) + encoding.appendChild(enc_date) + identification.appendChild(encoding) + score.appendChild(identification) + #add tracks part_list = doc.createElement("part-list") - score_partwise.append_child(part_list) - - score_part = doc.createElement("score-part") - score_part.setAttribute("id", "P1") - part_list.append_child(score_part) - - part_name = doc.createElement("part-name") - score_part.append_child(part_name) - - + score.appendChild(part_list) + for t in comp: + track = _track2musicxml(t) + score_part = doc.createElement("score-part") + track.setAttribute("id",str(id(t))) + score_part.setAttribute("id",str(id(t))) + part_name = doc.createElement("part-name") + part_name.appendChild(doc.createTextNode(t.name)) + score_part.appendChild(part_name) + if t.instrument: + #add instrument info + score_inst = doc.createElement("score-instrument") + score_inst.setAttribute("id",str(id(t.instrument))) + name = doc.createElement("instrument-name") + name.appendChild(doc.createTextNode(str(t.instrument.name))) + score_inst.appendChild(name) + score_part.appendChild(score_inst) + #add midi instruments + if isinstance(t.instrument,MidiInstrument): + midi = doc.createElement("midi-instrument") + midi.setAttribute("id",str(id(t.instrument))) + channel = doc.createElement("midi-channel") + channel.appendChild(doc.createTextNode(str(1))) #what about the midi channels? + program = doc.createElement("midi-program") + program.appendChild(doc.createTextNode(str(t.instrument.instrument_nr))) + midi.appendChild(channel) + midi.appendChild(program) + score_part.appendChild(midi) + + + part_list.appendChild(score_part) + track.setAttribute("id",str(id(t))) + score.appendChild(track) + + return score + +def from_Note(note): + c = Composition() + c.add_note(note) + return _composition2musicxml(c).toprettyxml() + +def from_Bar(bar): + c = Composition() + t = Track() + t.add_bar(bar) + c.add_track(t) + return _composition2musicxml(c).toprettyxml() + +def from_Track(track): + c = Composition() + c.add_track(track) + return _composition2musicxml(c).toprettyxml() +def from_Composition(comp): + return _composition2musicxml(comp).toprettyxml() + +def write_Composition(composition, filename, zip=False): + '''Creates an xml file (or mxl if compressed) for a given composition''' + text = from_Composition(composition) + if not zip: + f = open(filename+".xml","w") + f.write(text) + f.close() + else: + import zipfile + import os + zf = zipfile.ZipFile(filename+".mxl", mode='w',compression=zipfile.ZIP_DEFLATED) + zi = zipfile.ZipInfo("META-INF"+os.sep+"container.xml") + zi.external_attr = 0660 << 16L + zf.writestr(zi,"") + zi = zipfile.ZipInfo(filename+".xml") + zi.external_attr = 0660 << 16L + zf.writestr(zi,text) + zf.close() + diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/extra/tunings.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/extra/tunings.py --- mingus-0.4.2.0/mingus/extra/tunings.py 2009-07-01 20:57:14.000000000 +0100 +++ mingus-0.4.2.3/mingus/extra/tunings.py 2009-07-07 13:50:10.000000000 +0100 @@ -28,7 +28,10 @@ """ from mingus.containers.Note import Note +from mingus.containers.NoteContainer import NoteContainer from mingus.core.mt_exceptions import RangeError +import mingus.core.notes as notes + class StringTuning: """StringTuning can be used to store and work with tunings and fingerings.""" @@ -143,6 +146,162 @@ + def find_chord_fingering(self, notes, max_distance = 4, maxfret = 18, return_best_as_NoteContainer = False): + """Returns a list of fret lists that are considered possible fingerings. This function only \ +looks at and matches on the note _names_ so it does more than `find_fingering`. For example: \ +{{{ +>>> t = tunings.get_tuning("guitar", "standard", 6, 1) +>>> t.find_chord_fingering(NoteContainer().from_chord("Am")) +[[0, 0, 2, 2, 1, 0], + [0, 3, 2, 2, 1, 0], ......] +}}}""" + + def follow(string, next, name, prev = -1): + """Follow the fret `next` on `string`. And build result on the way.""" + + if string >= len(self.tuning) - 1: + return [[(next, name)]] + + result = [] + cur = res[string][next] + if cur != []: + for y in cur[1]: + for sub in follow(string + 1, y[0], y[1]): + if prev < 0: + result.append([(next, name)] + sub) + else: + if sub[0][0] == 0 or abs(sub[0][0] - prev) < max_distance: + result.append([(next, name)] + sub) + + for s in follow(string + 1, maxfret + 1, None, next): + result.append([(next, name)] + s) + + return [[(next, name)]] if result == [] else result + + def make_lookup_table(): + """Prepare the lookup table. table[string][fret] = (name, dest_frets)""" + res = [ [ [] for x in xrange(maxfret + 2) ] for x in xrange(len(self.tuning) - 1)] + + for x in xrange(0, len(self.tuning) - 1): + addedNone = -1 + next = fretdict[x + 1] + for fret, name in fretdict[x]: + for f2, n2 in next: + if n2 != name and (f2 == 0 or abs(fret - f2) < max_distance): + if res[x][fret] != []: + res[x][fret][1].append( (f2, n2) ) + else: + res[x][fret] = name, [(f2, n2)] + if addedNone < x: + if res[x][maxfret + 1] != []: + res[x][maxfret + 1][1].append( (f2, n2) ) + else: + res[x][maxfret + 1] = None, [(f2, n2)] + addedNone = x + return res + + # Convert to NoteContainer if necessary + n = notes + if notes != [] and type(notes) == list and type(notes[0]) == str: + n = NoteContainer(notes) + + # Check number of note names. + notenames = [ x.name for x in n ] + if len(notenames) == 0 or len(notenames) > len(self.tuning): + return [] + + # Make string-fret dictionary + fretdict = [] + for x in xrange(0, len(self.tuning)): + fretdict.append(self.find_note_names(notes, x, maxfret)) + + # Build table + res = make_lookup_table() + + # Build result using table + result = [] + + # For each fret on the first string + for i, y in enumerate(res[0]): + if y != []: + yname, next = y[0], y[1] + # For each destination fret in y + for fret, name in next: + + # For each followed result + for s in follow(1, fret, name): + subresult = [(i, yname)] + s + + # Get boundaries + mi, ma, names = 1000, -1000, [] + for f, n in subresult: + if n is not None: + if f != 0 and f <= mi: + mi = f + if f != 0 and f >= ma: + ma = f + names.append(n) + + # Enforce boundaries + if abs(ma - mi) < max_distance: + + # Check if all note names are present + covered = True + for n in notenames: + if n not in names: + covered = False + # Add to result + if covered and names != []: + result.append( [ y[0] if y[1] is not None else y[1] for y in subresult ]) + # Return semi-sorted list + s = sorted(result, key = lambda x: sum([ (t if t is not None else 1000) for i,t in enumerate(x)])) + if not return_best_as_NoteContainer: + return s + + else: + rnotes = self.frets_to_NoteContainer(s[0]) + for i, x in enumerate(rnotes): + if x.string < len(self.tuning) - 1: + if res[x.string][x.fret] != []: + rnotes[i].name = res[x.string][x.fret][0] + return rnotes + + def frets_to_NoteContainer(self, fingering): + """Converts a list such as returned by find_fret to a NoteContainer.""" + res = [] + + for string, fret in enumerate(fingering): + if fret is not None: + res.append(self.get_Note(string, fret)) + return NoteContainer(res) + + def find_note_names(self, notelist, string = 0, maxfret = 24): + """Returns a list [(fret, notename)] in ascending order. +Notelist should be a list of Notes, note-strings or a NoteContainer. +{{{ +>>> t = tunings.StringTuning("test", "test", ['A-3', 'A-4']) +>>> t.find_note_names(["A", "C", "E"], 0, 12) +[(0, 'E'), (5, 'A'), (8, 'C'), (12, 'E')] +}}}""" + + n = notelist + if notelist != [] and type(notelist[0]) == str: + n = NoteContainer(notelist) + + result = [] + names = [ x.name for x in n ] + int_notes = [ notes.note_to_int(x) for x in names ] + + # Base of the string + s = int(self.tuning[string]) % 12 + + for x in xrange(0, maxfret + 1): + if (s + x) % 12 in int_notes: + result.append((x, names[int_notes.index((s + x)%12)])) + return result + + + def get_Note(self, string = 0, fret = 0, maxfret = 24): """Returns the Note on `string`, `fret`. Throws a RangeError if either the fret or string is \ unplayable. @@ -160,7 +319,10 @@ s = self.tuning[string] if type(s) == list: s = s[0] - return Note(int(s) + fret) + n = Note(int(s) + fret) + n.string = string + n.fret = fret + return n else: raise RangeError, "Fret '%d' on string '%d' is out of range" % (string, fret) @@ -172,7 +334,7 @@ def add_tuning(instrument, description, tuning): """Add a new tuning to the index. `instrument` and `description` should be strings; \ -`tuning` should be a list of strings or a list of lists to denote courses. For example: \ +`tuning` should be a list of strings or a list of lists to denote courses. For example: {{{ >>> tuning.add_tuning("Guitar", "standard", ['E-2', 'A-2', 'D-3', 'G-3', 'B-3', 'E-4']) >>> tuning.add_tuning("Guitar", "twelve string", [['E-2', 'E-3'], ['A-2', 'A-3'], ...etc. diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/__init__.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/__init__.py --- mingus-0.4.2.0/mingus/__init__.py 2008-09-07 06:23:41.000000000 +0100 +++ mingus-0.4.2.3/mingus/__init__.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/midi/fluidsynth.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/midi/fluidsynth.py --- mingus-0.4.2.0/mingus/midi/fluidsynth.py 2009-06-23 05:04:39.000000000 +0100 +++ mingus-0.4.2.3/mingus/midi/fluidsynth.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package, FluidSynth support - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -73,10 +73,10 @@ # Implement Sequencer's interface - def play_event(self, channel, note, velocity): + def play_event(self, note, channel, velocity): self.fs.noteon(channel, note, velocity) - def stop_event(self, channel, note): + def stop_event(self, note, channel): self.fs.noteoff(channel, note) def cc_event(self, channel, control, value): diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/midi/__init__.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/midi/__init__.py --- mingus-0.4.2.0/mingus/midi/__init__.py 2009-06-23 04:43:10.000000000 +0100 +++ mingus-0.4.2.3/mingus/midi/__init__.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package, midi package - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,5 +21,7 @@ ================================================================================ """ +from Sequencer import Sequencer +from SequencerObserver import SequencerObserver -__all__ = ["Sequencer", "MidiFileIn", "MidiFileOut", "MidiTrack", "fluidsynth"] +__all__ = ["Sequencer", "SequencerObserver", "MidiFileIn", "MidiFileOut", "MidiTrack", "fluidsynth"] diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/midi/MidiFileIn.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/midi/MidiFileIn.py --- mingus-0.4.2.0/mingus/midi/MidiFileIn.py 2008-12-30 05:30:33.000000000 +0000 +++ mingus-0.4.2.3/mingus/midi/MidiFileIn.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package, MIDI File In - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/midi/MidiFileOut.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/midi/MidiFileOut.py --- mingus-0.4.2.0/mingus/midi/MidiFileOut.py 2008-12-28 12:55:17.000000000 +0000 +++ mingus-0.4.2.3/mingus/midi/MidiFileOut.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package, MIDI File Out - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/midi/MidiTrack.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/midi/MidiTrack.py --- mingus-0.4.2.0/mingus/midi/MidiTrack.py 2009-01-19 04:17:08.000000000 +0000 +++ mingus-0.4.2.3/mingus/midi/MidiTrack.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package, MIDI Track - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/midi/pyFluidSynth.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/midi/pyFluidSynth.py --- mingus-0.4.2.0/mingus/midi/pyFluidSynth.py 2009-03-02 06:52:36.000000000 +0000 +++ mingus-0.4.2.3/mingus/midi/pyFluidSynth.py 2009-07-07 13:50:10.000000000 +0100 @@ -5,7 +5,7 @@ Python bindings for FluidSynth - Copyright 2008, Nathan Whitehead + Copyright 2008-2009, Nathan Whitehead Currently maintained by Bart Spaans Released under the LGPL diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/midi/SequencerObserver.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/midi/SequencerObserver.py --- mingus-0.4.2.0/mingus/midi/SequencerObserver.py 1970-01-01 01:00:00.000000000 +0100 +++ mingus-0.4.2.3/mingus/midi/SequencerObserver.py 2009-07-07 13:50:10.000000000 +0100 @@ -0,0 +1,121 @@ +""" + +================================================================================ + + mingus - Music theory Python package, sequencer observer + Copyright (C) 2008-2009, Bart Spaans + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +================================================================================ + + Provides an easy to extend base class that can be used to observe + a Sequencer. Each time a Sequencer starts playing a new Note, Bar, w/e, + an event is fired; this SequencerObserver intercepts the event messages + and calls the proper function so you only have to implement the functions + for the events you need to see. + +================================================================================ + +""" +from mingus.midi.Sequencer import Sequencer + +class SequencerObserver: + """ Provides an easy to extend base class that can be used to observe \ +a Sequencer. Each time a Sequencer starts playing a new Note, Bar, w/e, \ +an event is fired; this SequencerObserver intercepts the event messages \ +and calls the proper function so you only have to implement the functions \ +for the events you need to see.""" + + # Low Level MIDI Events + + def play_int_note_event(self, int_note, channel, velocity): + pass + + def stop_int_note_event(self, int_note, channel): + pass + + def cc_event(self, channel, control, value): + pass + + def instr_event(self, channel, instr, bank): + pass + + + + # High Level Events + + def play_Note(self, note, channel, velocity): + pass + + def stop_Note(self, note, channel): + pass + + def play_NoteContainer(self, notes, channel): + pass + + def stop_NoteContainer(self, notes, channel): + pass + + def play_Bar(self, bar, channel, bpm): + pass + + def play_Bars(self, bars, channels, bpm): + pass + + def play_Track(self, track, channel, bpm): + pass + + def play_Tracks(self, tracks, channels, bpm): + pass + + def play_Composition(self, composition, channels, bpm): + pass + + + + def notify(self, msg_type, params): + if msg_type == Sequencer.MSG_PLAY_INT: + self.play_int_note_event( params['note'], params['channel'], params['velocity']) + elif msg_type == Sequencer.MSG_STOP_INT: + self.stop_int_note_event(params['note'], params['channel']) + elif msg_type == Sequencer.MSG_CC: + self.cc_event(params['channel'], params['control'], params['value']) + elif msg_type == Sequencer.MSG_INSTR: + self.instr_event(params['channel'], params['instr'], params['bank']) + + + elif msg_type == Sequencer.MSG_PLAY_NOTE: + self.play_Note( params['note'], params['channel'], params['velocity']) + elif msg_type == Sequencer.MSG_STOP_NOTE: + self.stop_Note(params['note'], params['channel']) + + elif msg_type == Sequencer.MSG_PLAY_NC: + self.play_NoteContainer(params['notes'], params['channel']) + elif msg_type == Sequencer.MSG_STOP_NC: + self.stop_NoteContainer(params['notes'], params['channel']) + + elif msg_type == Sequencer.MSG_PLAY_BAR: + self.play_Bar(params["bar"], params["channel"], params["bpm"]) + elif msg_type == Sequencer.MSG_PLAY_BARS: + self.play_Bars(params["bars"], params["channels"], params["bpm"]) + elif msg_type == Sequencer.MSG_PLAY_TRACK: + self.play_Track(params["track"], params["channel"], params["bpm"]) + elif msg_type == Sequencer.MSG_PLAY_TRACKS: + self.play_Tracks(params["tracks"], params["channels"], params["bpm"]) + elif msg_type == Sequencer.MSG_PLAY_COMPOSITION: + self.play_Composition(params["composition"], params["channels"], params["bpm"]) + + + diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/mingus/midi/Sequencer.py /tmp/E5VggasSKF/mingus-0.4.2.3/mingus/midi/Sequencer.py --- mingus-0.4.2.0/mingus/midi/Sequencer.py 2009-06-23 04:37:10.000000000 +0100 +++ mingus-0.4.2.3/mingus/midi/Sequencer.py 2009-07-07 13:50:10.000000000 +0100 @@ -3,7 +3,7 @@ ================================================================================ mingus - Music theory Python package, general purpose sequencer - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,9 +23,10 @@ A general purpose sequencer for the objects in mingus.containers. You can use the Sequencer object either by creating a subclass and implementing some of the events (`init`, `play_event`, `stop_event`, `cc_event`, `instr_event`) - or by attaching observer objects via `attach_listener` and catching the + or by attaching observer objects via `attach` and catching the messages in the notify(msg_type, param_dict) function of your object. - + See SequencerObserver for a pre made, easy to extend base class that + can be attached to the Sequencer. ================================================================================ @@ -38,16 +39,33 @@ from time import sleep class Sequencer: - """A general purpose sequencer""" + """A general purpose sequencer for the objects in mingus.containers. You \ +can use the Sequencer object either by creating a subclass and implementing \ +some of the events (`init`, `play_event`, `stop_event`, `cc_event`, `instr_event`) \ +or by attaching observer objects via `attach` and catching the \ +messages in the notify(msg_type, param_dict) function of your object. \ +See SequencerObserver for a pre made, easy to extend base class that \ +can be attached to the Sequencer.""" output = None - # Messages - MSG_PLAY = 0 - MSG_STOP = 1 + # Low level messages + MSG_PLAY_INT = 0 + MSG_STOP_INT = 1 MSG_CC = 2 MSG_INSTR = 3 + # High level messages + MSG_PLAY_NOTE = 4 + MSG_STOP_NOTE = 5 + MSG_PLAY_NC = 6 + MSG_STOP_NC = 7 + MSG_PLAY_BAR = 8 + MSG_PLAY_BARS = 9 + MSG_PLAY_TRACK = 10 + MSG_PLAY_TRACKS = 11 + MSG_PLAY_COMPOSITION = 12 + def __init__(self): self.listeners = [] self.init() @@ -58,7 +76,7 @@ def init(self): pass - def play_event(self, channel, note, velocity): + def play_event(self, note, channel, velocity): pass def stop_event(self, channel, note): @@ -75,13 +93,13 @@ # Observer pattern # Attach any object that has a notify function - def attach_listener(self, listener): + def attach(self, listener): """Attach an object that should be notified of events. \ The object should have a notify(msg_type, param_dict) function.""" if listener not in self.listeners: self.listeners.append(listener) - def detach_listener(self, listener): + def detach(self, listener): """Detach a listening object so that it won't receive any \ events anymore.""" if listener in self.listeners: @@ -124,10 +142,13 @@ velocity = note.velocity if hasattr(note, 'channel'): channel = note.channel - self.play_event(int(channel), int(note) + 12, int(velocity)) - self.notify_listeners(self.MSG_PLAY, {'channel': int(channel), + self.play_event(int(note) + 12, int(channel), int(velocity)) + self.notify_listeners(self.MSG_PLAY_INT, {'channel': int(channel), 'note': int(note) + 12, 'velocity': int(velocity)} ) + self.notify_listeners(self.MSG_PLAY_NOTE, {'channel': int(channel), + 'note': note, + 'velocity': int(velocity)} ) return True def stop_Note(self, note, channel = 1): @@ -136,9 +157,11 @@ if hasattr(note, 'channel'): channel = note.channel - self.stop_event(int(channel), int(note) + 12) - self.notify_listeners(self.MSG_STOP, {'channel': int(channel), + self.stop_event(int(note) + 12, int(channel)) + self.notify_listeners(self.MSG_STOP_INT, {'channel': int(channel), 'note': int(note) + 12}) + self.notify_listeners(self.MSG_STOP_NOTE, {'channel': int(channel), + 'note': note}) return True def stop_everything(self): @@ -150,6 +173,11 @@ def play_NoteContainer(self, nc, channel = 1, velocity = 100): """Plays the Notes in the NoteContainer nc.""" + self.notify_listeners(self.MSG_PLAY_NC, {'notes': nc, 'channel': channel, + 'velocity': velocity}) + if nc is None: + return True + for note in nc: if not self.play_Note(note, channel, velocity): return False @@ -159,6 +187,11 @@ def stop_NoteContainer(self, nc, channel = 1): """Stops playing the notes in NoteContainer nc.""" + self.notify_listeners(self.MSG_PLAY_NC, {'notes': nc, 'channel': channel}) + + if nc is None: + return True + for note in nc: if not self.stop_Note(note, channel): return False @@ -171,6 +204,8 @@ the bpm attribute on a NoteContainer. Returns a dictionary with \ the bpm lemma set on success, an empty dict on some kind of failure. """ + self.notify_listeners(self.MSG_PLAY_BAR, {'bar': bar, 'channel': channel, + 'bpm': bpm}) # length of a quarter note qn_length = 60.0 / bpm @@ -195,6 +230,9 @@ channels should also be provided. The tempo can be changed by providing one or more of \ the NoteContainers with a bpm argument.""" + self.notify_listeners(self.MSG_PLAY_BARS, {'bars': bars, 'channels': channels, + 'bpm': bpm}) + qn_length = 60.0 / bpm # length of a quarter note tick = 0.0 # place in beat from 0.0 to bar.length cur = [0] * len(bars) # keeps the index of the NoteContainer under investigation in each of the bars @@ -270,6 +308,8 @@ def play_Track(self, track, channel = 1, bpm = 120): """Plays a Track object.""" + self.notify_listeners(self.MSG_PLAY_TRACK, {'track': track, 'channel': channel, + 'bpm': bpm}) for bar in track: res = self.play_Bar(bar, channel, bpm) @@ -283,6 +323,8 @@ """Plays a list of Tracks. If an instance of MidiInstrument is used \ then the instrument will be set automatically.""" + self.notify_listeners(self.MSG_PLAY_TRACKS, {'tracks': tracks, 'channels': channels, + 'bpm': bpm}) # Set the right instruments for x in range(len(tracks)): instr = tracks[x].instrument @@ -316,6 +358,8 @@ def play_Composition(self, composition, channels = None, bpm = 120): """Plays a Composition object.""" + self.notify_listeners(self.MSG_PLAY_COMPOSITION, {'composition': composition, + 'channels': channels, 'bpm': bpm}) if channels == None: channels = map(lambda x: x + 1, range(len(composition.tracks))) diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/PKG-INFO /tmp/E5VggasSKF/mingus-0.4.2.3/PKG-INFO --- mingus-0.4.2.0/PKG-INFO 2009-07-01 23:58:08.000000000 +0100 +++ mingus-0.4.2.3/PKG-INFO 2009-07-07 14:11:57.000000000 +0100 @@ -1,12 +1,12 @@ Metadata-Version: 1.0 Name: mingus -Version: 0.4.2.0 -Summary: mingus is an advanced music theory and notation package +Version: 0.4.2.3 +Summary: mingus is a package for Python used by programmers, musicians, composers and researchers to make and investigate music. Home-page: http://mingus.googlecode.com/ Author: Bart Spaans Author-email: onderstekop@gmail.com License: UNKNOWN -Description: mingus is an advanced music theory and notation package for Python with MIDI playback support. It can be used to play around with music theory, to build editors, educational tools and other applications that need to process and/or play music. It can also be used to create sheet music with LilyPond and do automated musicological analysis on chords, scales and harmonic progressions. +Description: mingus is a package for Python used by programmers, musicians, composers and researchers to make and investigate music. At the core of mingus is music theory, which includes topics like intervals, chords, scales and progressions. These components are rigurously tested and can be used to generate _and recognize_ musical elements using convenient shorthand where possible (for example some acceptable chords are: "CM7", "Am6", "Ab7", "G7"). On top of that are several packages that deal with classical notation, MIDI (sequencing, loading and saving), MusicXML, ASCII tablature, and many other useful and plain cool things -- like LilyPond and FluidSynth support. Everything is fully documentated, put into simple APIs and has a tutorial making it easy to jump straight in. http://mingus.googlecode.com/ Platform: UNKNOWN Classifier: Intended Audience :: Developers Classifier: Intended Audience :: Science/Research diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/README /tmp/E5VggasSKF/mingus-0.4.2.3/README --- mingus-0.4.2.0/README 2008-12-30 06:11:28.000000000 +0000 +++ mingus-0.4.2.3/README 2009-07-07 13:12:31.000000000 +0100 @@ -1,13 +1,10 @@ ================================================================================ m i n g u s ================================================================================ - - mingus is an advanced music theory and notation package for Python - with MIDI playback support. It can be used to play around with music - theory, to build editors, educational tools and other applications - that need to process and/or play music. It can also be used to create - sheet music with LilyPond and do automated musicological analysis on - chords, scales and harmonic progressions. + + mingus is a package for Python used by programmers, musicians, composers + and researchers to make and investigate music. + ================================================================================ I N S T A L L @@ -22,6 +19,7 @@ module that creates sheet music from mingus objects. 5. Install fluidsynth for MIDI playback support. + ================================================================================ R E S O U R C E S ================================================================================ @@ -38,6 +36,7 @@ [3] FluidSynth's home. http://www.fluidsynth.org/ + ================================================================================ D E V E L O P M E N T ================================================================================ @@ -47,8 +46,12 @@ http://mingus.googlecode.com/ + And all commits and issue changes will automatically be posted here: + + http://groups.google.com/group/mingus-devel + If you'd like to get in touch to ask a question or submit a patch, - you should contact the mingus' google group at + you should contact mingus' google group at http://groups.google.com/group/mingus-python @@ -57,7 +60,7 @@ ================================================================================ mingus - Music theory Python package, - Copyright (C) 2008, Bart Spaans + Copyright (C) 2008-2009, Bart Spaans This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -72,4 +75,5 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . + ================================================================================ diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/setup.py /tmp/E5VggasSKF/mingus-0.4.2.3/setup.py --- mingus-0.4.2.0/setup.py 2009-07-01 23:56:16.000000000 +0100 +++ mingus-0.4.2.3/setup.py 2009-07-07 14:11:23.000000000 +0100 @@ -1,15 +1,23 @@ from distutils.core import setup setup(name= "mingus", - version = "0.4.2.0", - description = "mingus is an advanced music theory and notation package", - long_description = "mingus is an advanced music theory and notation package "\ - "for Python with MIDI playback support. It can be used to play "\ - "around with music theory, to build editors, educational tools and "\ - "other applications that need to process and/or play music. "\ - "It can also be used to create sheet music with LilyPond "\ - "and do automated musicological analysis on chords, scales and "\ - "harmonic progressions.", + version = "0.4.2.3", + description = "mingus is a package for Python used by programmers, musicians, composers "\ + "and researchers to make and investigate music.", + + long_description = "mingus is a package for Python used by programmers, musicians, "\ + "composers and researchers to make and investigate music. At the core "\ + "of mingus is music theory, which includes topics like intervals, chords, "\ + "scales and progressions. These components are rigurously tested and can "\ + "be used to generate _and recognize_ musical elements using convenient "\ + "shorthand where possible (for example some acceptable chords are: \"CM7\", "\ + "\"Am6\", \"Ab7\", \"G7\"). On top of that are several packages that deal "\ + "with classical notation, MIDI (sequencing, loading and saving), MusicXML, "\ + "ASCII tablature, and many other useful and plain cool things "\ + "-- like LilyPond and FluidSynth support. Everything is fully documentated, "\ + "put into simple APIs and has a tutorial making it easy to jump straight in. "\ + "http://mingus.googlecode.com/", + author = "Bart Spaans", author_email = "onderstekop@gmail.com", url = "http://mingus.googlecode.com/", diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/THANKS /tmp/E5VggasSKF/mingus-0.4.2.3/THANKS --- mingus-0.4.2.0/THANKS 1970-01-01 01:00:00.000000000 +0100 +++ mingus-0.4.2.3/THANKS 2009-07-07 13:51:03.000000000 +0100 @@ -0,0 +1,18 @@ +These people have contributed to mingus. Some have reported problems, others +have contributed improvements to the documentation, actual code, and even +complete modules. Those contributions are described in the CHANGELOG +file. If your name has been left out, if you'd rather not be listed, +or if you'd prefer a different address be used, please send a note to +the mailing list. + + + +Albert Frantz albert.frantz@gmail.com +Bart Spaans onderstekop@gmail.com +Gabriel gbsuar@gmail.com +James Michael McDermott jamesmichaelmcdermott@gmail.com +Javier Palance jpalanca@gmail.com +Joshua Krohse jkrohse@gmail.com +Nada Amin nada.amin@gmail.com +Nathan Whitehead nwhitehe@gmail.com +Stefan Huchler s.huchler@gmail.com diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/unittest/run_tests.py /tmp/E5VggasSKF/mingus-0.4.2.3/unittest/run_tests.py --- mingus-0.4.2.0/unittest/run_tests.py 2009-07-01 20:23:04.000000000 +0100 +++ mingus-0.4.2.3/unittest/run_tests.py 2009-07-03 05:10:44.000000000 +0100 @@ -58,6 +58,7 @@ import test_fft import test_tablature import test_tunings +import test_MusicXML # See run_fluidsynth_tests.py for FluidSynth audio tests # See run_lilypond_tests.py to generate some pdf's @@ -69,7 +70,7 @@ containers = [test_Note, test_NoteContainers, test_Instrument, test_Bar, test_Track, test_Composition, test_Suite] -extra = [test_fft, test_tunings, test_tablature] +extra = [test_fft, test_tunings, test_tablature, test_MusicXML] # Run all tests suite = unittest.TestSuite([ x.suite() for x in core + containers + extra ]) diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/unittest/test_chords.py /tmp/E5VggasSKF/mingus-0.4.2.3/unittest/test_chords.py --- mingus-0.4.2.0/unittest/test_chords.py 2008-12-19 21:48:54.000000000 +0000 +++ mingus-0.4.2.3/unittest/test_chords.py 2009-07-02 09:02:35.000000000 +0100 @@ -2,7 +2,7 @@ sys.path = ["../"] + sys.path import mingus.core.chords as chords -from mingus.core.mt_exceptions import RangeError +from mingus.core.mt_exceptions import RangeError, FormatError, NoteFormatError import unittest class test_chords(unittest.TestCase): @@ -335,6 +335,11 @@ map(lambda x: self.assertEqual(answers[x], chords.from_shorthand(x),\ "The shorthand of %s is not %s, expecting %s" % (x, chords.from_shorthand(x), answers[x])),\ answers.keys()) + + def test_malformed_from_shorthand(self): + for x in ["Bollocks", "Asd", "Bbasd@#45"]: + self.assertRaises(FormatError, chords.from_shorthand, x) + self.assertRaises(NoteFormatError, chords.from_shorthand, x[1:]) def test_determine(self): map(lambda x: self.assertEqual(True, \ diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/unittest/test_fluidsynth.py /tmp/E5VggasSKF/mingus-0.4.2.3/unittest/test_fluidsynth.py --- mingus-0.4.2.0/unittest/test_fluidsynth.py 2009-01-19 04:19:57.000000000 +0000 +++ mingus-0.4.2.3/unittest/test_fluidsynth.py 2009-07-02 02:13:41.000000000 +0100 @@ -5,12 +5,15 @@ from mingus.containers import * import unittest import time +from mingus.midi.SequencerObserver import SequencerObserver class test_fluidsynth(unittest.TestCase): def setUp(self): fluidsynth.init("/home/bspaans/workspace/fluidsynth/ChoriumRevA.SF2") fluidsynth.set_instrument(0,0) + s = SequencerObserver() + fluidsynth.midi.attach(s) def test_bar_velocity(self): b = Bar() diff -Nru /tmp/Ilp7j8CSQY/mingus-0.4.2.0/unittest/test_MusicXML.py /tmp/E5VggasSKF/mingus-0.4.2.3/unittest/test_MusicXML.py --- mingus-0.4.2.0/unittest/test_MusicXML.py 1970-01-01 01:00:00.000000000 +0100 +++ mingus-0.4.2.3/unittest/test_MusicXML.py 2009-07-03 05:12:12.000000000 +0100 @@ -0,0 +1,15 @@ +import sys +sys.path += ["../"] + +import mingus.extra.MusicXML as mxl +import unittest + +class test_MusicXML(unittest.TestCase): + + def setUp(self): + pass + + +def suite(): + return unittest.TestLoader().loadTestsFromTestCase(test_MusicXML) +