Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Playing a Music File from Matlab

  1. Sep 30, 2011 #1
    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).


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


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

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

    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)
  2. jcsd
  3. Oct 1, 2011 #2


    User Avatar
    Gold Member


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

    you can write your own music:

    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);
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook