2. A section of a piano keyboard is shown in Figure 1. Each of the keys is tuned a different frequency and are related by the equation f₂ = f₁ x 2 (#) where f₂ is the frequency of the kth adjacent key (note) from a base key frequency. k is positive if it is a sharp (higher) and negative if a flat (lower). The frequency values can be generated and stored in a vector using the code fragment >> F= 261.626*2.^ ( [0:12]./12); 261.626 Hz C# D# 293.665 Hz 277.183 Hz Fiemme 1 311.128 Hz 329.628 Hz 349.229 Hz C D E F 369.995 Hz G 391.996 Hz ……. F# G# A# 415.305 Hz 440.000 Hz forhood 466.165 Hz 493.884 Hz 523.252 Hz A B с

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Do not reject if you dont know the answer. Use MatLAab

2. A section of a piano keyboard is shown in Figure 1. Each of the keys is tuned a different
frequency and are related by the equation
f₂ = f₁x2(#)
where f₂ is the frequency of the kth adjacent key (note) from a base key frequency. k is
positive if it is a sharp (higher) and negative if a flat (lower). The frequency values can be
generated and stored in a vector using the code fragment
>> F = 261.626*2.^ ( [0:12]./12);
277.183 Hz
261.626 Hz
293.665 Hz
311.128 Hz
329.628 Hz
349.229 Hz
369.995 Hz
391.996 Hz
440.000 Hz
415.305 Hz
JUL
C# D#
F# G# A#
466.165 Hz
C D E FGAB с
493.884 Hz
Figure 1. Section of piano keyboard showing the
fundamental frequencies of the keys/notes
523.252 Hz
Transcribed Image Text:2. A section of a piano keyboard is shown in Figure 1. Each of the keys is tuned a different frequency and are related by the equation f₂ = f₁x2(#) where f₂ is the frequency of the kth adjacent key (note) from a base key frequency. k is positive if it is a sharp (higher) and negative if a flat (lower). The frequency values can be generated and stored in a vector using the code fragment >> F = 261.626*2.^ ( [0:12]./12); 277.183 Hz 261.626 Hz 293.665 Hz 311.128 Hz 329.628 Hz 349.229 Hz 369.995 Hz 391.996 Hz 440.000 Hz 415.305 Hz JUL C# D# F# G# A# 466.165 Hz C D E FGAB с 493.884 Hz Figure 1. Section of piano keyboard showing the fundamental frequencies of the keys/notes 523.252 Hz
The technique illustrated below can be used to generate a matrix of frequency samples by
applying the sin() function to the matrix multiplied to an amplitude vector.
>> Fs = 8000;
>> F =
261.626*2.^ ( [0:12]./12);
A = ones (1, length (F));
[ (0:7999)/8000]';
>> t =
>> Octave_matrix = (ones (length(t),1) *A). *sin (2*pi*t*F);
To play the individual frequencies, index the individual columns of Octave matrix
and create an audio player object using audioplayer.
However, an actual piano key (or guitar string) note is not just composed of one
frequency (the fundamental), but would also include the harmonics of the fundamental as
well. Also, its amplitude is not constant but would decay exponentially with time.
Tips:
Make a function that will play a three second (3 s) guitar string note by creating a
frequency matrix composed of its fundamental frequency and six of its harmonics. The
amplitude matrix A is composed of the reciprocals of the harmonic number k, i.e. the 3rd
harmonic would have an amplitude of 1/3 and so on. The function call takes the
fundamental frequency F as its input argument.
guitar (F)
Normalize the amplitude of the resulting vector by dividing it by its maximum
value using the max () function.
• The amplitude envelope of the tone should decay gradually but must be zero
before reaching the end. A good rule of thumb is that the amplitude drops to zero
within the last sixth of the period (2.5 s < t <3 s).
• Use audioplayer to play the resulting tone.
MATLAB Code (Editor):
Transcribed Image Text:The technique illustrated below can be used to generate a matrix of frequency samples by applying the sin() function to the matrix multiplied to an amplitude vector. >> Fs = 8000; >> F = 261.626*2.^ ( [0:12]./12); A = ones (1, length (F)); [ (0:7999)/8000]'; >> t = >> Octave_matrix = (ones (length(t),1) *A). *sin (2*pi*t*F); To play the individual frequencies, index the individual columns of Octave matrix and create an audio player object using audioplayer. However, an actual piano key (or guitar string) note is not just composed of one frequency (the fundamental), but would also include the harmonics of the fundamental as well. Also, its amplitude is not constant but would decay exponentially with time. Tips: Make a function that will play a three second (3 s) guitar string note by creating a frequency matrix composed of its fundamental frequency and six of its harmonics. The amplitude matrix A is composed of the reciprocals of the harmonic number k, i.e. the 3rd harmonic would have an amplitude of 1/3 and so on. The function call takes the fundamental frequency F as its input argument. guitar (F) Normalize the amplitude of the resulting vector by dividing it by its maximum value using the max () function. • The amplitude envelope of the tone should decay gradually but must be zero before reaching the end. A good rule of thumb is that the amplitude drops to zero within the last sixth of the period (2.5 s < t <3 s). • Use audioplayer to play the resulting tone. MATLAB Code (Editor):
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY