Skip to content

Latest commit

 

History

History
35 lines (22 loc) · 2.31 KB

README.md

File metadata and controls

35 lines (22 loc) · 2.31 KB

XL2-analysis

1. Introduction

This is a small collection of scripts, mostly in Matlab, one in Python, that aid the user in reading data from a plaintext logfile generated by the NTi XL2 sound recorder, adding hand-recorded metadata, and analyzing the data and metadata. It was designed for the 2017 Sound Analysis Interdisciplary Qualifying Project at Worcester Polytechnic Institute.

2. Reading logs, inputting Metadata

The first step of this process is reading the log generated by the XL2. The file name that you are looking for will end in "_Log.txt". Generate a comma-separated-value (CSV) by running from the terminal:

> python2 CreateCSV.py 1_Log.txt 2_Log.txt ...

You can list as many file's as you'd like, the script will create a CSV for each one, named 1_log.txt.csv, 2_Log.txt.csv, etc.

Now you'll likely want to convert these per-second CSVs to per-minute CSVs to make metadata entry easier. Use the Matlab function createMinutely to do so. From the Matlab terminal:

> createMinutely(1_log.txt.csv)

This will create a file called 1_log.txt.min.csv. This function will have to be run once for each CSV.

The minutely CSV will also have a row of headings for metadata, which can be filled in at this point if desired.

3. Storage and Analysis

Use the function packMetaFromCSV to rejoin the per-minute (with metadata) and per-second CSVs. From the Matlab command line:

> secsMeta = packMetaFromCSV('1_Log.txt.csv','1_Log.txt.min.csv')

secsMeta will be an array structure containing the data from each second, plus whatever metadata was added to the per-minute CSV. For more details on the secsMeta structure, see the documentation in packMetaFromCSV.m. There are two functions for generating graphs that I found useful:

  • createPeopleScatter, which creates scatter plots of number of people present vs. noise level
  • createDayGraph, which creates a graph of noise levels across a day, and can add points representing observations

There is one more for generating a graph that I didn't find useful:

  • createDiffHists, which creates a histogram of how much more or less likely certain noise levels are to occur in the time immediately around a certain type of observation

4. Conclusion

Hopefully you find this useful! If you have questions - especially if you're a WPI project team - email me at zweissman at wpi dot edu.