Write a program that generates notes


Write a program that generates notes c-cleff. The function should output a vector of samples of a note at the specified sampling rate and for the specified duration. The function should be called "mytone." i must write the main program that calls on mytone for notes in a song so that my program plays "Mary had a little lamb". The main programs should play the song via soundsc. BELOW IS WHAT I HAVE DONE SO FAR AND WHERE I AM STUCK. PLEASE BE AS DETAILED AS POSSIBLE.

This is the tone function that i have come up with.

function [x] = MyTone (fo, tduration)

fs=5000;
ts=1/fs;
t=0:ts:tduration;
x=sin(2*pi*fo*t);

end

Now I need to call "mytone" function so i can play the notes, the main programs should play the songs via soundsc. This is what i have so far but it is not working and i cant hear any sounds.

fs=8000
a = MyTone(4000,.1)
x=[x a]

soundsc(x,fs) 

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Write a program that generates notes
Reference No:- TGS0117128

Expected delivery within 24 Hours