>> >> 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.
You must write 'foo' function. Maybe name it 'tune_generator' or similar. It takes 'note' - number like 1,2,3.5 or 6 and return
You wrote " sin( _number_ *pi*220*t) + sin( _number_ *pi*440*t); " ten times! It's better to use function than copy&paste code. But of course you code will work.
So sound( [a,a,b,a,f,e,a,a,b,a,g,f], freqsamp ); and "pause" work for you?