Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 2 (15 points) Additive synthesis: The sum of K sinusoids, can be expressed as K-1 K-1 y(t) = Yk (t) = Ak cos(2xt

image

Lab 2 (15 points) Additive synthesis: The sum of K sinusoids, can be expressed as K-1 K-1 y(t) = Yk (t) = Ak cos(2xt + k) k=0 k=0 where Ak, fk, and k are the peak amplitude, frequency (Hz), and initial phase (rad) of the kth sinusoidal component of frequency fk. K is the total number of sinusoidal components. Creating such a sum of sinusoids is known as additive synthesis. a) Write a function that generates N samples of a sinusoid knowing its amplitude, A, frequency, f, phase, phi, given the sampling rate, Fs. Use this function to create, plot (only 0.01 s), and listen to one-second-long, unit-amplitude, zero-phase, 440 Hz cosine wave sampled at 44100 Hz. b) Write a function that uses the function above to generate the sum of K sinusoids. This function should take lists/vectors of amplitudes, frequencies, and phases (each of the same length) as well as the number of samples and the sampling rate and should return the sum of the sinusoids. Use your function to create the sum of K = 5 sinusoids with frequencies fk = [220, 660, 1100, 1540, 1980] and amplitudes Ak = [1, 1/3, 1/5, 1/7, 1/9], all with zero phase. Use a sampling rate of 44.1kHz and return a one-second segment. Plot (only 0.01 s) and listen to it. How does it sound? What waveform does this approximate? c) Use the functions above to create a signal that is comprised of each of the sinusoids from b) (starting with 220Hz) presented in a sequence 1 second long and added to the previous sinusoid (e.g., 220Hz for 1 second, then add the 660Hz sinusoid for 1 second, ..., finally add the 1980 Hz sinusoid for 1 second). Plot (full duration) and listen to it. Plot at t = [0.1, 1.1, 2.1, 3.1, 4.1] seconds for 0.02 s. How does the signal evolve through time? How does it sound? d) Generate the same waveform as in b) but with randomized phase. Does it sound the same as b)? Does it look the same?

Step by Step Solution

3.47 Rating (157 Votes )

There are 3 Steps involved in it

Step: 1

a Heres the code for generating N samples of a sinusoid with given amplitude frequency phase and sampling rate python import numpy as np import matplotlibpyplot as plt import sounddevice as sd def gen... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis And Decision Making

Authors: Christian Albright, Wayne Winston, Christopher Zappe

4th Edition

538476125, 978-0538476126

More Books

Students also viewed these Programming questions

Question

What are the pros and cons of using credit? (p. 321)

Answered: 1 week ago

Question

21. What are the two kinds of stroke, and what causes each kindpg78

Answered: 1 week ago

Question

22. Why is tPA not helpful in cases of hemorrhagepg78

Answered: 1 week ago