Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: Matlab
Replies: 11   Last Post: Dec 13, 2012 12:12 AM

 Search Thread: Advanced Search

 Messages: [ Previous | Next ]
 Tanner Handa Posts: 7 Registered: 12/12/12
Re: Matlab
Posted: Dec 12, 2012 10:41 PM
 Plain Text Reply

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.

Date Subject Author
12/12/12 Tanner Handa
12/12/12 bartekltg
12/12/12 Tanner Handa
12/12/12 bartekltg
12/12/12 Tanner Handa
12/12/12 bartekltg
12/12/12 Tanner Handa
12/12/12 Tanner Handa
12/12/12 bartekltg
12/12/12 Tanner Handa
12/13/12 bartekltg
12/13/12 Tanner Handa

© The Math Forum at NCTM 1994-2017. All Rights Reserved.