Sunday, May 12, 2019

How to install JSON Server

JSON Installation:

download json-server-master package
Extract, open package.json file and edit the first line as follows:
 "name": "json-server" -->  "name": "json-server-test"

apply command

 npm install json-server --save-dev

Got error: Linux 4.15.0-45-generic etc

Solution: upgrade to the latest version of npm using:
npm install -g npm@latest



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

Tuesday, October 31, 2017

Re: Find and replace through regular expression

Problem Statement

Find (ah0 0.25) and replace it with ((ah0))


Solution:
Use following regular expression

Find: \(([a-z][a-z][0-1]) 0\.\d+\)
replace: ((\1))