Playing a Music File from Matlab


by brydustin
Tags: file, matlab, music, playing
brydustin
brydustin is offline
#1
Sep30-11, 05:43 PM
P: 209
I would like to run a calculation so that when it has converged, a song will play.... to alert me from the other room (for example).

http://www.mathworks.co.uk/help/tech...dioplayer.html

I found this but can't quite put it together? Their example was:

Examples

Load and play a sample audio file of Handel's "Hallelujah Chorus:"

load handel;
player = audioplayer(y, Fs);
play(player);

I'm not clear on this..... Okay, so any explanations greatly appreciated; also, you are welcome to suggest a tune to play once convergence is met (its a non-linear least squares problem, maybe it will inspire the tune :O)
Phys.Org News Partner Science news on Phys.org
NASA's space station Robonaut finally getting legs
Free the seed: OSSI nurtures growing plants without patent barriers
Going nuts? Turkey looks to pistachios to heat new eco-city
Pythagorean
Pythagorean is online now
#2
Oct1-11, 02:06 AM
PF Gold
Pythagorean's Avatar
P: 4,187
sound(y,Fs)

where y is the wavefile you want to play and Fs is the sample rate.

you can write your own music:
http://www.lifeorange.com/MATLAB/MATLAB_music.htm

or you can load the handel edxample that comes with matlab, which comes with its own "y" and "Fs"

load handel.mat;
sound(y, Fs);


Register to reply

Related Discussions
Playing Music to Plants Biology 8
Help plotting a wav file as it is playing? Math & Science Software 0
Everyone else is playing music, I got something better General Discussion 3
What music are you playing right now? General Discussion 23
Music playing General Discussion 24