# Synthesizing a piano sound

100 views (last 30 days)
James on 23 Mar 2012
hi ive come into a little trouble on a university asigment ive got to synthesize a piano tone and ive become a little stuck this is the asigment question.
Using Matlab to import and analyse the time and frequency information of two wav files: “piano_A.wav” and “piano_middle_C.wav”. The audio files can be downloaded from assessment webpage. You will need to
1) Produce time domain and frequency domain diagrams of both signals; explain and describe the “physical meaning” of the diagrams. Explain how the signal needs to be prepared to be able to obtain desired results.
2) Extract time domain envelope information from the signals and plot the envelope diagram in Matlab.
3) Analysis the harmonic structure of both signals. List a table of observable harmonic frequencies and amplitudes of both signals.
4) Adding sinusoid signals with different frequencies
5) Adding Attack, Decay, Sustain, Release (ADSR) envelope to adjust the dynamics.
In this task you should also consider adding convolution and reverberation to make it more realistic. Make sure the Harmonic frequency structure can be obtained properly in terms of dB or Linear. Suggest the method to allow the length of envelop can be dynamically adjusted according to user specified duration. Ideally a Matlab function is to be created for synthesis of the sound, controlled by user inputs such as pitch, velocity, and duration.
in this task i have manged to do part one but i am stuck as to where to go from here below is the code i have so far Filename = 'piano_middle_C.wav'; [ Sig,Fs,Bits, OPT]=wavread(Filename); Duration = length(Sig)/Fs; disp(Duration); Ts = 1/Fs; Time = 0:Ts:Duration-Ts; plot(Time, Sig); ylabel('Amplitude'); xlabel('Time Sec');

owr on 23 Mar 2012
Very cool assignment.
Look at something like this to get an idea on how to come up with an envelope:
Learn how to use "fft" to get the harmonic structure out of your signal.
##### 2 CommentsShowHide 1 older comment
owr on 23 Mar 2012
Probably a good place to start then, eh? You're lucky to have a teacher who creates problems this creative and interesting. When you get through this, you'll have picked up some nice skills. Have fun.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by