Wednesday, September 29, 2010

Audio processing



Audio signals, much like images, can undergo filtering. It is somewhat easier
to understand the impact of signal processing on audio, since audio needs not
be translated from a spatial to a frequency domain.

To load a wave (PCM) audio file, Matlab provides the function wavread :

funky = wavread('funky.wav');
It's important to capture the sampling frequency at which the sound was
recorded, otherwise the speed of playback and results of further processing
is not guaranteed to be correct:

[funky, f] = wavread('funky.wav');
To play a wave file at sampling frequency f:

wavplay(funky, f);
To view the waveform, plot the wave. Since audio is represented with many
thousand samples per second, it may be required to plot small portions of the
waveform at a time.

subplot(2,1,1), plot(funky), title('Entire waveform');
smallRange = 100000:100000+floor(f/100);
subplot(2,1,2), plot(smallRange, funky(smallRange)),..

title('100 milliseconds');



Figure 10

 Spectrogram


Figure 10.27 


2-dimensional plots of audio waves can be used to easily identify magnitude;
however, combined frequency distributions and magnitudes are more easily
viewed in a spectrogram:

specgram(funky, 512, f);
where 512 is the number of samples that are used for the discrete Fourier
Transform, and thus a grouping factor of samples per column in the spectrogram image.




Figure 10.28


Plotting both the original waveform and the spectrogram, it is possible to find
correspondences between the two graphical representations:

subplot(2,1,1), plot(funky), axis('tight');
subplot(2,1,2), specgram(funky,128,f);


However, it is easier to find such similarities in smaller portions of audio.
We can also find
repeating patters:

subplot(2,1,1), plot(funky(100000:150000)), axis('tight');
subplot(2,1,2), specgram(funky(100000:150000),128,f);



Figure 10.29

 Filtering



We will examine audio filtering in the sense of specific frequency suppression and
extraction. There are many different types of filters available for the construction
of filters. We will specifically use the Butterworth filter.
Matlab includes function butter for building Butterworth filters of three sorts:
  • 'low' : Low-pass filters, which remove frequencies greater than some specified value.
  • 'high' : High-pass filters, which remove frequencies lower than some specified value.
  • 'stop' : Stop-band filters, which remove frequencies in a given range of values.

Frequencies values are specified in normalized terms between 0.0 and 1.0, where 1.0 corresponds
to half the sampling frequency: f/2. A given frequency is thus expressed in terms of this value,
for example, 1000Hz = 1000/(f/2).
Filters are described in terms of 2 vectors ([b, a] = [numerator, denominator]).
To apply a filter to a 1-D audio waveform, Matlab provides function filtfilt , which takes
as arguments the result [b, a] from butter, the waveform, and a value denoting the
order (number of coefficients) of the filter.
A filter's frequency response can be plotted using function freqz . Magnitude values at zero dB
are unaffected by the filter. Magnitude values below 0 dB are suppressed.

10.3.2.1 Low-pass filter



We design a 10th order low-pass filter to supress frequencies higher than 200Hz.


fNorm = 200 / (f/2);
[b,a] = butter(10, fNorm, 'low');
funkyLow = filtfilt(b, a, funky);
Add caption
The frequency response for this filter:
freqz(b,a,128,f);


wavplay(funkyLow,f);
Playing the new audio waveform clearly reveals that low (bass) frequencies are preserved, while all higher frequencies have been suppressed.

10.3.2.2 High-pass filter



We design a 10th order high-pass filter to supress frequencies below 5kHz.

fNorm = 5000 / (f/2);
[b, a] = butter(10, fNorm, 'high');
funkyHigh = filtfilt(b, a, funky);
















Figure 10.31

 The frequency response for this filter:
freqz(b,a,128,f);


wavplay(funkyHigh,f);
Playing the new audio waveform reveals only high-pitched tones.

 Stop-band filter


Figure 10.32

fNorm = [500/(f/2), 2500/(f/2)];
[b, a] = butter(10, fNorm, 'stop');
funkyBand = filtfilt(b, a, funky);
The frequency response for this filter:
freqz(b,a,128,f);



wavplay(funkyBand,f);







MATLAB Basics






MATLAB is started by clicking the mouse on the appropriate icon and is ended by typing exit or by
using the menu option. After each MATLAB command, the "return" or "enter" key must be
depressed.

A. Definition of Variables
Variables are assigned numerical values by typing the expression directly, for example, typing
a = 1+2
yields: a = 3
The answer will not be displayed when a semicolon is put at the end of an expression, for example type
a = 1+2;.
MATLAB utilizes the following arithmetic operators:
+ addition
- subtraction
* multiplication
/ division
^ power operator
' transpose
A variable can be assigned using a formula that utilizes these operators and either numbers or
previously defined variables. For example, since a was defined previously, the following expression is
valid
b = 2*a;
To determine the value of a previously defined quantity, type the quantity by itself:
b
yields: b = 6
If your expression does not fit on one line, use an ellipsis (three or more periods at the end of the line)
and continue on the next line.
c = 1+2+3+...
5+6+7;

