From 9a9421aa876efafd41479221cf359516933b72d0 Mon Sep 17 00:00:00 2001 From: Alexander James Wallar Date: Sat, 1 Feb 2014 04:26:59 +0000 Subject: [PATCH] Starting to do a write up --- Makefile | 3 + .../src/com/locaudio/io/WaveWriter.java | 14 +- .../com/locaudio/locabean/NodeActivity.java | 6 + docs/paper/minted.sty | 239 +++++++++++++++++ docs/paper/paper.aux | 5 + docs/paper/paper.log | 240 ++++++++++++++++++ docs/paper/paper.tex | 84 ++++++ locaudio/detectionserver.py | 18 +- locaudio/templates/graph.html | 46 ++-- tests/test_server.py | 6 +- 10 files changed, 624 insertions(+), 37 deletions(-) create mode 100644 docs/paper/minted.sty create mode 100644 docs/paper/paper.aux create mode 100644 docs/paper/paper.log create mode 100644 docs/paper/paper.tex diff --git a/Makefile b/Makefile index 5bfece0..b15fdb0 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,9 @@ depend: mkdir imgs mkdir sounds +paper: + cd docs/paper; pdflatex paper.tex; cd ../../; + documentation: cd docs; doxygen Doxyfile; cd .. diff --git a/app/Locabean/src/com/locaudio/io/WaveWriter.java b/app/Locabean/src/com/locaudio/io/WaveWriter.java index baf1e7e..1b2a098 100644 --- a/app/Locabean/src/com/locaudio/io/WaveWriter.java +++ b/app/Locabean/src/com/locaudio/io/WaveWriter.java @@ -95,9 +95,9 @@ public static Thread getRecorderThread(final AudioRecord recorder, @Override public void run() { - WaveWriter.writeAudioDataToFile(recorder, isRecording); + writeAudioDataToFile(recorder, isRecording); } - }, WaveWriter.AUDIO_RECORDER_THREAD_NAME); + }, AUDIO_RECORDER_THREAD_NAME); } public static void copyWaveFile(String inFilename, String outFilename) { @@ -170,7 +170,7 @@ public static void deleteTempFile() { public static void writeAudioDataToFile(AudioRecord recorder, boolean isRecording) { - byte data[] = new byte[WaveWriter.BUFFER_SIZE]; + byte data[] = new byte[BUFFER_SIZE]; String filename = getTempFilename(); FileOutputStream os = null; @@ -185,7 +185,7 @@ public static void writeAudioDataToFile(AudioRecord recorder, if (null != os) { while (isRecording) { - read = recorder.read(data, 0, WaveWriter.BUFFER_SIZE); + read = recorder.read(data, 0, BUFFER_SIZE); if (AudioRecord.ERROR_INVALID_OPERATION != read) { try { @@ -248,9 +248,9 @@ public static Wave stopRecording() { deleteTempFile(); return getWave(); } - + public static Wave record(int seconds) { - + try { startRecording(); Thread.sleep(seconds * 1000); @@ -261,7 +261,7 @@ public static Wave record(int seconds) { stopRecording(); return null; } - + } } diff --git a/app/Locabean/src/com/locaudio/locabean/NodeActivity.java b/app/Locabean/src/com/locaudio/locabean/NodeActivity.java index 44761b0..fe6b861 100644 --- a/app/Locabean/src/com/locaudio/locabean/NodeActivity.java +++ b/app/Locabean/src/com/locaudio/locabean/NodeActivity.java @@ -35,6 +35,12 @@ public void onStop() { super.onStop(); acquisitionThread.kill(); } + + @Override + public void onDestroy() { + super.onDestroy(); + acquisitionThread.kill(); + } private void setupTextViews() { nameTextView = (TextView) findViewById(R.id.nameTextView); diff --git a/docs/paper/minted.sty b/docs/paper/minted.sty new file mode 100644 index 0000000..0e0585c --- /dev/null +++ b/docs/paper/minted.sty @@ -0,0 +1,239 @@ +%% +%% This is file `minted.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% minted.dtx (with options: `package') +%% Copyright 2010--2011 Konrad Rudolph +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% Additionally, the project may be distributed under the terms of the new BSD +%% license. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Konrad Rudolph. +%% +%% This work consists of the files minted.dtx and minted.ins +%% and the derived file minted.sty. +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{minted}[2011/09/17 v1.7 Yet another Pygments shim for LaTeX] +\RequirePackage{keyval} +\RequirePackage{fancyvrb} +\RequirePackage{xcolor} +\RequirePackage{float} +\RequirePackage{ifthen} +\RequirePackage{calc} +\RequirePackage{ifplatform} +\DeclareOption{chapter}{\def\minted@float@within{chapter}} +\DeclareOption{section}{\def\minted@float@within{section}} +\ProcessOptions\relax +\ifwindows + \providecommand\DeleteFile[1]{\immediate\write18{del #1}} +\else + \providecommand\DeleteFile[1]{\immediate\write18{rm #1}} +\fi +\newboolean{AppExists} +\newcommand\TestAppExists[1]{ + \ifwindows + \DeleteFile{\jobname.aex} + \immediate\write18{for \string^\@percentchar i in (#1.exe #1.bat #1.cmd) + do set >\jobname.aex >\jobname.aex} %$ + \newread\@appexistsfile + \immediate\openin\@appexistsfile\jobname.aex + \expandafter\def\expandafter\@tmp@cr\expandafter{\the\endlinechar} + \endlinechar=-1\relax + \readline\@appexistsfile to \@apppathifexists + \endlinechar=\@tmp@cr + \ifthenelse{\equal{\@apppathifexists}{}} + {\AppExistsfalse} + {\AppExiststrue} + \immediate\closein\@appexistsfile + \DeleteFile{\jobname.aex} +\immediate\typeout{file deleted} + \else + \immediate\write18{which #1 && touch \jobname.aex} + \IfFileExists{\jobname.aex} + {\AppExiststrue + \DeleteFile{\jobname.aex}} + {\AppExistsfalse} + \fi} +\newcommand\minted@resetoptions{} +\newcommand\minted@defopt[1]{ + \expandafter\def\expandafter\minted@resetoptions\expandafter{% + \minted@resetoptions + \@namedef{minted@opt@#1}{}}} +\newcommand\minted@opt[1]{ + \expandafter\detokenize% + \expandafter\expandafter\expandafter{\csname minted@opt@#1\endcsname}} +\newcommand\minted@define@opt[3][]{ + \minted@defopt{#2} + \ifthenelse{\equal{#1}{}}{ + \define@key{minted@opt}{#2}{\@namedef{minted@opt@#2}{#3}}} + {\define@key{minted@opt}{#2}[#1]{\@namedef{minted@opt@#2}{#3}}}} +\newcommand\minted@define@switch[3][]{ + \minted@defopt{#2} + \define@booleankey{minted@opt}{#2} + {\@namedef{minted@opt@#2}{#3}} + {\@namedef{minted@opt@#2}{#1}}} +\minted@defopt{extra} +\newcommand\minted@define@extra[1]{ + \define@key{minted@opt}{#1}{ + \expandafter\def\expandafter\minted@opt@extra\expandafter{% + \minted@opt@extra,#1=##1}}} +\newcommand\minted@define@extra@switch[1]{ + \define@booleankey{minted@opt}{#1} + {\expandafter\def\expandafter\minted@opt@extra\expandafter{% + \minted@opt@extra,#1}} + {\expandafter\def\expandafter\minted@opt@extra\expandafter{% + \minted@opt@extra,#1=false}}} +\minted@define@switch{texcl}{-P texcomments} +\minted@define@switch{mathescape}{-P mathescape} +\minted@define@switch{linenos}{-P linenos} +\minted@define@switch{startinline}{-P startinline} +\minted@define@switch[-P funcnamehighlighting=False]% + {funcnamehighlighting}{-P funcnamehighlighting} +\minted@define@opt{gobble}{-F gobble:n=#1} +\minted@define@opt{bgcolor}{#1} +\minted@define@extra{frame} +\minted@define@extra{framesep} +\minted@define@extra{framerule} +\minted@define@extra{rulecolor} +\minted@define@extra{numbersep} +\minted@define@extra{firstnumber} +\minted@define@extra{stepnumber} +\minted@define@extra{firstline} +\minted@define@extra{lastline} +\minted@define@extra{baselinestretch} +\minted@define@extra{xleftmargin} +\minted@define@extra{xrightmargin} +\minted@define@extra{fillcolor} +\minted@define@extra{tabsize} +\minted@define@extra{fontfamily} +\minted@define@extra{fontsize} +\minted@define@extra{fontshape} +\minted@define@extra{fontseries} +\minted@define@extra{formatcom} +\minted@define@extra{label} +\minted@define@extra@switch{numberblanklines} +\minted@define@extra@switch{showspaces} +\minted@define@extra@switch{resetmargins} +\minted@define@extra@switch{samepage} +\minted@define@extra@switch{showtabs} +\minted@define@extra@switch{obeytabs} +\newsavebox{\minted@bgbox} +\newenvironment{minted@colorbg}[1]{ + \def\minted@bgcol{#1} + \noindent + \begin{lrbox}{\minted@bgbox} + \begin{minipage}{\linewidth-2\fboxsep}} + {\end{minipage} + \end{lrbox}% + \colorbox{\minted@bgcol}{\usebox{\minted@bgbox}}} +\newwrite\minted@code +\newcommand\minted@savecode[1]{ + \immediate\openout\minted@code\jobname.pyg + \immediate\write\minted@code{#1} + \immediate\closeout\minted@code} +\newcommand\minted@pygmentize[2][\jobname.pyg]{ + \def\minted@cmd{pygmentize -l #2 -f latex -F tokenmerge + \minted@opt{gobble} \minted@opt{texcl} \minted@opt{mathescape} + \minted@opt{startinline} \minted@opt{funcnamehighlighting} + \minted@opt{linenos} -P "verboptions=\minted@opt{extra}" + -o \jobname.out.pyg #1} + \immediate\write18{\minted@cmd} + % For debugging, uncomment: + %\immediate\typeout{\minted@cmd} + \ifthenelse{\equal{\minted@opt@bgcolor}{}} + {} + {\begin{minted@colorbg}{\minted@opt@bgcolor}} + \input{\jobname.out.pyg} + \ifthenelse{\equal{\minted@opt@bgcolor}{}} + {} + {\end{minted@colorbg}} + \DeleteFile{\jobname.out.pyg}} +\newcommand\minted@usedefaultstyle{\usemintedstyle{default}} +\newcommand\usemintedstyle[1]{ + \renewcommand\minted@usedefaultstyle{} + \immediate\write18{pygmentize -S #1 -f latex > \jobname.pyg} + \input{\jobname.pyg}} +\newcommand\mint[3][]{ + \DefineShortVerb{#3} + \minted@resetoptions + \setkeys{minted@opt}{#1} + \SaveVerb[aftersave={ + \UndefineShortVerb{#3} + \minted@savecode{\FV@SV@minted@verb} + \minted@pygmentize{#2} + \DeleteFile{\jobname.pyg}}]{minted@verb}#3} +\newcommand\minted@proglang[1]{} +\newenvironment{minted}[2][] + {\VerbatimEnvironment + \renewcommand{\minted@proglang}[1]{#2} + \minted@resetoptions + \setkeys{minted@opt}{#1} + \begin{VerbatimOut}[codes={\catcode`\^^I=12}]{\jobname.pyg}}% + {\end{VerbatimOut} + \minted@pygmentize{\minted@proglang{}} + \DeleteFile{\jobname.pyg}} +\newcommand\inputminted[3][]{ + \minted@resetoptions + \setkeys{minted@opt}{#1} + \minted@pygmentize[#3]{#2}} +\newcommand\newminted[3][]{ + \ifthenelse{\equal{#1}{}} + {\def\minted@envname{#2code}} + {\def\minted@envname{#1}} + \newenvironment{\minted@envname} + {\VerbatimEnvironment\begin{minted}[#3]{#2}} + {\end{minted}} + \newenvironment{\minted@envname *}[1] + {\VerbatimEnvironment\begin{minted}[#3,##1]{#2}} + {\end{minted}}} +\newcommand\newmint[3][]{ + \ifthenelse{\equal{#1}{}} + {\def\minted@shortname{#2}} + {\def\minted@shortname{#1}} + \expandafter\newcommand\csname\minted@shortname\endcsname[2][]{ + \mint[#3,##1]{#2}##2}} +\newcommand\newmintedfile[3][]{ + \ifthenelse{\equal{#1}{}} + {\def\minted@shortname{#2file}} + {\def\minted@shortname{#1}} + \expandafter\newcommand\csname\minted@shortname\endcsname[2][]{ + \inputminted[#3,##1]{#2}{##2}}} +\@ifundefined{minted@float@within} + {\newfloat{listing}{h}{lol}} + {\newfloat{listing}{h}{lol}[\minted@float@within]} +\newcommand\listingscaption{Listing} +\floatname{listing}{\listingscaption} +\newcommand\listoflistingscaption{List of listings} +\providecommand\listoflistings{\listof{listing}{\listoflistingscaption}} +\AtBeginDocument{ + \minted@usedefaultstyle} +\AtEndOfPackage{ + \ifnum\pdf@shellescape=1\relax\else + \PackageError{minted} + {You must invoke LaTeX with the + -shell-escape flag} + {Pass the -shell-escape flag to LaTeX. Refer to the minted.sty + documentation for more information.}\fi + \TestAppExists{pygmentize} + \ifAppExists\else + \PackageError{minted} + {You must have `pygmentize' installed + to use this package} + {Refer to the installation instructions in the minted + documentation for more information.} + \fi} +\endinput +%% +%% End of file `minted.sty'. diff --git a/docs/paper/paper.aux b/docs/paper/paper.aux new file mode 100644 index 0000000..682f65a --- /dev/null +++ b/docs/paper/paper.aux @@ -0,0 +1,5 @@ +\relax +\@writefile{toc}{\contentsline {section}{\numberline {1}Implementation}{1}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Acquisition}{1}} +\@writefile{lop}{\contentsline {program}{\numberline {1}{\ignorespaces Node Event Structure}}{1}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Localization}{2}} diff --git a/docs/paper/paper.log b/docs/paper/paper.log new file mode 100644 index 0000000..6e399fb --- /dev/null +++ b/docs/paper/paper.log @@ -0,0 +1,240 @@ +This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013) (format=pdflatex 2013.5.30) 1 FEB 2014 04:26 +entering extended mode + restricted \write18 enabled. + %&-line parsing enabled. +**paper.tex +(./paper.tex +LaTeX2e <2011/06/27> +Babel <3.9f> and hyphenation patterns for 78 languages loaded. +(/usr/local/texlive/2013/texmf-dist/tex/latex/base/article.cls +Document Class: article 2007/10/19 v1.4h Standard LaTeX document class +(/usr/local/texlive/2013/texmf-dist/tex/latex/base/size12.clo +File: size12.clo 2007/10/19 v1.4h Standard LaTeX file (size option) +) +\c@part=\count79 +\c@section=\count80 +\c@subsection=\count81 +\c@subsubsection=\count82 +\c@paragraph=\count83 +\c@subparagraph=\count84 +\c@figure=\count85 +\c@table=\count86 +\abovecaptionskip=\skip41 +\belowcaptionskip=\skip42 +\bibindent=\dimen102 +) +(/usr/local/texlive/2013/texmf-dist/tex/latex/graphics/graphicx.sty +Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR) + +(/usr/local/texlive/2013/texmf-dist/tex/latex/graphics/keyval.sty +Package: keyval 1999/03/16 v1.13 key=value parser (DPC) +\KV@toks@=\toks14 +) +(/usr/local/texlive/2013/texmf-dist/tex/latex/graphics/graphics.sty +Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR) + +(/usr/local/texlive/2013/texmf-dist/tex/latex/graphics/trig.sty +Package: trig 1999/03/16 v1.09 sin cos tan (DPC) +) +(/usr/local/texlive/2013/texmf-dist/tex/latex/latexconfig/graphics.cfg +File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live +) +Package graphics Info: Driver file: pdftex.def on input line 91. + +(/usr/local/texlive/2013/texmf-dist/tex/latex/pdftex-def/pdftex.def +File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX + +(/usr/local/texlive/2013/texmf-dist/tex/generic/oberdiek/infwarerr.sty +Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) +) +(/usr/local/texlive/2013/texmf-dist/tex/generic/oberdiek/ltxcmds.sty +Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO) +) +\Gread@gobject=\count87 +)) +\Gin@req@height=\dimen103 +\Gin@req@width=\dimen104 +) +(/usr/local/texlive/2013/texmf-dist/tex/latex/amsmath/amsmath.sty +Package: amsmath 2013/01/14 v2.14 AMS math features +\@mathmargin=\skip43 + +For additional information on amsmath, use the `?' option. +(/usr/local/texlive/2013/texmf-dist/tex/latex/amsmath/amstext.sty +Package: amstext 2000/06/29 v2.01 + +(/usr/local/texlive/2013/texmf-dist/tex/latex/amsmath/amsgen.sty +File: amsgen.sty 1999/11/30 v2.0 +\@emptytoks=\toks15 +\ex@=\dimen105 +)) +(/usr/local/texlive/2013/texmf-dist/tex/latex/amsmath/amsbsy.sty +Package: amsbsy 1999/11/29 v1.2d +\pmbraise@=\dimen106 +) +(/usr/local/texlive/2013/texmf-dist/tex/latex/amsmath/amsopn.sty +Package: amsopn 1999/12/14 v2.01 operator names +) +\inf@bad=\count88 +LaTeX Info: Redefining \frac on input line 210. +\uproot@=\count89 +\leftroot@=\count90 +LaTeX Info: Redefining \overline on input line 306. +\classnum@=\count91 +\DOTSCASE@=\count92 +LaTeX Info: Redefining \ldots on input line 378. +LaTeX Info: Redefining \dots on input line 381. +LaTeX Info: Redefining \cdots on input line 466. +\Mathstrutbox@=\box26 +\strutbox@=\box27 +\big@size=\dimen107 +LaTeX Font Info: Redeclaring font encoding OML on input line 566. +LaTeX Font Info: Redeclaring font encoding OMS on input line 567. +\macc@depth=\count93 +\c@MaxMatrixCols=\count94 +\dotsspace@=\muskip10 +\c@parentequation=\count95 +\dspbrk@lvl=\count96 +\tag@help=\toks16 +\row@=\count97 +\column@=\count98 +\maxfields@=\count99 +\andhelp@=\toks17 +\eqnshift@=\dimen108 +\alignsep@=\dimen109 +\tagshift@=\dimen110 +\tagwidth@=\dimen111 +\totwidth@=\dimen112 +\lineht@=\dimen113 +\@envbody=\toks18 +\multlinegap=\skip44 +\multlinetaggap=\skip45 +\mathdisplay@stack=\toks19 +LaTeX Info: Redefining \[ on input line 2665. +LaTeX Info: Redefining \] on input line 2666. +) +(/usr/local/texlive/2013/texmf-dist/tex/latex/float/float.sty +Package: float 2001/11/08 v1.3d Float enhancements (AL) +\c@float@type=\count100 +\float@exts=\toks20 +\float@box=\box28 +\@float@everytoks=\toks21 +\@floatcapt=\box29 +) +\@float@every@program=\toks22 +\c@program=\count101 + (./paper.aux) +\openout1 = `paper.aux'. + +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 29. +LaTeX Font Info: ... okay on input line 29. +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 29. +LaTeX Font Info: ... okay on input line 29. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 29. +LaTeX Font Info: ... okay on input line 29. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 29. +LaTeX Font Info: ... okay on input line 29. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 29. +LaTeX Font Info: ... okay on input line 29. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 29. +LaTeX Font Info: ... okay on input line 29. + +(/usr/local/texlive/2013/texmf-dist/tex/context/base/supp-pdf.mkii +[Loading MPS to PDF converter (version 2006.09.02).] +\scratchcounter=\count102 +\scratchdimen=\dimen114 +\scratchbox=\box30 +\nofMPsegments=\count103 +\nofMParguments=\count104 +\everyMPshowfont=\toks23 +\MPscratchCnt=\count105 +\MPscratchDim=\dimen115 +\MPnumerator=\count106 +\makeMPintoPDFobject=\count107 +\everyMPtoPDFconversion=\toks24 +) (/usr/local/texlive/2013/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty +Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO +) + +(/usr/local/texlive/2013/texmf-dist/tex/generic/oberdiek/ifluatex.sty +Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) +Package ifluatex Info: LuaTeX not detected. +) +(/usr/local/texlive/2013/texmf-dist/tex/generic/oberdiek/ifpdf.sty +Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) +Package ifpdf Info: pdfTeX in PDF mode is detected. +) +Package pdftexcmds Info: LuaTeX not detected. +Package pdftexcmds Info: \pdf@primitive is available. +Package pdftexcmds Info: \pdf@ifprimitive is available. +Package pdftexcmds Info: \pdfdraftmode found. +) +(/usr/local/texlive/2013/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty +Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf + +(/usr/local/texlive/2013/texmf-dist/tex/latex/oberdiek/grfext.sty +Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO) + +(/usr/local/texlive/2013/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty +Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO) +)) +(/usr/local/texlive/2013/texmf-dist/tex/latex/oberdiek/kvoptions.sty +Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO) + +(/usr/local/texlive/2013/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty +Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO) + +(/usr/local/texlive/2013/texmf-dist/tex/generic/oberdiek/etexcmds.sty +Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) +Package etexcmds Info: Could not find \expanded. +(etexcmds) That can mean that you are not using pdfTeX 1.50 or +(etexcmds) that some package has redefined \expanded. +(etexcmds) In the latter case, load this package earlier. +))) +Package grfext Info: Graphics extension search list: +(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE +G,.JBIG2,.JB2,.eps] +(grfext) \AppendGraphicsExtensions on input line 452. + +(/usr/local/texlive/2013/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg +File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv +e +)) +[1 + +{/usr/local/texlive/2013/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] + +LaTeX Font Warning: Command \small invalid in math mode on input line 80. + + +LaTeX Font Warning: Command \small invalid in math mode on input line 80. + +[2] (./paper.aux) ) +Here is how much of TeX's memory you used: + 2187 strings out of 493315 + 29437 string characters out of 6137904 + 91203 words of memory out of 5000000 + 5626 multiletter control sequences out of 15000+600000 + 12492 words of font info for 45 fonts, out of 8000000 for 9000 + 957 hyphenation exceptions out of 8191 + 38i,11n,23p,231b,233s stack positions out of 5000i,500n,10000p,200000b,80000s + + +Output written on paper.pdf (2 pages, 120563 bytes). +PDF statistics: + 63 PDF objects out of 1000 (max. 8388607) + 45 compressed objects within 1 object stream + 0 named destinations out of 1000 (max. 500000) + 1 words of extra memory for PDF output out of 10000 (max. 10000000) + diff --git a/docs/paper/paper.tex b/docs/paper/paper.tex new file mode 100644 index 0000000..75653d7 --- /dev/null +++ b/docs/paper/paper.tex @@ -0,0 +1,84 @@ + +\title{Probabilistic Audio Localization in Wireless Acoustic Sensor Networks} + +\date{\today} + +\author{Alexander Wallar} + +\documentclass[12pt]{article} + +\usepackage[pdftex]{graphicx} + +\usepackage{amsmath} + +\usepackage{float} + +\floatstyle{ruled} \newfloat{program}{thp}{lop} \floatname{program}{Structure} + +\newcommand{\Normal}[3]{\mathcal{N}(#1, #2, #3)} + +\newcommand{\Acronym}[1]{\ensuremath{{\small{\texttt{#1}}}}} +\newcommand{\Name}{\Acronym{Camgaze.js}} \newcommand{\False}{\Constant{false}} +\newcommand{\True}{\Constant{true}} +\newcommand{\Symbol}[1]{\ensuremath{\mathcal{#1}}} +\newcommand{\Function}[1]{\ensuremath{{\small \textsc{#1}}}} +\newcommand{\Constant}[1]{\ensuremath{\small{\texttt{#1}}}} +\newcommand{\Var}[1]{\ensuremath{{\small{\textsl{#1}}}}} +\newcommand{\argmin}[1]{\underset{#1}{\operatorname{arg}\,\operatorname{min}}\;} + +\begin{document} + +\maketitle + +\section{Implementation} + +\subsection{Acquisition} + +To determine the position of a sound within a wireless acoustic sensor network +(WASN), we must discuss the structure and type of data that is being sent from +the acoustic nodes. We define a \emph{node event}, which is the structure being +sent from the acoustic nodes to central server. Below is an outline of a node +event. + + +\begin{program} +\caption{Node Event Structure} +\begin{verbatim} +{ + x: , + y: , + spl: , + timestamp: , + confidence: +} +\end{verbatim} +\end{program} + +The node event structure provides all of the acquisition data needed by the +central server in order to perform audio localization. This structure is sent +in JSON to the central server using a \verb|POST| request upon the positive +recognition of a sound in the server's database. The recognition is done on the +wireless acoustic sensor node. + +\subsection{Localization} + +In order to conduct localization using the node events, we have created a +probability distribution that given an $x$ and $y$ position along with a list +of node events and reference data regarding the detected sound (such as sound +pressure level and distance at time of recording), we can deduce the +probability of the sound being at position $(x, y)$. The probability function +is fairly complex and is broken down into subfunctions below. + +Firstly, at the heart of the probability function is a normal distribution +denoted as $\Normal{X}{\mu}{\sigma}$. To determine the mean for the normal +distribution, we used the predicted distance from node that the sound will be +given the reference sound pressure level and distance at which the reference +data was taken as well as the acquired sound pressure level. With these three +pieces of data, we are able to predict the distance away from the microphone +the sound was. This gives us the mean value for the normal distribution. The +function is shown below. \begin{align*} \Function{dist}_{sound}(r, spl, spl') +&= r \cdot 10 ^ {\frac{(spl - spl')}{20}} \end{align*} + + + +\end{document} diff --git a/locaudio/detectionserver.py b/locaudio/detectionserver.py index 1d58e99..00bf942 100644 --- a/locaudio/detectionserver.py +++ b/locaudio/detectionserver.py @@ -131,15 +131,15 @@ def get_position_viewer(sound_name): img_path = IMG_DIR + sound_name + ".png" img_web_path = "/" + img_path - if config.new_data[sound_name]: - plot.plot_detection_events( - location_list, - radius, spl, - config.detection_events[sound_name], - img_path - ) - - config.new_data[sound_name] = False + # if config.new_data[sound_name]: + # plot.plot_detection_events( + # location_list, + # radius, spl, + # config.detection_events[sound_name], + # img_path + # ) + + # config.new_data[sound_name] = False ret_list = list() diff --git a/locaudio/templates/graph.html b/locaudio/templates/graph.html index e84901e..159efc9 100644 --- a/locaudio/templates/graph.html +++ b/locaudio/templates/graph.html @@ -17,6 +17,10 @@ -webkit-box-shadow: 0 0 1px rgba(255,255,255,.5); } + body { + padding-top: 100px; + padding-bottom: 40px; + } .scrollable{ overflow-y: scroll; max-height: 100px; @@ -24,12 +28,8 @@ } .container-narrow { - padding-top: 100px; margin: 0 auto; - max-width: 3000px; - -moz-transform: scale(0.75); - -webkit-transform: scale(0.75); - transform: scale(0.75); + max-width: 600px; } .hero-unit { @@ -96,14 +96,16 @@ +
{% if img_path %} -
+
Position Graph - (View Map) +

- + +
{% for location in location_list %} @@ -117,7 +119,7 @@
-
+
Detection Events ({{ detection_events.__len__() }}) @@ -139,7 +141,7 @@
-
+
Reference Data @@ -173,6 +175,7 @@
{% endif %}
+

Map

+ diff --git a/tests/test_server.py b/tests/test_server.py index d111aa8..69398a4 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -14,7 +14,7 @@ import socket -server_addr = "localhost" #socket.gethostbyname(socket.getfqdn()) +server_addr = socket.gethostbyname(socket.getfqdn()) server_port = 8000 test_sound_name = "Cock" @@ -28,7 +28,7 @@ "x": 56.3399723, "y": -2.8082881, "spl": 65, - "timestamp": time.time(), + "timestamp": time.time() - 3, "fingerprint": f_print }, { @@ -42,7 +42,7 @@ "x": 56.3399723, "y": -2.8082881, "spl": 65, - "timestamp": time.time(), + "timestamp": time.time() - 5, "fingerprint": f_print }, {