Mercurial > hg > webaudioevaluationtool
changeset 2232:e25eff80e48e
Merge branch 'master' of https://github.com/BrechtDeMan/WebAudioEvaluationTool
author | www-data <www-data@sucuk.dcs.qmul.ac.uk> |
---|---|
date | Thu, 14 Apr 2016 21:20:58 +0100 |
parents | 555dc922aa79 (current diff) 55c0e82eba1d (diff) |
children | 4aebfedf87b9 |
files | |
diffstat | 4 files changed, 133 insertions(+), 99 deletions(-) [+] |
line wrap: on
line diff
--- a/docs/Instructions/Instructions.bib Thu Apr 14 17:20:58 2016 +0100 +++ b/docs/Instructions/Instructions.bib Thu Apr 14 21:20:58 2016 +0100 @@ -1,7 +1,7 @@ %% This BibTeX bibliography file was created using BibDesk. %% http://bibdesk.sourceforge.net/ -%% Created for Brecht De Man at 2016-04-12 20:00:45 +0100 +%% Created for Brecht De Man at 2016-04-12 20:40:28 +0100 %% Saved with string encoding Unicode (UTF-8)
--- a/docs/Instructions/Instructions.tex Thu Apr 14 17:20:58 2016 +0100 +++ b/docs/Instructions/Instructions.tex Thu Apr 14 21:20:58 2016 +0100 @@ -47,62 +47,86 @@ \textbf{Main folder:} \begin{itemize} - \item \texttt{core.css, graphics.css, structure.css}: core style files (edit to change appearance) - \item \texttt{CITING.txt, LICENSE.txt, README.md}: text files with, respectively, the citation which we ask to include in any work where this tool or any portion thereof is used, modified or otherwise; the license under which the software is shared; and a general readme file. - \item \texttt{core.js}: JavaScript file with core functionality - \item \texttt{demo.html}: Several demonstrations of listening tests, using examples from the example\_eval folder - \item \texttt{index.html}: webpage where interface should appear (append link to configuration XML, e.g. index.html?url=config.xml) - \item \texttt{jquery-2.1.4.js}: jQuery JavaScript Library - \item \texttt{keygen.php}: generates a unique file name for saved results - \item \texttt{loudness.js}: Allows for automatic calculation of loudness of Web Audio API Buffer objects, return gain values to correct for a target loudness or match loudness between multiple objects - \item \texttt{pseudo.php}: allows for pseudo-random selection from a range of configuration XML files - \item \texttt{pythonServer.py}: webserver for running tests locally - \item \texttt{pythonServer-legacy.py}: webserver with limited functionality (no automatic storing of output XML files) - \item \texttt{save.php}: PHP script to store result XML files to web server - \item \texttt{scaledefinitions.xml}: marker text and positions for various scales - \item \texttt{specification.js}: decodes configuration XML to JavaScript object - \item \texttt{test-schema.xsd}: definition of configuration and result XML file structure - \item \texttt{WAVE.js}: decodes and performs WAVE file byte level manipulation - \item \texttt{xmllint.js}: XML validation\\ + \item \texttt{CITING.txt, LICENSE.txt, README.md}: text files with, respectively, the citation which we ask to include in any work where this tool or any portion thereof is used, modified or otherwise; the license under which the software is shared; and a general readme file. + \item \texttt{demo.html}: Several demonstrations of listening tests, using examples from the example\_eval folder + \item \texttt{index.html}: webpage where interface should appear (append link to configuration XML, e.g. index.html?url=config.xml) + \item \texttt{pythonServer.py}: webserver for running tests locally + \item \texttt{pythonServer-legacy.py}: webserver with limited functionality (no automatic storing of output XML files) + \\ \end{itemize} \textbf{Analysis of results (\texttt{./analysis/})} - \begin{itemize} - \item \texttt{analyse.html}: analysis and diagnostics of a set of result XML files (legacy) - \item \texttt{analysis.css}: analysis page style file - \item \texttt{analysis.js}: analysis functions - \item \texttt{index.html}: web page where analysis of stored results can be performed + \begin{itemize} + \item \texttt{analyse.html}: analysis and diagnostics of a set of result XML files (legacy) + \item \texttt{analysis.css}: analysis page style file + \item \texttt{analysis.js}: analysis functions + \item \texttt{index.html}: web page where analysis of stored results can be performed \end{itemize} - \textbf{Documentation (\texttt{./docs/})} - \begin{itemize} - \item AESPosterComp: PDF and \LaTeX source of Audio Engineering Society UK Sustaining Members event at Solid State Logic, Begbroke - \item \href{http://c4dm.eecs.qmul.ac.uk/dmrn/events/dmrnp10/#posters}{DMRN+10}: PDF and \LaTeX source of poster for 10\textsuperscript{th} Digital Music Research Network One-Day workshop (``soft launch'') - \item Instructions: PDF and \LaTeX source of these instructions - \item Project Specification Document (\LaTeX/PDF) - \item Results Specification Document (\LaTeX/PDF) - \item SMC15: PDF and \LaTeX source of 12th Sound and Music Computing Conference paper \cite{waet} - \item WAC2016: PDF and \LaTeX source of 2nd Web Audio Conference paper \cite{waetwac} - \item WAC2016Poster: PDF and \LaTeX source of 2nd Web Audio Conference poster\\ + \textbf{CSS files (\texttt{./css/})} + \begin{itemize} + \item \texttt{core.css}: core style file (edit to change appearance) \end{itemize} - \textbf{Example project (\texttt{./example\_eval/})} - \begin{itemize} - \item 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).\\ - \end{itemize} - \textbf{Interface files (\texttt{./interfaces/})} - \begin{itemize} - \item Each interface class has a JavaScript file and an optional CSS style file. These are loaded as needed. - \end{itemize} - \textbf{Output files (\texttt{./saves/})} - \begin{itemize} - \item The output XML files of tests will be stored here by default by the \texttt{pythonServer.py} script.\\ - \end{itemize} - \textbf{Auxiliary scripts (\texttt{./scripts/})} - \begin{itemize} - \item Helpful Python and PHP scripts for extraction and visualisation of data.\\ - \end{itemize} - \textbf{Test creation tool (\texttt{./test\_create/})} - \begin{itemize} - \item Webpage for easily setting up your own test without having to delve into the XML.\\ - \end{itemize} + \textbf{Documentation (\texttt{./docs/})} + \begin{itemize} + \item AESPosterComp: PDF and \LaTeX source of Audio Engineering Society UK Sustaining Members event at Solid State Logic, Begbroke + \item \href{http://c4dm.eecs.qmul.ac.uk/dmrn/events/dmrnp10/#posters}{DMRN+10}: PDF and \LaTeX source of poster for 10\textsuperscript{th} Digital Music Research Network One-Day workshop (``soft launch'') + \item Instructions: PDF and \LaTeX source of these instructions + \item Project Specification Document (\LaTeX/PDF) + \item Results Specification Document (\LaTeX/PDF) + \item SMC15: PDF and \LaTeX source of 12th Sound and Music Computing Conference paper \cite{waet} + \item WAC2016: PDF and \LaTeX source of 2nd Web Audio Conference paper \cite{waetwac} + \item WAC2016Poster: PDF and \LaTeX source of 2nd Web Audio Conference poster\\ + \end{itemize} + \textbf{Interface files (\texttt{./interfaces/})} + \begin{itemize} + \item Each interface class has a JavaScript file and an optional CSS style file. These are loaded as needed. + \end{itemize} + \textbf{JavaScript code (\texttt{./js/})} + \begin{itemize} + \item \texttt{core.js}: JavaScript file with core functionality + \item \texttt{jquery-2.1.4.js}: jQuery JavaScript Library + \item \texttt{loudness.js}: Allows for automatic calculation of loudness of Web Audio API Buffer objects, return gain values to correct for a target loudness or match loudness between multiple objects + \item \texttt{specification.js}: decodes configuration XML to JavaScript object + \item \texttt{WAVE.js}: decodes and performs WAVE file byte level manipulation + \item \texttt{xmllint.js}: XML validation + \end{itemize} + \textbf{Media files (\texttt{./media/})} + \begin{itemize} + \item \texttt{example}: contains 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). + \end{itemize} + \textbf{PHP scripts (\texttt{./php/})} + \begin{itemize} + \item \texttt{keygen.php}: generates a unique file name for saved results + \item \texttt{pseudo.php}: allows for pseudo-random selection from a range of configuration XML files + \item \texttt{save.php}: PHP script to store result XML files to web server + \item PHP analysis scripts % ELABORATE + \end{itemize} + \textbf{Output files (\texttt{./saves/})} + \begin{itemize} + \item The output XML files of tests will be stored here by default by the \texttt{pythonServer.py} script.\\ + \end{itemize} + \textbf{Auxiliary scripts (\texttt{./scripts/})} + \begin{itemize} + \item Helpful Python and PHP scripts for extraction and visualisation of data.\\ + \end{itemize} + \textbf{Test creation tool (\texttt{./test\_create/})} + \begin{itemize} + \item Webpage for easily setting up your own test without having to delve into the XML.\\ + \end{itemize} + \textbf{Tests (\texttt{./tests/})} + \begin{itemize} + \item This is where you can store your configuration XML files. + \item Contains a folder with examples.\\ % ELABORATE + \end{itemize} + \textbf{XML specifications (\texttt{./xml/})} + \begin{itemize} + \item \texttt{scaledefinitions.xml}: marker text and positions for various scales + \item \texttt{test-schema.xsd}: definition of configuration and result XML file structure\\ % ELABORATE + \end{itemize} + + % \textbf{Example project (\texttt{./example\_eval/})} + % \begin{itemize} + % \item An example of what the set up XML should look like, + % \end{itemize} \subsection{Compatibility} As Microsoft Internet Explorer doesn't support the Web Audio API\footnote{\url{http://caniuse.com/\#feat=audio-api}}, you will need another browser like Google Chrome, Safari or Firefox (all three are tested and confirmed to work).
--- a/scripts/pythonServer.py Thu Apr 14 17:20:58 2016 +0100 +++ b/scripts/pythonServer.py Thu Apr 14 21:20:58 2016 +0100 @@ -26,9 +26,10 @@ scriptdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) # script directory os.chdir(scriptdir) # does this work? -PSEUDO_PATH = '../example_eval/' +PSEUDO_PATH = '../tests/' pseudo_files = [] for filename in listdir(PSEUDO_PATH): + print(filename) if filename.endswith('.xml'): pseudo_files.append(filename) @@ -38,12 +39,12 @@ curSaveIndex += 1; curFileName = 'test-'+str(curSaveIndex)+'.xml' -pseudo_index = curSaveIndex % len(pseudo_files) +if len(pseudo_files) > 0: + pseudo_index = curSaveIndex % len(pseudo_files) +else: + pseudo_index = 0 -if sys.version_info[0] == 2: - print 'URL: http://localhost:8000/index.html' -elif sys.version_info[0] == 3: - print('URL: http://localhost:8000/index.html') +print('URL: http://localhost:8000/index.html') def send404(s): s.send_response(404) @@ -82,7 +83,7 @@ st = s.path.rsplit(',') lenSt = len(st) fmt = st[lenSt-1].rsplit('.') - fpath = "../"+urllib2.unquote(s.path) + fpath = "../"+urllib2.parse.unquote(s.path) s.send_response(200) if (fmt[1] == 'html'): s.send_header("Content-type", 'text/html') @@ -113,7 +114,7 @@ options = s.path.rsplit('?') options = options[1].rsplit('=') key = options[1] - print key + print("Registered key "+key) if os.path.isfile("saves/save-"+key+".xml"): reply = "<response><state>NO</state><key>"+key+"</key></response>" else: @@ -132,13 +133,9 @@ options = self.path.rsplit('?') options = options[1].rsplit('=') key = options[1] - print key varLen = int(self.headers['Content-Length']) postVars = self.rfile.read(varLen) - if sys.version_info[0] == 2: - print "Saving file key "+key - elif sys.version_info[0] == 3: - print("Saving file key "+key) + print("Saving file key "+key) file = open('../saves/save-'+key+'.xml','w') file.write(postVars) file.close() @@ -156,47 +153,60 @@ curSaveIndex += 1 curFileName = 'test-'+str(curSaveIndex)+'.xml' -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) - elif (request.path.split('?',1)[0] == "/keygen.php"): - keygen(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 http_do_HEAD(s): + s.send_response(200) + s.send_header("Content-type", "text/html") + s.end_headers() - def do_POST(request): - if(request.client_address[0] == "127.0.0.1"): - if (request.path.rsplit('?',1)[0] == "/save" or request.path.rsplit('?',1)[0] == "/save.php"): - saveFile(request) - else: - send404(request) +def http_do_GET(request): + if(request.client_address[0] == "127.0.0.1"): + if (request.path == "/favicon.ico"): + send404(request) + elif (request.path.split('?',1)[0] == "/keygen.php"): + keygen(request); + else: + request.path = request.path.split('?',1)[0] + 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 http_do_POST(request): + if(request.client_address[0] == "127.0.0.1"): + if (request.path.rsplit('?',1)[0] == "/save" or request.path.rsplit('?',1)[0] == "/save.php"): + saveFile(request) + else: + send404(request) + if sys.version_info[0] == 2: + class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): + def do_HEAD(s): + http_do_HEAD(s) + def do_GET(request): + http_do_GET(request) + def do_POST(request): + http_do_POST(request) def run(server_class=BaseHTTPServer.HTTPServer,handler_class=MyHandler): server_address = ('', 8000) httpd = server_class(server_address, handler_class) httpd.serve_forever() + run() elif sys.version_info[0] == 3: + class MyHandler(BaseHTTPRequestHandler): + def do_HEAD(s): + send404(s) + def do_GET(request): + http_do_GET(request) + def do_POST(request): + http_do_POST(request) def run(server_class=HTTPServer,handler_class=MyHandler): server_address = ('', 8000) httpd = server_class(server_address, handler_class) httpd.serve_forever() - -run() + run()