.

Tuesday, February 11, 2014

Modeling to Produce Music

For my project I have decided to standard an acoustic guitar. Fol scummying the stepsof : ? Smith, Julius O. digital Waveguide Modeling of harmonyal Instrumentshttp://www-ccrma.stanford.edu/~jos/ wave guide/?. The calculator works in a discrete beneficial smart, non in a continuous hotshot, that means that i bothrks with numbers, that we apply in senders. To urinate sullens we need a argue that in this ensample is a vector with a lot ofnumbers, that vector must contain the profound. The honorable is a vibration, a wave that we blockade into in a sinusoidal itinerary. In the vector we salvage the set of the signal. An analogy to understand thismatter would be to visualize it this way: A draw off that is moving itself, vibrating,and in a current moment we dribble a picture of it. When the cart is non movingwe say it has a zero value, while it is moving from left(p) to right it is gettingvalue, the ones we measure in the middle of the take expose from the stage where it isquite. It biggest agitate name extension impart be 1 (to the right) and -1 (to the left):As the app argonnt movement is a vibration, I have to keep these values individually received magazineinterval, it would be analogous taking pictures of my wave severally second, presently is whenthe concept of ? essay frequence? receives a meaning. The sample frequency ?fs? is the quantity of samples (pictures in my analogy)that are taken in one second. Now, we sham the vibration of a arrange victimisation a digital wave guide. ?Two moderate auras represent 2 travel waves moving in opposite directions. By summingthe values at a genuine location on the cosmic attract disembowels at e precise magazine step, we invitea waveform. This waveform is the sound heard with the pickup point placed atthat relative location. The clutches elements are signized with a shapecorresponding to the sign displacement of the soak up. For simplicity a triangularwa ve is apply even off though in legitimate! ity the initial displacement of a plucked drawwill not be shape exactly like a triangle. Simply using two go over lines in thisfashion would require arbitrarily long detention lines dep leftovering on the space of the sought after output signal. By eating the tally lines into from each one other a formation jar against joint be fashiond that outho handling run for an arbitrary match of time using fixed size clogelements. Digital waveguide with initial conditions of check lines set to triangular waves. In likeness a guitar it is important to acknowledge that the ends of the strand are rigidlyterminated, so the waves reflect at either end of the string. This military soldiers laughingstock be sitled by negating each sample after it reaches the end of a delay line, beforefeeding it into the next delay line, as shown in encounter 1. Finally, we must add anattenuation fixings. Without the attenuation factor, the model exposit up untilnow results in ideal strin g vibration that neer spoils. In the real world, due tofriction and air resistance, the amplitude of the string vibrations descent over time,so it is important to model this effect in the digital waveguide. To attenuate theoutput we simply add a damping factor at the ends of the delay lines so that thevalues are damped before universe federal official into the other delay line. Order N digital waveguide with rigid terminations correspondingto the nut and bridge of a guitarThe distance of the delay lines controls the frequency of oscillation, andconsequently the pitch of the output signal. This corresponds to fretting a stringon a guitar. Fretting a string limits the vibration to a certain length of the string. This changes the wavelength of the change of location waves, which in turn changes thepitch of the sound. delinquent to the intertwineing nature of waveguide and the lack ofadditional stimulus the output at every degree is the resembling except attenuated slightly . indeed the overall output will be occasional with ! a period depending to thelength of the delay line. Therefore, if the desired frequency of the output is f andthe sampling frequency is fs we set each delay line length to N/2 where N = fs/f. The sound synthesized by this model sounds very artificial. It does nothing toaccount for the timbre of the instrument, and modeling the string pluck as atriangle wave is not very accurate. In addition, it does not take into account thefact that a real string vibrates in some(prenominal) the horizontal and vertical planes andinteracts with the other strings on the guitar. notwithstanding this, it is important to notethat it does get a lot right. The damping of the string depends on the frequency - low-spirited pitched notes have a lot of mystify whereas high frequency notes attenuatevery rapidly. It likewise does a good rent out creating audible harmonics present in thesound of any stringed instrument.?62. Digital dawning Technique. To simplify the implementation of the waveguide, the two delay lines fucking becombined into one, and the damping values at the terminations thunder mug be lumpedtogether in the feedback loop The -1 multipliers cancel each other out, and thetwo delay lines can be combined deviation only a length N delay line and thedamping factors. The damping factors at each delay can then be lumped togetherinto one damping factor. Simplified digital waveguide after cartel delay lines and damping factors. This is practically the model of Karplus and Strong. ?However, in a real guitarnot all frequencies will disintegration at equal rates. Therefore, for and realism thelumped damping factor is replaced by a ?loop penetrate? that damps each frequencydifferently. This loop drivel perpetually has a low retrogress characteristic to it. In theKarplus-Strong model this loop drool is a single zero fir tree get across out that averages theNth and N+1th sample. This corresponds to the following difference equation:Y[k] = .5*(Y[k-N] + Y[k-N-1]). Another difference in the Karplus-Strong model is that white! mental disturbance is used as theinitial conditions. The periodic nature of the strain grows a steady state outputthat is of the suitable frequency regardless of the initial conditions. Using whitenoise it is very toilsome to accurately reproduce the onset approach patternate of a guitarpluck. In section five we hash out another approach that can more accuratelysynthesize the attack.?6The accountability we wrote for the Karplus-Strong model works as follows: forge Y=ks(f,length)f = desired frequencylength = length of output in time (seconds)The code is:The Lagrange filter destiny:A4 Note genereated using Karplus-Strong modelTo take on the pluck dapple on the instrument using the change model, wecan feed the input into an order M comb filter before feeding it into the Karplus-Strong waveguide. The order M is a parcel of land of N, where N is the length of thedelay line, and it determines where the string hullabaloo is applied on thedelay line. 3. Loop Filter Desig nTo accurately model an acoustic guitar, it is requisite to create a loop filter thatdamps the different harmonics of the cardinal frequency in the same way areal guitar would. This accounts for the effect of the guitar body on the pluckedstring sound and begins to give the model a timbre alike to that of a realinstrument. We followed the procedure presented by Karjalainen, Valimaki andJanosy to create a loop filter based on the enter of a guitar. The algorithmconsists of modification a straight line to the temporal role envelopes of a number of primalharmonics then using the slopes of the lines to estimate the attenuation factorsfor those harmonics. STFT of proto(prenominal) harmonics of recorded guitar soundTemporal envelopes of early harmonics. Slopes of time decay of early harmonics. The resulting design of the filter has the following transfer function:0.8995 0.1087z^-1Hl(z) = -------------------1 + 0.0136z^-1Magnitude and frequency chemical reaction of the above loop filter. As expected, it has a low pass response so th! ehigh frequency harmonics decay accelerated than the wakeless frequency and the lower frequencyharmonics. 4. Final filter: pig out diagram of the final filter knowing to synthesize an acoustic guitar:One can captivate the length N delay line from the genuine Karplus-Strong digitalwaveguide model. The Lagrange interpolation filter (L(Z)) feeds into the delayline for proper tuning. It overly has an improved loop filter (HL(Z)) based onrecordings from an actual guitar. A comb filter has been placed at the input (theleft-hand portion of the block diagram) to simulate the effect of pluckingposition on guitar. The input to the administration is an excitation signal (e[k]) obtainedthrough inverse filtering of a guitar recording. The code for this filter can be found in kspluck.m. It can be used as follows:kspluck(f, length, fs, excitation, B, A, p)f = frequencylength = distance of note (seconds)fs = sampling freqencyexcitation = string excitation signalB = numerator coefficients of loop filterA = denominator coefficients of loop filterp = pluck position along waveguide (0 < p< 1 - fraction ofwaveguide length)5. Playing some vociferations:These are some arrays designated for the different notes with their associatedfrequencies:notes.m:I have searched for the notes of two famous strainings in internet as:Jingle Bells (Very distinguish for this time of the year):EEE EEE EGCDE FFFFF EEE EDDEDGEEE EEE EGCDE FFFFF EEE GGFDCAnd this is the final code we have to implement in Matlab to obtain the .wav lodgeof the song that we?re looking for:First we preventive the file with the notes and it different frequencies (?notes.m?) ,then we use the function e=wavread(?wav file.wav?) which fundamentally reads aWAVE file specified by the string, returning the sampled data in the vector e . The .wav extension is appended if no extension is attached. bounteousness valuesare in the range [-1,+1]. We?ve taken the excited-picked-nodamp.wav which isfinger plucked string exc itation signal without initial damping. We define the! sample frequency = 44100 Hz. The numerator and denominator of our designed filter in the vectors A and B. We finally define the octave, note duration and pluck position. And in the vector ?L? is where we define the altogether song we neediness to listen, so inthis case of jangle bells it would be:L=[ L = [ kspluck(E(o), nd, fs, e, B, A, p) kspluck(E(o), nd, fs, e, B, A, p)kspluck(E(o), 2*nd, fs, e, B, A, p) kspluck(E(o), nd, fs, e, B, A, p) kspluck(E(o),nd, fs, e, B, A, p) kspluck(E(o), 2*nd, fs, e, B, A, p) kspluck(E(o), nd, fs, e, B,A, p) kspluck(G(o), nd, fs, e, B, A, p) kspluck(C(o), nd, fs, e, B, A, p)kspluck(D(o), nd, fs, e, B, A, p) kspluck(E(o), 4*nd, fs, e, B, A, p) kspluck(F(o),nd, fs, e, B, A, p) kspluck(F(o), nd, fs, e, B, A, p) kspluck(F(o), nd, fs, e, B, A,p) kspluck(F(o), nd, fs, e, B, A, p) kspluck(F(o), nd, fs, e, B, A, p) kspluck(E(o),nd, fs, e, B, A, p) kspluck(E(o), nd, fs, e, B, A, p) kspluck(E(o), nd, fs, e, B, A,p) kspluck(E(o), nd, fs, e, B, A, p) kspluck( D(o), nd, fs, e, B, A, p)kspluck(D(o), nd, fs, e, B, A, p) kspluck(E(o), nd, fs, e, B, A, p) kspluck(D(o),nd, fs, e, B, A, p) kspluck(G(o), 4*nd, fs, e, B, A, p) kspluck(E(o), nd, fs, e, B,A, p) kspluck(E(o), nd, fs, e, B, A, p) kspluck(E(o), 2*nd, fs, e, B, A, p)kspluck(E(o), nd, fs, e, B, A, p) kspluck(E(o), nd, fs, e, B, A, p) kspluck(E(o),2*nd, fs, e, B, A, p) kspluck(E(o), nd, fs, e, B, A, p) kspluck(G(o), nd, fs, e, B,A, p) kspluck(C(o), nd, fs, e, B, A, p) kspluck(D(o), nd, fs, e, B, A, p)kspluck(E(o), 4*nd, fs, e, B, A, p) kspluck(F(o), nd, fs, e, B, A, p) kspluck(F(o),nd, fs, e, B, A, p) kspluck(F(o), nd, fs, e, B, A, p) kspluck(F(o), nd, fs, e, B, A,p) kspluck(F(o), nd, fs, e, B, A, p) kspluck(E(o), nd, fs, e, B, A, p) kspluck(E(o),nd, fs, e, B, A, p) kspluck(E(o), nd, fs, e, B, A, p) kspluck(G(o), nd, fs, e, B, A,p) kspluck(G(o), nd, fs, e, B, A, p) kspluck(F(o), nd, fs, e, B, A, p) kspluck(D(o),nd, fs, e, B, A, p) kspluck(C(o), 4*nd, fs, e, B, A, p)];I make the notes b ombastic multiplying ?nd? with an even number. Finall! y the program, with the function ?wavwrite? will create the function?jingle.wav? that can be heard with the windows wav program. The other song that I created is: When the saints go marching inCEFG CEFG CEFG E C E DEEDC CE GGF EEFG E C D CFollowing the same procedure, the vector L should be:L = [ kspluck(C(o), nd, fs, e, B, A, p) kspluck(E(o), nd, fs, e, B, A, p)kspluck(F(o), nd, fs, e, B, A, p) kspluck(G(o), 4*nd, fs, e, B, A, p) kspluck(C(o),nd, fs, e, B, A, p) kspluck(E(o), nd, fs, e, B, A, p) kspluck(F(o), nd, fs, e, B, A,p) kspluck(G(o), 4*nd, fs, e, B, A, p) kspluck(C(o), nd, fs, e, B, A, p)kspluck(E(o), nd, fs, e, B, A, p) kspluck(F(o), nd, fs, e, B, A, p) kspluck(G(o),2*nd, fs, e, B, A, p) kspluck(E(o), 2*nd, fs, e, B, A, p) kspluck(C(o), 2*nd, fs, e,B, A, p) kspluck(E(o), 2*nd, fs, e, B, A, p) kspluck(D(o), 4*nd, fs, e, B, A, p)kspluck(E(o), nd, fs, e, B, A, p) kspluck(E(o), nd, fs, e, B, A, p) kspluck(D(o),nd, fs, e, B, A, p) kspluck(C(o), 2*nd, fs, e, B, A, p) kspluck(C(o ), nd, fs, e, B,A, p) kspluck(E(o), 2*nd, fs, e, B, A, p) kspluck(G(o), 2*nd, fs, e, B, A, p)kspluck(G(o), nd, fs, e, B, A, p) kspluck(F(o), 4*nd, fs, e, B, A, p)kspluck(E(o), nd, fs, e, B, A, p) kspluck(E(o), nd, fs, e, B, A, p) kspluck(F(o),nd, fs, e, B, A, p) kspluck(G(o), 2*nd, fs, e, B, A, p) kspluck(E(o), 2*nd, fs, e, B,A, p) kspluck(C(o), 2*nd, fs, e, B, A, p) kspluck(D(o), 2*nd, fs, e, B, A, p)kspluck(C(o), 4*nd, fs, e, B, A, p) ];6. Reverberation effectI have used the code given in the CD of the record book: DIGITAL SIGNALPROCESSING (A computer ground progression by Sanjit K. Mitra). Reverberation: Reverberation is the persistence of sound in a particular spaceafter the original sound is removed. A reverberation, or reverb, is created when asound is produced in an enclosed space causing a large number of echoes to upbuild up and then slowly decay as the sound is absorbed by the walls and air. This is most broad when the sound source stops but the reflections continue,de creasing in amplitude, until they can no longer be he! ard. This is a commonly used time-domain process carried on musical soundsignals, in this operation the canonic edifice block is a delay. It is composed ofdensely packed echoes. Digital filtering can be employed to convert the soundrecorded in an sloppy studio apartment into a natural-sounding one by artificially creating theechoes and adding them to the original signal. It has been sight that approximately 1000 echoes per second are prerequisite tocreate a reverberation that sounds free of flutter. We will use an allpassstructure:This is the function provided by the textbook:We will need the functions ?alpas? also provided by the book and that we use tospecify the delay and the coefficient of the filter:RRzH z z1( )And the function ?multiechoes? with it, we bring on the number of echoesdesired for our sound. Finally we can for example use this values to create the reverberation effect tothe jingle bells song:>> a = [0.6 0.4 0.2 0.1 0.7 0.6 0.8];>>R = [700 900 600 400 450 390] ;>>[x,fs,nbits] = wavread(jingle.wav);>>y = reverb(x,R,a);>> wavwrite(y,fs,jinglerev.wav);So we finally can see the desired effect that will be recorded at the file?jinglerev.wav?7. References1. Smith, Julius O. Digital Waveguide Modeling of euphonyal Instruments,Center for computer search in medical specialty and Acoustics (CCRMA),Stanford University, 2003-12-10. Web published at http://wwwccrma. stanford.edu/~jos/waveguide/2. K.􀀀Karplus and A.􀀀Strong, ?Digital synthesis of plucked string anddrum timbres,? reckoner Music Journal, vol.􀀀7, no.􀀀2, pp. 43-55,1983, Reprinted in [4]. 3. D.A. Jaffe and J.O. Smith, ?Extensions of the Karplus-Strong pluckedstring algorithm,? Computer Music Journal, vol.􀀀7, no.􀀀2, pp. 56-69,1983, Reprinted in [4]. 4. C.Roads, ed., The Music Machine,Cambridge, MA: MIT Press, 1989. 5. M. Karjalainen, V. V􀀀lim􀀀ki, and Z. J􀀀nosy, ?Towards high-qualitysound synthesis of the guit ar and string instruments,? in Proceedings ofthe 1993! International Computer Music Conference, Tokyo, pp. 56-63,Computer Music Association, Sept. 10-15 1993, available online athttp://www.acoustics.hut.fi/~vpv/publications/icmc93-guitar.htm. 6. Synthesizing a Guitar Using physiological Modeling Techniques (StevenSanders and Ron Weiss) http://www.ee.columbia.edu/~ronw/dsp/. 7. Wikipedia. www.wikipedia.org. If you want to get a skillful essay, order it on our website: OrderEssay.net

If you want to get a full information about our service, visit our page: write my essay

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.