There are several predefined variables which can be used at any time, in the same manner as userdefined
variables:
i sqrt(-1)
j sqrt(-1)
pi 3.1416...
For example,
y= 2*(1+4*j)
yields: y= 2.0000 + 8.0000i
There are also a number of predefined functions that can be used when defining a variable. Some
common functions that are used in this text are:
abs magnitude of a number (absolute value for real numbers)
angle angle of a complex number, in radians
cos cosine function, assumes argument is in radians
sin sine function, assumes argument is in radians
exp exponential function
For example, with y defined as above,
c = abs(y)
yields: c = 8.2462
c = angle(y)
yields: c = 1.3258
With a=3 as defined previously,
c = cos(a)
yields: c = -0.9900
c = exp(a)
yields: c = 20.0855
Note that exp can be used on complex numbers. For example, with y = 2+8i as defined above,

c = exp(y)
yields: c = -1.0751 + 7.3104i
which can be verified by using Euler's formula:
c = e2cos(8) + je2sin(8)

B. Definition of Matrices
MATLAB is based on matrix and vector algebra; even scalars are treated as 1x1 matrices. Therefore,
vector and matrix operations are as simple as common calculator operations.
Vectors can be defined in two ways. The first method is used for arbitrary elements:
v = [1 3 5 7];
creates a 1x4 vector with elements 1, 3, 5 and 7. Note that commas could have been used in place of
spaces to separate the elements. Additional elements can be added to the vector:
v(5) = 8;
yields the vector v = [1 3 5 7 8]. Previously defined vectors can be used to define a new
vector. For example, with v defined above
a = [9 10];
b = [v a];
creates the vector b = [1 3 5 7 8 9 10].
The second method is used for creating vectors with equally spaced elements:
t = 0:.1:10;
creates a 1x101 vector with the elements 0, .1, .2, .3,...,10. Note that the middle number defines the
increment. If only two numbers are given, then the increment is set to a default of 1:
k = 0:10;
creates a 1x11 vector with the elements 0, 1, 2, ..., 10.
Matrices are defined by entering the elements row by row:
M = [1 2 4; 3 6 8];
creates the matrix

M = é
ë ê
ù
û ú
1 2 4
3 6 8
There are a number of special matrices that can be defined:
null matrix: M = [];
nxm matrix of zeros: M = zeros(n,m);
nxm matrix of ones: M = ones(n,m);
nxn identity matrix: M = eye(n);
A particular element of a matrix can be assigned:
M(1,2) = 5;
places the number 5 in the first row, second column.
In this text, matrices are used only in Chapter 12; however, vectors are used throughout the text.
Operations and functions that were defined for scalars in the previous section can also be used on
vectors and matrices. For example,
a = [1 2 3];
b = [4 5 6];
c = a + b
yields: c = 5 7 9
Functions are applied element by element. For example,
t = 0:10;
x = cos(2*t);
creates a vector x with elements equal to cos(2t) for t = 0, 1, 2, ..., 10.
Operations that need to be performed element-by-element can be accomplished by preceding the
operation by a ".". For example, to obtain a vector x that contains the elements of x(t) = tcos(t) at
specific points in time, you cannot simply multiply the vector t with the vector cos(t). Instead you
multiply their elements together:
t = 0:10;
x = t.*cos(t);

C. General Information
Matlab is case sensitive so "a" and "A" are two different names.
Comment statements are preceded by a "%".
On-line help for MATLAB can be reached by typing help for the full menu or typing help
followed by a particular function name or M-file name. For example, help cos gives help on the
cosine function.
The number of digits displayed is not related to the accuracy. To change the format of the display, type
format short e for scientific notation with 5 decimal places, format long e for scientific
notation with 15 significant decimal places and format bank for placing two significant digits to
the right of the decimal.
The commands who and whos give the names of the variables that have been defined in the
workspace.
The command length(x) returns the length of a vector x and size(x) returns the dimension
of the matrix x.

D. M-files
M-files are macros of MATLAB commands that are stored as ordinary text files with the extension
"m", that is filename.m. An M-file can be either a function with input and output variables or a list of
commands. All of the MATLAB examples in this textbook are contained in M-files that are available
at the MathWorks ftp site.
The following describes the use of M-files on a PC version of MATLAB. MATLAB requires that the
M-file must be stored either in the working directory or in a directory that is specified in the MATLAB
path list. For example, consider using MATLAB on a PC with a user-defined M-file stored in a
directory called "\MATLAB\MFILES". Then to access that M-file, either change the working
directory by typing cd\matlab\mfiles from within the MATLAB command window or by
adding the directory to the path. Permanent addition to the path is accomplished by editing the
\MATLAB\matlabrc.m file, while temporary modification to the path is accomplished by typing
addpath c:\matlab\mfiles from within MATLAB.
The M-files associated with this textbook should be downloaded from
www.ece.gatech.edu/users/192/book/M-files.html and copied to a subdirectory named
"\MATLAB\KAMEN", and then this directory should be added to the path. The M-files that come
with MATLAB are already in appropriate directories and can be used from any working directory.
As example of an M-file that defines a function, create a file in your working directory named yplusx.m
that contains the following commands:

