Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 6

Generation of Shepard Tone in

MATLAB
By:
Introduction
• A Shepard tone, named after Roger
Shepard, is a sound consisting of
a superposition of sine waves separated
by octaves.
• When played with the bass pitch of the
tone moving upward or downward, it is
referred to as the Shepard scale.
• This creates the auditory illusion of a tone
that seems to continually ascend or
descend in pitch, yet which ultimately gets
no higher or lower.
Algorithm
• We know that it’s the combination of sines
and cosines of different frequencies.
• And our requirement is to create a sound
whose pitch moves upwards or downwards.
• Our design code will give freedom to
choose the sampling frequency and the
number of harmonics of the tone.
Procedure (1/3):
 Step 1:
• To find the maximum frequency range and No of samples

• Defining variables for attenuation, Envelope and the gradient of the


sound
• Create the Harmonic frequency as it is essential part of the Code

Where n is the number of harmonics.


• Use function ‘chirp’ and according to Mathworks:
y = chirp(t,f0,t1,f1) generates samples of a linear swept-frequency
cosine signal at the time instances defined in array t, where f0 is the
instantaneous frequency at time 0, and f1 is the instantaneous
frequency at time t1. f0 and f1 are both in hertz. If unspecified, f0 is e-
6
 for logarithmic chirp and 0 for all other methods,t1 is 1, and f1 is 100.
Procedure (2/3):
 
Step 2:
• Now we need to attenuate all the frequency
which is less than the fnote which is actually
the given frequency by the user.
• So now we have to set the gradients,
amplitudes, fade outs and other parameters
for two cases: for 1st harmonic

• And when
Procedure (3/3):
Step 3:
• We need to give the users a choice
whether they want an ascending pitch or
descending pitch. For this, we will set an
input parameter and will use the flip
command.
• Now we need to set the envelope level,
plot settings and soundplay settings using
the multiple functions.

You might also like