Wazifa Counter using Speech Processing in Matlab


A friend asked some time before to develop a tool which counts the number of times a wazifa has been recited. It had to use only voice input when hands were not free such as during driving. Here is a version-0 of an attempt at solving the problem. A program is written in Matlab script that uses only the cross correlation function to search the number of times a particular sentence has been spoken.  This is offline version. Two *.wav files are input to the program. “darood1.wav” contains one sample of the wazifa to be searched. “darood5.wav” is the file to be searched for occurrences of the wazifa.

[al ar] = audioread('darood1.wav'); % Load sample wazeefa file (recited one time)
[bl br] = audioread('darood5.wav'); % Load file to be searched in
c = xcorr(al(:),bl(:)); % perform cross correlation on two files (Use just one channel of stereo recorded input)

t = 1:length(c); % Horizontal index vector for plotting purposes
z = envelope(c,50000,'peaks'); % Detect major lobes in cross-correlation output

[pks,locs,w,p] = findpeaks(z,'MinPeakDistance',5000) ; % Detect peaks but ignore that are colser than 5000 samples
findpeaks(z,'MinPeakDistance',5000) % Here to plot data with peaks
count = size(pks( pks>(.1*mean(pks)) )); % Count number of significant peaks
count = (count-1)/2 % Display number of recitations


Result were good enough for this crude program and off-line recordings.

Future Work:

  • Improve the program efficiecy by working on feature rather than the direct samples
  • Make the processing real time

Comments Invited

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s