function z = yplusx(y,x)
z = y + x;
The following commands typed from within MATLAB demonstrate how this M-file is used:
x = 2;
y = 3;
z = yplusx(y,x)
MATLAB M-files are most efficient when written in a way that utilizes matrix or vector operations.
Loops and if statements are available, but should be used sparingly since they are computationally
inefficient. An example of the use of the command for is
for k=1:10,
x(k) = cos(k);
end
This creates a 1x10 vector x containing the cosine of the positive integers from 1 to 10. This operation
is performed more efficiently with the commands
k = 1:10;
x = cos(k);
which utilizes a function of a vector instead of a for loop. An if statement can be used to define
conditional statements. An example is
if(a <= 2),
b = 1;
elseif(a >=4)
b = 2;
else
b = 3;
end
The allowable comparisons between expressions are >=, <=, <, >, ==, and ~=.
Several of the M-files written for this textbook employ a user-defined variable which is defined with the
command input. For example, suppose that you want to run an M-file with different values of a
variable T. The following command line within the M-file defines the value:
T = input('Input the value of T: ')
Whatever comment is between the quotation marks is displayed to the screen when the M-file is
running, and the user must enter an appropriate value.

Make Money Online: Tourists face fines for going shirtless in French towns:

Make Money Online: Tourists face fines for going shirtless in French towns:

Monday, September 6, 2010

Man jailed for killing wife of 50 years


      Peter Caruso has been sentenced.(AAP)

An elderly retired fruiterer who brutally murdered his wife of 50 years has been jailed for 18 years.

Peter Caruso, 77, is likely to die in prison for the axe murder of his wife Rosa at their Melbourne home in 2008.

Caruso claimed during his Victorian Supreme Court trial that his wife was murdered by a burglar while he was at the shops.
But a jury took less than four hours to find him guilty of murdering Mrs Caruso, who was hit hard by a hatchet or similar item 36 times.
The prosecution alleged Caruso messed up the house to look like it had been robbed in a poor attempt to cover up his crime.
The jury had heard a blood-stained hatchet and clothing matched to Mrs Caruso's DNA were found in her husband's garage.
Justice Betty King said there was no known motive for his attack, but she said the killing was particularly gruesome.
"The murder of your wife was brutal and horrific," she said.
Justice King jailed him for a minimum of 13 years, saying that while some people would believe the sentence was merciful, it was highly likely he might die in jail.                                               Source: ninemsn, AU

$0 to $1 Million - How Did He Do It?

Hello Newbie,

If you sell a product or service, this is for you. If you don't, please feel free to let other people who you know that do sell products or services online. It could make the difference between their doing ok and their doing excellent.

They will owe you one for having shared this cutting edge secret with them.

If you are still with me, I will assume that you sell a product or service online.

Let me ask you this:

"If your website was featured on 1,000's of review sites around the internet and each review site owner was marketing their website using pay-per-click, articles, forums, and coregistration, how much would that affect your profits?"

10%, 100%, 500%, 1000? Well, some merchants are making millions of dollars as a result of just a handful of affiliates using endorsements or positive reviews of their website.

As a special bonus, you make money when everyone who you refer signs up to get hosting AND when they get upgraded training materials and support. Of course if people want a completely free site, we have that too, so you can truly offer your email list a FREE Cash Pulling Website announcement.

Learn more and get started when you continue below:

Feature Your Company On Thousands Of Review Websites

Everything is completely free for you and you can have your review site template built and your site members or affiliates using it as quickly as you can let them know about it.

It's as simple as 1-2-3:

1) You customize a review site with your affiliate link for your product or service that every affiliate will use to make money.

2) You let your affiliates, customers, site visitors know about how they can make money with their own review site (featuring your products).

3) You make money for each person who upgrades their account or gets advanced training materials.

Get started below.

Feature Your Company On Thousands Of Review Websites

To your success!

Awan Chaulagain

Free Completely free but you make money right away click below

How To Explode Your Affiliate Earnings

SUMMARY:

Any Cash needed? NO

Any Risk: NO

Appropriate for: Newbies, Intermediate, And Advanced

=========================================

Dear Affiliate Marketer ,

As an affiliate marketer, you are looking for the best way you can create massive ongoing income for you that takes as little time as possible.

Ideally, you can invest a couple of minutes and get paid on it for years.

Learn more by continuing here:

Make Money Giving Away Free Money Making Websites

All you need to do is log in to your account, and let people know about how they can get their own Cash-Pulling Websites. They are valued at $2,079, but they can get them for nothing for a very limited time.

You make cash when:

1) A person gets a website and upgrades to have their own domain 2) A person upgrades their training materials 3) A webmaster refers their affiliates/customers/visitors to get their own co-branded review sites. You make a 2nd tier commission based on the lifetime commissions of the webmaster you referred.

Sign up right now and get started making some cash!

Make Money Giving Away Free Money Making Websites

To your success!

Awan Chaulagain

One clicks can give you more than $

To find your love, friend, life partner.... log on to....

Google