Friday, May 25, 2018

How to find size of particular directory on linux

du -sh file_path

Explanation

  • du (disc usage) command estimates file_path space usage
  • The options -sh are (from man du):

      -s, --summarize           display only a total for each argument      -h, --human-readable           print sizes in human readable format (e.g., 1K 234M 2G)  

    To check more than one directory and see the total, use du -sch:

      -c, --total           produce a grand total  

Tuesday, April 24, 2018

TBT Error: ./raw_conversion.scr: /bin/tcsh: bad interpreter: No such file or directory

Command: make wav2raw

Error: ./raw_conversion.scr: /bin/tcsh: bad interpreter: No such file or directory

Solution:


    you are missing the C-Shell (csh). Install it by below command:

    sudo apt-get install tcsh

Sunday, March 18, 2018

Feature Extraction using pyAudio

How to find zero crossing rate using pyAudio

That's a lot of unnecessary multiplication. Using a Boolean comparison and running it through np.diff will probably be faster:

zero_crosses = np.nonzero(np.diff(audioData > 0)))[0]

What this is doing:

  1. creates a boolean array of where the signal is above 0 (audioData > 0)
  2. does a pairwise difference (np.diff) so locations of zero crossings become 1 (rising) and -1 (falling)
  3. picks the index of the array where those nonzero values are (np.nonzero).

Then if you want the number of crossings, you can just take zero_crosses.size.

As a bonus you have the timings of all the crosses so you can do things like a histogram that shows where more crosses are happening in your time history.


Source: https://stackoverflow.com/questions/44319374/how-to-calculate-zero-crossing-rate-with-pyaudio-stream-data