Mercurial > hg > webaudioevaluationtool
changeset 2054:a164db84aaef
Merge
author | Brecht De Man <b.deman@qmul.ac.uk> |
---|---|
date | Mon, 29 Jun 2015 19:04:40 +0100 |
parents | 45b469cfcd51 (diff) 8d5a86dff195 (current diff) |
children | 2d3eda2a9c6f |
files | .hgignore ape.js core.js docs/SMC15/interface.png docs/SMC15/smc2015template.tex example_eval/project.xml index.html scripts/comment_parser.py scripts/score_parser.py |
diffstat | 24 files changed, 1296 insertions(+), 347 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Sun Jun 28 09:52:47 2015 +0100 +++ b/.hgignore Mon Jun 29 19:04:40 2015 +0100 @@ -24,3 +24,6 @@ re:^example_eval/project\.xml\.orig$ re:^index2\.html$ re:^realismTest\.html$ +saves/*.xml +saves/timelines +saves/timelines-old \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CITING.txt Mon Jun 29 19:04:40 2015 +0100 @@ -0,0 +1,11 @@ +If you are using this tool in your work, please cite: + +Nicholas Jillings, Brecht De Man, David Moffat and Joshua D. Reiss, "Web Audio Evaluation Tool: A Browser-Based Listening Test Environment," 12th Sound and Music Computing Conference, July 2015. + + +Feel free to let us know how you have used it! We highly welcome any kind of feedback, bug reports and feature requests. + +n.g.r.jillings@se14.qmul.ac.uk +b.deman@qmul.ac.uk +d.j.moffat@qmul.ac.uk +joshua.reiss@qmul.ac.uk \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LICENSE.txt Mon Jun 29 19:04:40 2015 +0100 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + 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. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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 <http://www.gnu.org/licenses/>. + +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: + + <program> Copyright (C) <year> <name of author> + 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 +<http://www.gnu.org/licenses/>. + + 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 +<http://www.gnu.org/philosophy/why-not-lgpl.html>.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.txt Mon Jun 29 19:04:40 2015 +0100 @@ -0,0 +1,92 @@ +WEB AUDIO EVALUATION TOOL + +This is not (yet) a fully fledged manual. + + +AUTHORS +Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> +Brecht De Man <b.deman@qmul.ac.uk> +David Moffat <d.j.moffat@qmul.ac.uk> +Joshua D. Reiss (supervisor) <j.d.reiss@qmul.ac.uk> + + +PACKAGE CONTENTS + +- main folder (/) + - ape.css, core.css, graphics.css, structure.css: style files (edit to change appearance) + - ape.js: JavaScript file for APE-style interface [1] + - core.js: JavaScript file with core functionality + - index.html: webpage where interface should appear + - jquery-2.1.4.js: jQuery JavaScript Library + - pythonServer.py: webserver for running tests locally + - pythonServer-legacy.py: webserver with limited functionality (no storing of output XML files) +- Documentation (/docs/) + - Project Specification Document (LaTeX/PDF) + - Results Specification Document (LaTeX/PDF) + - SMC15: PDF and LaTeX source of corresponding SMC2015 publication +- Example project (/example_eval/) + An example of what the set up XML should look like, with example audio files 0.wav-10.wav which are short recordings at 44.1kHz, 16bit of a woman saying the corresponding number (useful for testing randomisation and general familiarisation with the interface). +- Output files (/saves/) + The output XML files of tests will be stored here by default by the pythonServer.py script. +- Auxiliary scripts (/scripts/) + Helpful Python scripts for extraction and visualisation of data. +- Test creation tool (/test_create/) + Webpage for easily setting up a test without having to delve into the XML. + + +QUICK START +Using the example project: +1. Make sure your system sample rate corresponds with the sample rate of the audio files, if the input XML file enforces the given sample rate. +2. Run pythonServer.py (make sure you have Python installed). +3. Open a browser (anything but Internet Explorer). +4. Go to ‘localhost:8000’. +5. The test should open; complete it and look at the output XML file in /saves/. + + +LEGACY +The APE interface and most of the functionality of the interface is inspired by the APE toolbox for MATLAB [1]. See https://code.soundsoftware.ac.uk/projects/ape for the source code and corresponding paper. + + +CITING + +We request that you acknowledge the authors and cite our work [2], see CITING.txt. + + +LICENSE + +See LICENSE.txt. This code is shared under the GNU General Public License v3.0 (http://choosealicense.com/licenses/gpl-3.0/). Generally speaking, this is a copyleft license that requires anyone who distributes our code or a derivative work to make the source available under the same terms. + + +FEATURE REQUESTS AND BUG REPORTS +We continually develop this tool to fix issues and implement features useful to us or our user base. See https://code.soundsoftware.ac.uk/projects/webaudioevaluationtool/issues for a list of feature requests and bug reports, and their status. + +Please contact the authors if you experience any bugs, if you would like additional functionality, if you have questions about using the interface or if you would like to give any feedback (even positive!) about the interface. We look forward to learning how the tool has (not) been useful to you. + + +SCRIPTS + +The tool comes with a few handy Python scripts for easy extraction of ratings or comments, and visualisation of ratings and timelines. See below for a quick guide on how to use them. All scripts written for Python 2.7. Visualisation requires the free matplotlib toolbox (http://matplotlib.org), numpy and scipy. +By default, the scripts can be run from the ‘scripts’ folder, with the result files in the ‘saves’ folder (the default location where result XMLs are stored). + + comment_parser.py + Extracts comments from the output XML files corresponding with the different subjects found in ‘saves/’. It creates a folder per ‘audioholder’/page it finds, and stores a CSV file with comments for every ‘audioelement’/fragment within these respective ‘audioholders’/pages. In this CSV file, every line corresponds with a subject/output XML file. Depending on the settings, the first column containing the name of the corresponding XML file can be omitted (for anonymisation). + Beware of Excel: sometimes the UTF-8 is not properly imported, leading to problems with special characters in the comments (particularly cumbersome for foreign languages). + + score_parser.py + Extracts rating values from the XML to CSV - necessary for running visualisation of ratings. Creates the folder ‘saves/ratings/‘ if not yet created, to which it writes a separate file for every ‘audioholder’/page in any of the output XMLs it finds in ‘saves/‘. Within each file, rows represent different subjects (output XML file names) and columns represent different ‘audioelements’/fragments. + + score_plot.py + Plots the ratings as stored in the CSVs created by score_parser.py + Depending on the settings, it displays and/or saves (in ‘saves/ratings/’) a boxplot, confidence interval plot, scatter plot, or a combination of the aforementioned. + Requires the free matplotlib library. + At this point, more than one subjects are needed for this script to work. + + timeline_view.py + Creates a timeline for every subject, for every ‘audioholder’/page, corresponding with any of the output XML files found in ‘/saves’. It shows when and for how long the subject listened to each of the fragments. + + + +REFERENCES +[1] B. De Man and Joshua D. Reiss, “APE: Audio Perceptual Evaluation toolbox for MATLAB,” 136th Convention of the Audio Engineering Society, 2014. + +[2] Nicholas Jillings, Brecht De Man, David Moffat and Joshua D. Reiss, "Web Audio Evaluation Tool: A Browser-Based Listening Test Environment," 12th Sound and Music Computing Conference, July 2015.
--- a/docs/SMC15/smc2015template.tex Sun Jun 28 09:52:47 2015 +0100 +++ b/docs/SMC15/smc2015template.tex Mon Jun 29 19:04:40 2015 +0100 @@ -10,9 +10,19 @@ \usepackage[english]{babel} \usepackage{cite} \usepackage{enumitem} +\usepackage{listings} \setitemize{noitemsep,topsep=0pt,parsep=0pt,partopsep=0pt} + + +\usepackage{color} +\definecolor{grey}{rgb}{0.1,0.1,0.1} +\definecolor{darkblue}{rgb}{0.0,0.0,0.6} +\definecolor{cyan}{rgb}{0.0,0.6,0.6} + + \hyphenation{Java-script} +\hyphenation{OPA-QUE} %%%%%%%%%%%%%%%%%%%%%%%% Some useful packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%% See related documentation %%%%%%%%%%%%%%%%%%%%%%%%%% @@ -189,7 +199,7 @@ Many are MATLAB-based, useful for easily processing and visualising the data produced by the listening tests, but requiring MATLAB to be installed to run or - in the case of an executable created with MATLAB - at least create the test. Furthermore, compatibility is usually limited across different versions of MATLAB. Similarly, Max requires little or no programming background but it is proprietary software as well, which is especially undesirable when tests need to be deployed at different sites. -More recently, BeaqleJS \cite{beaqlejs} makes use of the HTML5 audio capabilities and comes with a number of predefined, established test interfaces such as ABX and MUSHRA \cite{mushra}. BeaqleJS provides a number of similar features including saving of test data to a web server. The main difference is that with BeaqleJS, the configuration is done through writting a JavaScript file holding a JavaScript Object of the notation. Instead our presented system uses the XML document standard, which allows configuration outside of a web-centric editor. The results are also presented in XML again allowing 3rd party editors and programs to easily access. Finally, the presented system does not require web access to run, instead being deployed with a Python server script. This is particularly useful in studios where machines may not, by design, be web connected, or use in locations where web access is limited. +More recently, BeaqleJS \cite{beaqlejs} makes use of the HTML5 audio capabilities and comes with a number of predefined, established test interfaces such as ABX and MUSHRA \cite{mushra}. BeaqleJS provides a number of similar features including saving of test data to a web server. The main difference is that with BeaqleJS, the configuration is done through writting a JavaScript file holding a JavaScript Object of the notation. Instead our presented system uses the XML document standard, which allows configuration outside of a web-centric editor. The results are also presented in XML again allowing 3\textsuperscript{rd} party editors and programs to easily access. Finally, the presented system does not require web access to run, instead being deployed with a Python server script. This is particularly useful in studios where machines may not, by design, be web connected, or use in locations where web access is limited. A browser-based perceptual evaluation tool for audio has a number of advantages. First of all, it doesn't need any other software than a browser, meaning deployment is very easy and cheap. As such, it can also run on a variety of devices and platforms. The test can be hosted on a central server with subjects all over the world, who can simply go to a webpage. This means that multiple participants can take the test simultaneously, potentially in their usual listening environment if this is beneficial for the test. Naturally, the constraints on the listening environment and other variables still need to be controlled if they are important to the experiment. Depending on the requirements a survey or a variety of tests preceding the experiment could establish whether remote participants and their environments are adequate for the experiment at hand. @@ -220,8 +230,6 @@ %\begin{itemize} %\item %\end{itemize} - - \section{Interface}\label{sec:interface} At this point, we have implemented the interface of the MATLAB-based APE (Audio Perceptual Evaluation) toolbox \cite{deman2014b}. This shows one marker for each simultaneously evaluated audio fragment on one or more horizontal axes, that can be moved to rate or rank the respective fragments in terms of any subjective property, as well as a comment box for every marker, and any extra text boxes for extra comments. @@ -229,7 +237,7 @@ The markers on the slider at the top of the page are positioned randomly, to minimise the bias that may be introduced when the initial positions are near the beginning, end or middle of the slider. Another approach is to place the markers outside of the slider bar at first and have the subject drag them in, but the authors believe this doesn't encourage careful consideration and comparison of the different fragments as the implicit goal of the test becomes to audition and drag each fragment in just once, rather than to compare all fragments rigorously. -See Figure \ref{fig:interface} for an example of the interface, with six fragments and one axis. %? change if a new interface is shown +See Figure \ref{fig:interface} for an example of the interface. %? change if a new interface is shown %Most of these functions are specific to the APE interface design, for instance the AB test will need a different structure for the audio engine and loading of files, since multiple instances of the same file are required. % more generally these pertain to any typeof multi-stimulus test - not quite useful for AB tests, method of adjustment, ABX, and so on. %There are some areas of the design where certain design choices had to be made such as with the markers. @@ -237,11 +245,10 @@ %For instance, the option to provide free-text comment fields allows for tests with individual vocabulary methods, as opposed to only allowing quantitative scales associated to a fixed set of descriptors. \begin{figure*}[ht] -\begin{center} -\includegraphics[width=1.0\textwidth]{interface2.png} -\caption{Example of interface, with 1 axis, 6 fragments and 1 extra comment in Chrome browser} +\centering +\includegraphics[width=.95\textwidth]{interface.png} +\caption{Example interface, with one axis, seven fragments, and text, radio button and check box style comments.} \label{fig:interface} -\end{center} \end{figure*} @@ -256,22 +263,24 @@ \item \texttt{ape.js}: Parses setup files to create the interface as instructed, following the same style chain as the MATLAB APE Tool \cite{deman2014b}. \end{itemize} -The HTML file loads the \texttt{core.js} file along with a few other ancillary files (such as the jQuery JavaScript extensions\footnote{http://jquery.com/}), at which point the browser JavaScript begins to execute the on-page instructions, which gives the URL of the test setup XML document (outlined in Section \ref{sec:setupresultsformats}). \texttt{core.js} parses this document and executes the functions in \texttt{ape.js} to build the web page. The reason for separating these two files is to allow for further interface designs (such as MUSHRA \cite{mushra} or AB tests \cite{bech}) to be used, which would still require the same underlying core functions outlined in \texttt{core.js}. +The HTML file loads the \texttt{core.js} file along with a few other ancillary files (such as the jQuery JavaScript extensions\footnote{http://jquery.com/}), at which point the browser JavaScript begins to execute the on-page instructions, which gives the URL of the test setup XML document (outlined in Section \ref{sec:setupresultsformats}). \texttt{core.js} parses this document and executes the functions in \texttt{ape.js} to build the web page. The reason for separating these two files is to allow for further interface designs (such as MUSHRA \cite{mushra} or 2D rating \cite{bech}) to be used, which would still require the same underlying core functions outlined in \texttt{core.js}. The \texttt{ape.js} file has several main functions but the most important are documented here. \textit{loadInterface(xmlDoc)} is called to decode the supplied project document in respect for the interface specified and define any global structures (such as the slider interface). It also identifies the number of pages in the test and randomises the order, if specified to do so. This is the only mandatory function in any of the interface files as this is called by \texttt{core.js} when the document is ready. \texttt{core.js} cannot 'see' any interface specific functions and therefore cannot assume any are available. Therefore \textit{loadInterface(xmlDoc)} is essential to set up the entire test environment. Because the interface files are loaded by \texttt{core.js} and because the functions in \texttt{core.js} are global, the interface files can `see' the \texttt{core.js} file and can therefore not only interact with it, but also modify it. Each test page is loaded using \textit{loadTest(id)} which performs two major tasks: to populate the interface with the slider elements and comment boxes; and secondly to instruct the \textit{audioEngine} to load the audio fragments and construct the backend audio graph. \textit{loadTest(id)} also instructs the audio engine in \texttt{core.js} to create the \textit{audioObject}. These are custom audio nodes, one representing each audio element specified in each page. -They consist of a \textit{bufferSourceNode} (a node which holds a buffer of audio samples for playback) and a \textit{gainNode}, both of which are Web Audio API Nodes. Various functions are applied, depending on which metrics are enabled, to record the interaction with the audio element. These nodes are then connected to the \textit{audioEngine} (itself a custom web audio node) containing a \textit{gainNode} (where the various \textit{audioObject}s connect to) for summation before passing the output to the \textit{destinationNode}, a permanent node of the Web Audio API created as the master output. Here, the browser then passes the audio information to the system sound device. % Does this now make sense? +They consist of a \textit{bufferSourceNode} (a node which holds a buffer of audio samples for playback) and a \textit{gainNode}, both of which are Web Audio API Nodes. Various functions are applied, depending on which metrics are enabled, to record the interaction with the audio element. These nodes are then connected to the \textit{audioEngine} (itself a custom web audio node) containing a \textit{gainNode} (where the various \textit{audioObject}s connect to) for summation before passing the output to the \textit{destinationNode}, a permanent node of the Web Audio API created as the master output. Here, the browser then passes the audio information to the system. % Does this now make sense? % audio object/audioObject/Audio Object: -- should always be audioObject if talking about the JavaScript object, otherwise should say audio element or audio fragment. When an \textit{audioObject} is created, it is given the URL of the audio sample to load. This is downloaded into the browser asynchronously using the \textit{XMLHttpRequest} object, which downloads any file into the JavaScript environment for further processing. This is particularly useful for the Web Audio API because it supports downloading of files in their binary form for decoding. Once downloaded the file is decoded using the Web Audio API offline decoder. This uses the browser available decoding schemes to decode the audio files into raw float32 arrays, which are in turn passed to the relevant \textit{audioObject} for playback. Once each page of the test is completed, identified by pressing the Submit button, the \textit{pageXMLSave(testId)} is called to store all of the collected data until all pages of the test are completed. After the final test and any post-test questions are completed, the \textit{interfaceXMLSave()} function is called. This function generates the final XML file for submission as outlined in Section \ref{sec:setupresultsformats}. +\vspace{-1em} + \section{Support and limitations}\label{sec:support} -Browsers support various audio file formats and are not consistent in any format. Currently the Web Audio API is best supported in Chrome, Firefox, Opera and Safari. All of these support the use of the uncompressed WAV format. Although not a compact, web friendly format, most transport systems are of a high enough bandwidth this should not be a problem. Ogg Vorbis is another well supported format across the four supported major desktop browsers, as well as MP3 (although Firefox may not support all MP3 types) \footnote{https://developer.mozilla.org/en-US/docs/Web/HTML/\\Supported\_media\_formats}. %https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats +Different browsers support a different set of audio file formats and are not consistent in any format. Currently the Web Audio API is best supported in Chrome, Firefox, Opera and Safari. All of these support the use of the uncompressed WAV format. Although not a compact, web friendly format, most transport systems are of a high enough bandwidth this should not be a problem. Ogg Vorbis is another well supported format across the four supported major desktop browsers, as well as MP3 (although Firefox may not support all MP3 types\footnote{https://developer.mozilla.org/en-US/docs/Web/HTML/\\Supported\_media\_formats}). %https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats One issue of the Web Audio API is that the sample rate is assigned by the system sound device, rather than requested and does not have the ability to request a different one. % Does this make sense? The problem is across all audio files. As the sampling rate and the effect of resampling may be critical for some listening tests, the default operation when an audio file is loaded with a different sample rate to that of the system is to convert the sample rate. To provide a check for this, the desired sample rate can be supplied with the setup XML and checked against. If the sample rates do not match, a browser alert window is shown asking for the sample rate to be correctly adjusted. This happens before any loading or decoding of audio files so the browser will only be instructed to fetch files if the system sample rate meets the requirements, avoiding multiple requests for large files until they are actually needed. @@ -282,41 +291,103 @@ \section{Input and result files}\label{sec:setupresultsformats} -The setup and result files both use the common XML document format to outline the various parameters. The setup file determines the interface to use, the location of audio files, the number of pages and other parameters to define the testing environment. Having one document to modify allows for quick manipulation in a `human readable' form to create new tests, or adjust current ones, without needing to edit multiple web files. Furthermore, we also provide a simple web page to enter all these settings without needing to manipulate the raw XML. An example of this XML document is presented in Figure~\ref{fig:xmlIn}. % I mean the .js and .html files, though not sure if any better. +The setup and result files both use the common XML document format to outline the various parameters. The setup file determines the interface to use, the location of audio files, the number of pages and other parameters to define the testing environment. Having one document to modify allows for quick manipulation in a `human readable' form to create new tests, or adjust current ones, without needing to edit multiple web files. Furthermore, we also provide a simple web page to enter all these settings without needing to manipulate the raw XML. An example of such an XML document is presented below. % I mean the .js and .html files, though not sure if any better. + + + + +\lstset{ + basicstyle=\ttfamily, + columns=fullflexible, + showstringspaces=false, + commentstyle=\color{grey}\upshape +} + +\lstdefinelanguage{XML} +{ + morestring=[b]", + morestring=[s]{>}{<}, + morecomment=[s]{<?}{?>}, + stringstyle=\color{black} \bfseries, + identifierstyle=\color{darkblue} \bfseries, + keywordstyle=\color{cyan} \bfseries, + morekeywords={xmlns,version,type}, + breaklines=true% list your attributes here +} +\scriptsize +\lstset{language=XML} + +\begin{lstlisting} +<?xml version="1.0" encoding="utf-8"?> +<BrowserEvalProjectDocument> + <setup interface="APE" projectReturn="/save" randomiseOrder='false' collectMetrics='true'> + <PreTest> + <question id="location" mandatory="true">Please enter your location.</question> + <number id="age" min="0">Please enter your age</number> + </PreTest> + <PostTest> + <statement>Thank you for taking this listening test!</statement> + </PostTest> + <Metric> + <metricEnable>testTimer</metricEnable> + <metricEnable>elementTimer</metricEnable> + <metricEnable>elementInitialPosition</metricEnable> + <metricEnable>elementTracker</metricEnable> + <metricEnable>elementFlagListenedTo</metricEnable> + <metricEnable>elementFlagMoved</metricEnable> + </Metric> + <interface> + <anchor>20</anchor> + <reference>80</reference> + </interface> + </setup> + <audioHolder id="test-0" hostURL="example_eval/" randomiseOrder='true'> + <interface> + <title>Example Test Question</title> + <scale position="0">Min</scale> + <scale position="100">Max</scale> + <commentBoxPrefix>Comment on fragment</commentBoxPrefix> + </interface> + <audioElements url="1.wav" id="elem1"/> + <audioElements url="2.wav" id="elem2"/> + <audioElements url="3.wav" id="elem3"/> + <CommentQuestion id="generalExperience" type="text">General Comments</CommentQuestion> + <PreTest/> + <PostTest> + <question id="songGenre" mandatory="true">Please enter the genre of the song.</question> + </PostTest> + </audioHolder> +</BrowserEvalProjectDocument> + +\end{lstlisting} + +\normalsize +\vspace{-1em} \subsection{Setup and configurability} -\begin{figure}[ht] -\begin{center} -\includegraphics[width=0.5\textwidth]{XMLInput2.png} -\caption{An example input XML file} -\label{fig:xmlIn} -\end{center} -\end{figure} - -The setup document has several defined nodes and structure which are documented with the source code. For example, there is a section for general setup options where any pre-test and post-test questions and statements can be defined. Pre- and post-test dialogue boxes allow for comments or questions to be presented before or after the test, to convey listening test instructions, and gather information about the subject, listening environment, and overall experience of the test. In the example in Figure~\ref{fig:xmlIn}, a question box with the id `location' is added, which is set to be mandatory to answer. The question is in the PreTest node meaning it will appear before any testing will begin. When the result for the entire test is shown, the response will appear in the PreTest node with the id `location' allowing it to be found easily, provided the id values are meaningful. +The setup document has several defined nodes and structure which are documented with the source code. For example, there is a section for general setup options where any pre-test and post-test questions and statements can be defined. Pre- and post-test dialogue boxes allow for comments or questions to be presented before or after the test, to convey listening test instructions, and gather information about the subject, listening environment, and overall experience of the test. In the example set up document above, a question box with the id `location' is added, which is set to be mandatory to answer. The question is in the PreTest node meaning it will appear before any testing will begin. When the result for the entire test is shown, the response will appear in the PreTest node with the id `location' allowing it to be found easily, provided the id values are meaningful. We try to cater to a diverse audience with this toolbox, while ensuring it is simple, elegant and straightforward. To that end, we currently include the following options that can be easily switched on and off, by setting the value in the input XML file. -\begin{itemize} %Should have used a description list for this. -\item \textbf{Snap to corresponding position}: When this is enabled, and a fragment is playing, the playhead skips to the same position in the next fragment that is clicked. If it is not enabled, every fragment is played from the start. -\item \textbf{Loop fragments}: Repeat current fragment when end is reached, until the `Stop audio' or `Submit' button is clicked. +\begin{itemize}[leftmargin=*]%Should have used a description list for this. +\item \textbf{Snap to corresponding position}: When enabled and a fragment is playing, the playhead skips to the same position in the next fragment that is clicked. Otherwise, each fragment is played from the start. +\item \textbf{Loop fragments}: Repeat current fragment when end is reached, until the `Stop' or `Submit' button is clicked. \item \textbf{Comments}: Displays a separate comment box for each fragment in the page. -\item \textbf{General comment}: One comment box, additional to the individual comment boxes, to comment on the test or a feature that some or all of the fragments share. -\item \textbf{Resampling}: When this is enabled, tracks are resampled to match the subject's system's sample rate (a default feature of the Web Audio API). When it is not, an error is shown when the system does not match the requested sample rate. +\item \textbf{General comment}: Create additional comment boxes to the fragment comment boxes, with a custom question and various input formats such as checkbox or radio. +\item \textbf{Resampling}: When this is enabled, fragments are resampled to match the subject's system's sample rate (a default feature of the Web Audio API). When it is not, an error is shown when the system does not match the requested sample rate. \item \textbf{Randomise page order}: Randomises the order in which different `pages' are presented. % are we calling this 'pages'? -\item \textbf{Randomise fragment order}: Randomises the order and numbering of the markers and comment boxes corresponding to the fragments. This permutation is stored as well, to be able to interpret references to the numbers in the comments (such as `this is much [brighter] then 4'). -\item \textbf{Require playback}: Require that each fragment has been played at least once, if not in full. -\item \textbf{Require full playback}: If `Require playback' is active, require that each fragment has been played in full. +\item \textbf{Randomise fragment order}: Randomises the order and numbering of the markers and comment boxes corresponding to the fragments. Fragments are referenced to their given ID so referencing is possible (such as `this is much brighter than fragment 4'). +\item \textbf{Require (full) playback}: Require that each fragment has been played at least once, partly or fully. \item \textbf{Require moving}: Require that each marker is moved (dragged) at least once. -\item \textbf{Require comments}: This option allows requiring the subject to require a comment for each track. -\item \textbf{Repeat test}: Number of times each page in the test should be repeated (none by default), to allow familiarisation with the content and experiment, and to investigate consistency of user and variability due to familiarity. In the setup, each 'page' can be given a repeat count. These are all gathered before shuffling the order so repeated tests are not back-to-back if possible. +\item \textbf{Require comments}: Require the subject to write a comment for each fragment. +\item \textbf{Repeat test}: Number of times each page in the test should be repeated (none by default), to allow familiarisation with the content and experiment, and to investigate consistency of user and variability due to familiarity. These are all gathered before shuffling the order so repeated tests are not back-to-back if possible. \item \textbf{Returning to previous pages}: Indicates whether it is possible to go back to a previous `page' in the test. \item \textbf{Lowest rating below [value]}: To enforce a certain use of the rating scale, it can be required to rate at least one sample below a specified value. \item \textbf{Highest rating above [value]}: To enforce a certain use of the rating scale, it can be required to rate at least one sample above a specified value. \item \textbf{Reference}: Allows for a separate sample (outside of the axis) to be the `reference', which the subject can play back during the test to help with the task at hand \cite{mushra}. -\item \textbf{Hidden reference}: Whether or not an explicit `reference' is provided, the `hidden reference' should be rated above a certain value \cite{mushra} - this can be enforced. -\item \textbf{Hidden anchor}: The `hidden anchor' should be rated lower than a certain value \cite{mushra} - this can be enforced. +\item \textbf{Hidden reference/anchor}: Whether or not an explicit `reference' is provided, the `hidden reference' should be rated above a certain value \cite{mushra} - this can be enforced. +Similarly, a `hidden anchor' should be rated lower than a certain value \cite{mushra}. \item \textbf{Show scrub bar}: Display a playhead on a scrub bar to show the position in the current fragment. %\item \textbf{Drag playhead}: If scrub bar is visible, allow dragging to move back or forward in a fragment. \end{itemize} @@ -327,20 +398,55 @@ \subsection{Results} -The results file is dynamically generated by the interface upon clicking the `Submit' button. This also executes checks, depending on the setup file, to ensure that all tracks have been played back, rated and commented on. The XML output returned contains a node per audioObject and contains both the corresponding marker's position and any comments written in the associated comment box. The rating returned is normalised to be a value between 0 and 1, normalising the pixel representation of different browser windows. An example output file is presented in Figure~\ref{fig:xmlOut}. +The results file is dynamically generated by the interface upon clicking the `Submit' button. This also executes checks, depending on the setup file, to ensure that all fragments have been played back, rated and commented on. The XML output returned contains a node per fragment and contains both the corresponding marker's position and any comments written in the associated comment box. The rating returned is normalised to be a value between 0 and 1, normalising the pixel representation of different browser windows. The results also contain information collected by any defined pre/post questions. An excerpt of an output file is presented below detailing the data collected for a single audioElement. -\begin{figure}[ht] -\begin{center} -\includegraphics[width=0.5\textwidth]{XMLOutput2.png} -\caption{An example output XML file} -\label{fig:xmlOut} -\end{center} -\end{figure} +\scriptsize +\lstset{language=XML} -The results also contain information collected by any defined pre/post questions. These are referenced against the setup XML by using the same ID so readable responses can be obtained. Taking from the earlier example of setting up a pre-test question, an example response can be seen in Figure \ref{fig:xmlOut}. +\begin{lstlisting} +<browserevaluationresult> + <datetime> + <date year="2015" month="5" day="28">2015/5/28</date> + <time hour="13" minute="19" secs="17">13:19:17</time> + </datetime> + <pretest> + <comment id="location">Control Room</comment> + </pretest> + <audioholder> + <pretest></pretest> + <posttest> + <comment id="songGenre">Pop</comment> + </posttest> + <metric> + <metricresult id="testTime">813.32</metricresult> + </metric> + <audioelement id="elem1"> + <comment> + <question>Comment on fragment 1</question> + <response>Good, but vocals too quiet.</response> + </comment> + <value>0.639010989010989</value> + <metric> + <metricresult id="elementTimer">111.05</metricresult> + <metricresult id="elementTrackerFull"> + <timepos id="0"> + <time>61.60</time> + <position>0.6390</position> + </timepos> + </metricresult> + <metricresult id="elementInitialPosition">0.6571</metricresult> + <metricresult id="elementFlagListenedTo">true</metricresult> + </metric> + </audioelement> + </audioHolder> +</browserevaluationresult> -Each page of testing is returned with the results of the entire page included in the structure. One `audioElement' node is created per audio fragment per page, along with its ID. This includes several child nodes including the rating between 0 and 1, the comment, and any other collected metrics including how long the element was listened for, the initial position, boolean flags if the element was listened to, if the element was moved and if the element comment box had any comment. Furthermore, each user action (manipulation of any interface element, such as playback or moving a marker) can be logged along with a the corresponding time code. -We also store session data such as the browser the tool was used in. +\end{lstlisting} + +\normalsize +\vspace{-.5em} +Each page of testing is returned with the results of the entire page included in the structure. One \texttt{audioelement} node is created per audio fragment per page, along with its ID. This includes several child nodes including the rating between 0 and 1, the comment, and any other collected metrics including how long the element was listened for, the initial position, and boolean flags showing if the element was listened to, moved and commented on. Furthermore, each user action (manipulation of any interface element, such as playback or moving a marker) can be logged along with a the corresponding time code. +We also store session data such as the time the test took place and the duration of the test. We provide the option to store the results locally, and/or to have them sent to a server. %Here is an example of the set up XML and the results XML: % perhaps best to refer to each XML after each section (set up <> results) @@ -371,13 +477,17 @@ %</metric> \\ %</audioelement>} -The parent tag \texttt{audioelement} holds the ID of the element passed in from the setup document. The first child element is \texttt{comment} and holds both the question shown and the response from the comment box inside. -The child element \texttt{value} holds the normalised ranking value. Next comes the metric node structure, with one metric result node per metric event collected. The id of the node identifies the type of data it contains. For example, the first holds the id \textit{elementTimer} and the data contained represents how long, in seconds, the audio element was listened to. There is one \texttt{audioelement} tag per audio element on each test page. - % BRECHT: scripts -Python scripts are included to easily store ratings and comments in a CSV file, and to display graphs of numerical ratings or the test's timeline. -Visualisation of plots requires the free matplotlib library. +\begin{figure}[htpb] +\centering +\includegraphics[width=.45\textwidth]{boxplot.png} +\caption{An example boxplot showing ratings by different subjects on fragments labeled `A' through `G'. } +\label{fig:boxplot} +\end{figure} + +Python scripts are included to easily store ratings and comments in a CSV file, and to display graphs of numerical ratings (see Figure \ref{fig:boxplot}) or visualise the test's timeline. +Visualisation of plots requires the free matplotlib library\footnote{http://matplotlib.org}. \section{Conclusions and future work}\label{sec:conclusions} @@ -387,7 +497,7 @@ The purpose of this paper is to outline the design of this tool, to describe our implementation using basic HTML5 functionality, and to discuss design challenges and limitations of our approach. This tool differentiates itself from other perceptual audio tools by enabling web technologies for multiple participants to perform the test without the need for proprietary software such as MATLAB. The tool also allows for any interface to be built using HTML5 elements to create a variety of dynamic, multiple-stimulus listening test interfaces. It enables quick setup of simple tests with the ability to manage complex tests through a single file. Finally it uses the XML document format to store the results allowing for processing and analysis of results in various third party software such as MATLAB or Python. % future work -Further work may include the development of other common test designs, such as MUSHRA \cite{mushra}, 2D valence and arousal/activity \cite{ratingeerola2009prediction}, and others. We will add functionality to assist with setting up large-scale tests with remote subjects, so this becomes straightforward and intuitive. +Further work may include the development of other common test designs, such as MUSHRA \cite{mushra}, 2D valence and arousal/activity \cite{eerola2009prediction}, and others. We will add functionality to assist with setting up large-scale tests with remote subjects, so this becomes straightforward and intuitive. In addition, we will keep on improving and expanding the tool, and highly welcome feedback and contributions from the community. The source code of this tool can be found on \\ \texttt{code.soundsoftware.ac.uk/projects/}\\ \texttt{webaudioevaluationtool}.
--- a/index.html Sun Jun 28 09:52:47 2015 +0100 +++ b/index.html Mon Jun 29 19:04:40 2015 +0100 @@ -8,7 +8,7 @@ Remove this if you use the .htaccess --> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> - <title>apeTool</title> + <title>Web Audio Evaluation Tool</title> <meta name="description" content="" /> <meta name="author" content="" /> @@ -25,7 +25,7 @@ </script> <!-- Uncomment the following script for automatic loading of projects --> <script> - url = 'example_eval/project.xml'; //Project XML document location + url = '/pseudo.xml'; //Project XML document location loadProjectSpec(url); </script>
--- a/python2.py Sun Jun 28 09:52:47 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -import BaseHTTPServer -from os import walk -from os import path -import urllib2 -import pickle -import datetime - -curSaveIndex = 0; -curFileName = 'test-0.xml' -while(path.isfile('saves/'+curFileName)): - curSaveIndex += 1; - curFileName = 'test-'+str(curSaveIndex)+'.xml' - -print curFileName - -def send404(s): - s.send_response(404) - s.send_header("Content-type", "text/html") - s.end_headers() - -def processFile(s): - s.path = s.path[1:len(s.path)] - st = s.path.rsplit(',') - lenSt = len(st) - fmt = st[lenSt-1].rsplit('.') - size = path.getsize(urllib2.unquote(s.path)) - fileDump = open(urllib2.unquote(s.path)) - s.send_response(200) - - if (fmt[1] == 'html'): - s.send_header("Content-type", 'text/html') - elif (fmt[1] == 'css'): - s.send_header("Content-type", 'text/css') - elif (fmt[1] == 'js'): - s.send_header("Content-type", 'application/javascript') - else: - s.send_header("Content-type", 'application/octet-stream') - s.send_header("Content-Length", size) - s.end_headers() - s.wfile.write(fileDump.read()) - fileDump.close() - -def saveFile(self): - global curFileName - global curSaveIndex - varLen = int(self.headers['Content-Length']) - postVars = self.rfile.read(varLen) - print curFileName - file = open('saves/'+curFileName,'w') - curSaveIndex += 1; - curFileName = 'test-'+str(curSaveIndex)+'.xml' - print curFileName - file.write(postVars) - file.close() - self.send_response(200) - self.send_header("Content-type", "text/xml") - self.end_headers() - self.wfile.write('<response><state>OK</state><file>saves/'+curFileName+'</file></response>') - -class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): - def do_HEAD(s): - s.send_response(200) - s.send_header("Content-type", "text/html") - s.end_headers() - def do_GET(request): - if(request.client_address[0] == "127.0.0.1"): - if (request.path == "/favicon.ico"): - send404(request) - else: - if (request.path == '/'): - request.path = '/index.html' - processFile(request) - else: - send404(request) - def do_POST(request): - if(request.client_address[0] == "127.0.0.1"): - if (request.path == "/save"): - saveFile(request) - else: - send404(request) - -def run(server_class=BaseHTTPServer.HTTPServer, - handler_class=MyHandler): - server_address = ('', 8000) - httpd = server_class(server_address, handler_class) - httpd.serve_forever() - -run() \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pythonServer-legacy.py Mon Jun 29 19:04:40 2015 +0100 @@ -0,0 +1,11 @@ +import SimpleHTTPServer +import SocketServer + +PORT = 8080 + +Handler = SimpleHTTPServer.SimpleHTTPRequestHandler + +httpd = SocketServer.TCPServer(("", PORT), Handler) + +print "serving at port", PORT +httpd.serve_forever()
--- a/pythonServer.py Sun Jun 28 09:52:47 2015 +0100 +++ b/pythonServer.py Mon Jun 29 19:04:40 2015 +0100 @@ -1,11 +1,106 @@ -import SimpleHTTPServer -import SocketServer +import BaseHTTPServer +from os import walk +from os import path +from os import listdir +import urllib2 +import pickle +import datetime -PORT = 8080 +PSEUDO_PATH = 'example_eval/' +pseudo_files = [] +for filename in listdir(PSEUDO_PATH): + if filename.endswith('.xml'): + pseudo_files.append(filename) -Handler = SimpleHTTPServer.SimpleHTTPRequestHandler +curSaveIndex = 0; +curFileName = 'test-0.xml' +while(path.isfile('saves/'+curFileName)): + curSaveIndex += 1; + curFileName = 'test-'+str(curSaveIndex)+'.xml' -httpd = SocketServer.TCPServer(("", PORT), Handler) +print "Next save - " + curFileName +pseudo_index = curSaveIndex % len(pseudo_files) +print "Next test - " + pseudo_files[pseudo_index] -print "serving at port", PORT -httpd.serve_forever() +def send404(s): + s.send_response(404) + s.send_header("Content-type", "text/html") + s.end_headers() + +def processFile(s): + s.path = s.path[1:len(s.path)] + st = s.path.rsplit(',') + lenSt = len(st) + fmt = st[lenSt-1].rsplit('.') + size = path.getsize(urllib2.unquote(s.path)) + fileDump = open(urllib2.unquote(s.path)) + s.send_response(200) + + if (fmt[1] == 'html'): + s.send_header("Content-type", 'text/html') + elif (fmt[1] == 'css'): + s.send_header("Content-type", 'text/css') + elif (fmt[1] == 'js'): + s.send_header("Content-type", 'application/javascript') + else: + s.send_header("Content-type", 'application/octet-stream') + s.send_header("Content-Length", size) + s.end_headers() + s.wfile.write(fileDump.read()) + fileDump.close() + +def saveFile(self): + global curFileName + global curSaveIndex + varLen = int(self.headers['Content-Length']) + postVars = self.rfile.read(varLen) + print curFileName + file = open('saves/'+curFileName,'w') + curSaveIndex += 1; + curFileName = 'test-'+str(curSaveIndex)+'.xml' + print curFileName + file.write(postVars) + file.close() + self.send_response(200) + self.send_header("Content-type", "text/xml") + self.end_headers() + self.wfile.write('<response><state>OK</state><file>saves/'+curFileName+'</file></response>') + +class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): + def do_HEAD(s): + s.send_response(200) + s.send_header("Content-type", "text/html") + s.end_headers() + def do_GET(request): + global pseudo_index + global pseudo_files + global PSEUDO_PATH + if(request.client_address[0] == "127.0.0.1"): + if (request.path == "/favicon.ico"): + send404(request) + else: + if (request.path == '/'): + request.path = '/index.html' + elif (request.path == '/pseudo.xml'): + request.path = '/'+PSEUDO_PATH + pseudo_files[pseudo_index] + print request.path + pseudo_index += 1 + pseudo_index %= len(pseudo_files) + processFile(request) + else: + send404(request) + + def do_POST(request): + if(request.client_address[0] == "127.0.0.1"): + if (request.path == "/save"): + saveFile(request) + else: + send404(request) + +def run(server_class=BaseHTTPServer.HTTPServer, + handler_class=MyHandler): + server_address = ('', 8000) + httpd = server_class(server_address, handler_class) + httpd.serve_forever() + +run() \ No newline at end of file
--- a/saves/read.txt Sun Jun 28 09:52:47 2015 +0100 +++ b/saves/read.txt Mon Jun 29 19:04:40 2015 +0100 @@ -1,2 +1,2 @@ -This folder is where the python2.py server will save the received test results +This folder is where the pythonServer.py server will save the received test results Files will return as test-#.xml where # is the number they were received!
--- a/scripts/comment_parser.py Sun Jun 28 09:52:47 2015 +0100 +++ b/scripts/comment_parser.py Mon Jun 29 19:04:40 2015 +0100 @@ -1,11 +1,17 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + import xml.etree.ElementTree as ET import os import csv +# XML results files location (modify as needed): +folder_name = "../saves" # Looks in 'saves/' folder from 'scripts/' folder + # get every XML file in folder -for file in os.listdir("."): # You have to put this script in folder where output XML files are. +for file in os.listdir(folder_name): if file.endswith(".xml"): - tree = ET.parse(file) + tree = ET.parse(folder_name + '/' + file) root = tree.getroot() # get list of all page names @@ -16,31 +22,34 @@ break # create folder [page_name] if not yet created - if not os.path.exists(page_name): - os.makedirs(page_name) + if not os.path.exists(folder_name + "/" + page_name): + os.makedirs(folder_name + "/" + page_name) # for page [page_name], print comments related to fragment [id] - for audioelement in root.findall("*/[@id='"+page_name+"']/audioelement"): + for audioelement in audioholder.findall("./audioelement"): if audioelement is not None: # Check it exists audio_id = str(audioelement.get('id')) + + csv_name = folder_name +'/' + page_name+'/'+page_name+'-comments-'+audio_id+'.csv' - # append to file [page_name]/[page_name]-comments-[id].csv - with open(page_name+'/'+page_name+'-comments-'+audio_id+'.csv', 'a') as csvfile: - writer = csv.writer(csvfile, delimiter=',') - commentstr = root.find("*/[@id='" - + page_name - + "']/audioelement/[@id='" - + audio_id - + "']/comment/response").text + # append (!) to file [page_name]/[page_name]-comments-[id].csv + with open(csv_name, 'a') as csvfile: + writer = csv.writer(csvfile, + delimiter=',', + dialect="excel", + quoting=csv.QUOTE_ALL) + commentstr = audioelement.find("./comment/response").text + if commentstr is None: - writer.writerow(['']) - else: - writer.writerow([commentstr.encode("utf-8")]) - #TODO Comma doesn't act as delimiter now! - # (when adding more than just a comment per line): - # writer.writerow([file + ',' + commentstr.encode("utf-8")]) + commentstr = ''; + + # anonymous comments: + #writer.writerow([commentstr.encode("utf-8")]) + # comments with (file) name: + writer.writerow([file[:-4]] + [commentstr.encode("utf-8")]) - #TODO Replace 'new line' with something else? - - #TODO 'Append' means duplicate entries if run several times... - + #TODO Replace 'new line' in comment with something else? + +# PRO TIP: Change from csv to txt by running this in bash: +# $ cd folder_where_csvs_are/ +# $ for i in *.csv; do mv "$i" "${i/.csv}".txt; done
--- a/scripts/score_boxplot.py Sun Jun 28 09:52:47 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -import sys -import os -import csv -import matplotlib.pyplot as plt -import numpy as np - -rating_folder = 'ratings/' # folder with rating csv files -show_individual = 'frank' - -# get every csv file in folder -for file in os.listdir(rating_folder): # You have to put this in folder where rating csv files are. - if file.endswith(".csv"): - page_name = file[:-4] # file name (without extension) is page ID - - # get header - with open(rating_folder+file, 'r') as readfile: # read this csv file - filereader = csv.reader(readfile, delimiter=',') - headerrow = filereader.next() # use headerrow as X-axis - headerrow = headerrow[1:] - - # read ratings into matrix - ratings = np.loadtxt(open(rating_folder+file,"rb"), - delimiter=",", - skiprows=1, - usecols=range(1,len(headerrow)+1) - ) - - # draw boxplot - plt.boxplot(ratings) - - # add rating of individual(s) - with open(rating_folder+file, 'r') as readfile: # read this csv file - filereader = csv.reader(readfile, delimiter=',') - headerrow = filereader.next() # use headerrow as X-axis - headerrow = headerrow[1:] - markerlist = ["x", ".", "o", "*", "+", "v", ">", "<", "8", "s", "p"] - increment = 0 - linehandles = [] - legendnames = [] - for row in filereader: - subject_id = row[0][:-4] - if subject_id in show_individual: - plothandle, = plt.plot(range(1,len(row)), # x-values - row[1:], # y-values: csv values except subject name - color='k', - marker=markerlist[increment%len(markerlist)], - markersize=10, - linestyle='None', - label=subject_id - ) - increment += 1 # increase counter - linehandles.append(plothandle) - legendnames.append(subject_id) - plt.legend(linehandles, legendnames, - loc='upper right', - bbox_to_anchor=(1.1, 1), borderaxespad=0.) - - - plt.xlabel('Fragment') - plt.title('Box plot '+page_name) - plt.xlim(0, len(headerrow)+1) # only show relevant region, leave space left & right) - plt.xticks(range(1, len(headerrow)+1), headerrow) # show fragment names - - plt.ylabel('Rating') - plt.ylim(0,1) - - #plt.show() # show plot - #exit() - - plt.savefig(rating_folder+page_name+"-box.png") - plt.close()
--- a/scripts/score_individual.py Sun Jun 28 09:52:47 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -import sys -import os -import csv -import matplotlib.pyplot as plt - -rating_folder = 'ratings/' # folder with rating csv files - -colormap = ['b', 'r', 'g', 'c', 'm', 'y', 'k'] # colormap for to cycle through -markerlist = ["x", ".", "o", "*", "+", "v", ">", "<", "8", "s", "p"] - -show_legend = False - -# get every csv file in folder -for file in os.listdir(rating_folder): - if file.endswith(".csv"): - - page_name = file[:-4] # file name (without extension) is page ID - - with open(rating_folder+file, 'r') as readfile: # read this csv file - filereader = csv.reader(readfile, delimiter=',') - headerrow = filereader.next() # use headerrow as X-axis - headerrow = headerrow[1:] - - - increment = 0 - linehandles = [] - legendnames = [] - for row in filereader: - subject_id = row[0][:-4] - plothandle, = plt.plot(range(1,len(row)), # x-values - row[1:], # y-values: csv values except subject name - color=colormap[increment%len(colormap)], - marker=markerlist[increment%len(markerlist)], - markersize=10, - linestyle='None', - label=subject_id - ) - increment += 1 # increase counter - linehandles.append(plothandle) - legendnames.append(subject_id.decode("utf-8")) # avoid decoding problems - - - plt.xlabel('Fragment') - plt.title('Individual ratings '+page_name) - plt.xlim(0, len(headerrow)+1) # only show relevant region, leave space left & right) - plt.xticks(range(1, len(headerrow)+1), headerrow) # show fragment names - - plt.ylabel('Rating') - plt.ylim(0,1) - - if show_legend: - plt.legend(linehandles, legendnames, - loc='upper right', - bbox_to_anchor=(1.1, 1), - borderaxespad=0., - numpoints=1 # remove extra marker - ) - - #TODO Put legend outside of box - - #plt.show() # show plot - #exit() - - plt.savefig(rating_folder+page_name+"-ind.png") - plt.close()
--- a/scripts/score_parser.py Sun Jun 28 09:52:47 2015 +0100 +++ b/scripts/score_parser.py Mon Jun 29 19:04:40 2015 +0100 @@ -1,38 +1,42 @@ +#!/usr/bin/python + import xml.etree.ElementTree as ET import os import csv #TODO Remove DEBUG statements +# XML results files location (modify as needed): +folder_name = "../saves" # Looks in 'saves/' folder from 'scripts/' folder + # get every XML file in folder -for file in os.listdir("."): # You have to put this in folder where output XML files are. +for file in os.listdir(folder_name): if file.endswith(".xml"): - tree = ET.parse(file) + tree = ET.parse(folder_name + '/' + file) root = tree.getroot() - #print ["DEBUG Reading " + file + "..."] + #print "DEBUG Reading " + file + "..." # get subject ID from XML file - subject_id = file # file name as subject ID + subject_id = file[:-4] # file name (without extension) as subject ID # get list of all pages this subject evaluated for audioholder in root.findall("./audioholder"): # iterate over pages page_name = audioholder.get('id') # get page name - #print ["DEBUG page " + page_name] - + if page_name is None: # ignore 'empty' audio_holders break - file_name = 'ratings/'+page_name+'-ratings.csv' # score file name + file_name = folder_name+'/ratings/'+page_name+'-ratings.csv' # score file name # create folder 'ratings if not yet created - if not os.path.exists('ratings'): - os.makedirs('ratings') + if not os.path.exists(folder_name + '/ratings'): + os.makedirs(folder_name + '/ratings') # header: fragment IDs in 'alphabetical' order # go to fragment column, or create new column if it doesn't exist yet # get array of audio elements and number of audio elements - audiolist = root.findall("*/[@id='"+page_name+"']/audioelement") + audiolist = audioholder.findall("./audioelement") n_fragments = len(audiolist) # get alphabetical array of fragment IDs from this subject's XML @@ -43,28 +47,31 @@ # if file exists, get header and add 'new' fragments if os.path.isfile(file_name): - #print ["DEBUG file " + file_name + " already exists - reading header"] + #print "DEBUG file " + file_name + " already exists - reading header" with open(file_name, 'r') as readfile: filereader = csv.reader(readfile, delimiter=',') headerrow = filereader.next() - #headerrow = headerrow[1:] # remove first column (empty) - # Which of the fragmentes are in fragmentnamelist but not in headerrow? - newfragments = list(set(fragmentnamelist)-set(headerrow)) - newfragments = sorted(newfragments) # new fragments in alphabetical order - # If not empty, read file and rewrite adding extra columns - if newfragments: # if not empty - print ["DEBUG New fragments found: " + str(newfragments)] - with open('temp.csv', 'w') as writefile: - filewriter = csv.writer(writefile, delimiter=',') - filewriter.writerow(headerrow + newfragments) # write new header + # Which of the fragmentes are in fragmentnamelist but not in headerrow? + newfragments = list(set(fragmentnamelist)-set(headerrow)) + newfragments = sorted(newfragments) # new fragments in alphabetical order + # If not empty, read file and rewrite adding extra columns + if newfragments: # if not empty + #print "DEBUG New fragments found: " + str(newfragments) + with open('temp.csv', 'w') as writefile: + filewriter = csv.writer(writefile, delimiter=',') + filewriter.writerow(headerrow + newfragments) # write new header + #print " "+str(headerrow + newfragments) # DEBUG + with open(file_name, 'r') as readfile: + filereader = csv.reader(readfile, delimiter=',') + filereader.next() # skip header for row in filereader: # rewrite row plus empty cells for every new fragment name - #print ["DEBUG Old row: " + str(row)] + #print " Old row: " + str(row) # DEBUG filewriter.writerow(row + ['']*len(newfragments)) - #print ["DEBUG New row: " + str(row + ['']*len(newfragments))] - os.rename('temp.csv', file_name) # replace old file with temp file - headerrow = headerrow + newfragments - print ["DEBUG New header row: " + str(headerrow)] + #print " New row: " + str(row + ['']*len(newfragments)) # DEBUG + os.rename('temp.csv', file_name) # replace old file with temp file + headerrow = headerrow + newfragments + #print "DEBUG New header row: " + str(headerrow) # if not, create file and make header else: @@ -85,9 +92,7 @@ # get scores related to fragment [id] for fragmentname in headerrow[1:]: # iterate over fragments in header (skip first empty column) - elementvalue = root.find("*/[@id='" - + page_name - + "']/audioelement/[@id='" + elementvalue = audioholder.find("./audioelement/[@id='" + fragmentname + "']/value") if hasattr(elementvalue, 'text'): # if rating for this fragment exists @@ -96,5 +101,6 @@ ratingrow.append('') # append empty cell # write row: [subject ID, rating fragment ID 1, ..., rating fragment ID M] - filewriter.writerow(ratingrow) + if any(ratingrow[1:]): # append to file if row non-empty (except subject name) + filewriter.writerow(ratingrow)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/score_plot.py Mon Jun 29 19:04:40 2015 +0100 @@ -0,0 +1,150 @@ +#!/usr/bin/python + +import sys +import os +import csv +import matplotlib.pyplot as plt +import numpy as np +import scipy as sp +import scipy.stats + +# CONFIGURATION + +# Which type(s) of plot do you want? +enable_boxplot = False # show box plot +enable_confidence = True # show confidence interval +confidence = 0.90 # confidence value (for confidence interval plot) +enable_individual = True # show all individual ratings +show_individual = [] # show specific individuals +show_legend = False # show names of individuals +#TODO: Merge, implement this functionality +#TODO: Control by CLI arguments (plot types, save and/or show, ...) + +# Enter folder where rating CSV files are (generated with score_parser.py or same format). +rating_folder = '../saves/ratings/' # folder with rating csv files + +# Font settings +font = {'weight' : 'bold', + 'size' : 10} +plt.rc('font', **font) + + +# CODE + +# get every csv file in folder +for file in os.listdir(rating_folder): # You have to put this in folder where rating csv files are. + if file.endswith(".csv"): + page_name = file[:-4] # file name (without extension) is page ID + + # get header + with open(rating_folder+file, 'rb') as readfile: # read this csv file + filereader = csv.reader(readfile, delimiter=',') + headerrow = filereader.next() # use headerrow as X-axis + headerrow = headerrow[1:] + + # read ratings into matrix +# ratings = np.loadtxt(open(rating_folder+file,"rb"), +# delimiter=",", +# skiprows=1, +# usecols=range(1,len(headerrow)+1) +# ) + ratings = np.genfromtxt(readfile, + delimiter=",", + #skip_header = 1, + converters = {3: lambda s: float(s or 'Nan')}, + usecols=range(1,len(headerrow)+1) + ) + + # assert at least 2 subjects (move on to next file if violated) + if ratings.shape[1]<2: + print "WARNING: Just one subject for " + page_name + ". Moving on to next file." + break + + # BOXPLOT + if enable_boxplot: + plt.boxplot(ratings) + + # CONFIDENCE INTERVAL + if enable_confidence: + iterator = 0 + for column in ratings.T: # iterate over transposed matrix + # remove all 'Nan's from column + column = column[~np.isnan(column)] + + # get number of non-Nan ratings (= #subjects) + n = column.size + + # get mean + mean_rating = np.mean(column) + + # get errors + err = scipy.stats.sem(column)* sp.stats.t._ppf((1+confidence)/2., n-1) + + # draw plot + plt.errorbar(iterator+1, + mean_rating, + yerr=err, + marker="x", + color ="k", + markersize=12, + linestyle='None') + + iterator += 1 # increase counter + + + # INDIVIDUAL PLOT + if enable_individual or show_individual: + # marker list and color map to cycle through + markerlist = ["x", ".", "o", "*", "+", "v", ">", "<", "8", "s", "p"] + colormap = ['b', 'r', 'g', 'c', 'm', 'y', 'k'] + increment = 0 + linehandles = [] + legendnames = [] + with open(rating_folder+file, 'rb') as readfile: # read this csv file + filereader = csv.reader(readfile, delimiter=',') + headerrow = filereader.next() # use headerrow as X-axis + headerrow = headerrow[1:] + for row in filereader: + subject_id = row[0][:-4] # read from beginning of line + # assume plotting all individuals if no individual(s) specified + if not show_individual or subject_id in show_individual: + plothandle, = plt.plot(range(1,len(row)), # x-values + ratings[increment,:],#row[1:], # y-values: csv values except subject name + color=colormap[increment%len(colormap)], + marker=markerlist[increment%len(markerlist)], + markersize=10, + linestyle='None', + label=subject_id + ) + linehandles.append(plothandle) + legendnames.append(subject_id) + if show_legend: + plt.legend(linehandles, legendnames, + loc='upper right', + bbox_to_anchor=(1.1, 1), + borderaxespad=0., + numpoints=1 # remove extra marker + ) + increment += 1 # increase counter + + # TITLE, AXIS LABELS AND LIMITS + plt.title(page_name) + plt.xlabel('Fragment') + plt.xlim(0, len(headerrow)+1) # only show relevant region, leave space left & right) + plt.xticks(range(1, len(headerrow)+1), headerrow) # show fragment names + plt.ylabel('Rating') + plt.ylim(0,1) + + + + # SHOW PLOT + #plt.show() + #exit() + + # SAVE PLOT + # automatically + plot_type = ("-box" if enable_boxplot else "") + \ + ("-conf" if enable_confidence else "") + \ + ("-ind" if enable_individual else "") + plt.savefig(rating_folder+page_name+plot_type+".png") + plt.close()
--- a/scripts/timeline_view.py Sun Jun 28 09:52:47 2015 +0100 +++ b/scripts/timeline_view.py Mon Jun 29 19:04:40 2015 +0100 @@ -1,20 +1,36 @@ +#!/usr/bin/python + import xml.etree.ElementTree as ET import os import matplotlib.pyplot as plt -colormap = ['b', 'r', 'g', 'c', 'm', 'y', 'k'] # colormap for to cycle through +# CONFIGURATION -timeline_folder = 'timelines/' # folder where to store timelines, e.g. 'timelines/' +# XML results files location (modify as needed): +folder_name = "../saves" # Looks in 'saves/' folder from 'scripts/' folder +# Folder where to store timelines +timeline_folder = folder_name + '/timelines/' # Stores in 'saves/timelines/' + +# Font settings +font = {'weight' : 'bold', + 'size' : 16} +plt.rc('font', **font) + +# Colormap for to cycle through +colormap = ['b', 'r', 'g', 'c', 'm', 'y', 'k'] + + +# CODE # create timeline_folder if not yet created if not os.path.exists(timeline_folder): os.makedirs(timeline_folder) # get every XML file in folder -for file in os.listdir("."): # You have to put this script in folder where output XML files are. +for file in os.listdir(folder_name): if file.endswith(".xml"): - tree = ET.parse(file) + tree = ET.parse(folder_name + '/' + file) root = tree.getroot() subject_id = file[:-4] # drop '.xml' @@ -28,7 +44,7 @@ break # SORT AUDIO ELEMENTS ALPHABETICALLY - audioelements = root.findall("*/[@id='"+page_name+"']/audioelement") + audioelements = audioholder.findall("./audioelement") data = [] for elem in audioelements: # from http://effbot.org/zone/element-sort.htm @@ -48,11 +64,7 @@ audioelements_names.append(audio_id) # for this audioelement, loop over all listen events - listen_events = root.findall("*/[@id='" - + page_name - + "']/audioelement/[@id='" - + audio_id - + "']/metric/metricresult/[@name='elementListenTracker']/event") + listen_events = audioelement.findall("./metric/metricresult/[@name='elementListenTracker']/event") for event in listen_events: # get testtime: start and stop start_time = event.find('testtime').get('start')