Date: Dec 12, 2012 10:41 PM
Author: Tanner Handa
Subject: Re: Matlab
bartekltg <bartekltg@gmail.com> wrote in message <kabhvn$qq8$1@node1.news.atman.pl>...

> W dniu 2012-12-13 03:52, Tanner Handa pisze:

> > bartekltg <bartekltg@gmail.com> wrote in message

>

> > so how would I be able to make my happy birthday song sound better to

> > make the sounds shorter??

> > This is what I have and now when i do t = linspace(0, 0.5, 0.5 *

> > freqsamp); it make the frequencies really high pitched.

>

> I don't see difference in tone between

>

> t = linspace(0,1,freqsamp);

> a = (sin(1.5*pi*220*t) + sin(1.5*pi*440*t));

>

> and

>

> t2= linspace(0,0.5,freqsamp/2);

> a2 = (sin(1.5*pi*220*t2) + sin(1.5*pi*440*t2));

>

>

> sound(a, freqsamp),sound(a2, freqsamp)

>

>

>

> > clear

> > freqsamp = 10000;

> > t = linspace(0,1,freqsamp);

>

> Add 'note length'

>

> nl = 0.4;

>

> t = linspace(0,nl,nl*freqsamp);

>

>

> > a = sin(1.5*pi*220*t) + sin(1.5*pi*440*t);

> > b = sin(2*pi*220*t) + sin(2*pi*440*t);

> > c = sin(2.5*pi*220*t) + sin(2.5*pi*440*t); d = sin(3*pi*220*t) +

> > sin(3*pi*440*t); e = sin(4*pi*220*t) + sin(4*pi*440*t);

> > f = sin(4.5*pi*220*t) + sin(4.5*pi*440*t);

> > g = (sin(5*pi*220*t) + sin(5*pi*440*t))/1.5; h = sin(5.5*pi*220*t) +

> > sin(5.5*pi*440*t);

> > i = sin(6*pi*220*t) + sin(6*pi*440*t);

> > j = sin(6.5*pi*220*t) + sin(6.5*pi*440*t);

>

> OK, I think.

> But you can create function to do this:

>

> a= foo (t, 1.5);

> b= foo (t, 2) ;

> ...

> g= foo(t,5)/1.5;

> ...

>

>

> > sound(a, freqsamp) %HA %3

> > sound(a, freqsamp) %ppy %3

>

> And there is very long pause between sounds.

> You want to play whole song.

>

> sound ( [a,a,b,a,f,e,a,a,b,a,g,f], freqsamp );

>

> But now you haven't any pause. Create short 'pause'

> (vector of silent;) I mean zeros) and add between every note.

> Better: add this to function foo.

>

>

> bartekltg

Im not sure what foo is doing. This isn't working when I try to program this in MATLAB. I believe I understand everything else though.