Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please use comments so that I can understand the logic of the code. The code has to be for matlab. 1.1 A Function to Play
Please use comments so that I can understand the logic of the code. The code has to be for matlab.
1.1 A Function to Play a Note Piano keyboards are laid out as illustrated by the following image OCTAVE Middle-C A-440 Keys on a piano .C4 refers to the C-key in the fourth octave. C4 is also called middle-C A4 is also called A-440, because its frequency is 440 Hz. Every key is given a key number. The key number of middle-C is 40 The frequency of any key can be found by substituting its key number into the formula: 440s Remember that when we construct a sinusoid in MATLAB, we are in fact constructing a sampled sinusoid The Sampling Theorem tells us that to recover a continuous signal from its samples without aliasing, f, must be at least two times greater than the maximum frequency component. Built-in function soundsc (xx, fs) reconstruct the continuous-time version of xx, i.e.z(t) z[t fs]. Use this to judge how your synthesis is doing as you work on the lab. In music synthesis, common choices for sampling frequency f, are 8000 Hz, 11025 Hz, or 44100 Hz. Write a function to produce a desired note for a given duration at a given complex amplitude. Use the following skeleton code to write your function function xxkey to note(x, keynun, dur) KEY TO NOTE: Produce a sinusoidal waveforn corresponding to agiven piano key number Input Args: X: amplitude (default-1) keynun: number of the note on piano keyboard dur: duration of the note (in seconds) Output: xx: sinusoidal waveform of the note fs 8000; tt-0:(1/fs):dur-1/fs freq xx . real(); %Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started