Load File
by Damien Di Fede.
This sketch demonstrates how to use the loadFile
method
of Minim
. The loadFile
method allows you to
specify the file you want to load with a String
and optionally
specify what you want the buffer size of the returned AudioPlayer
to be. If you don't specify a buffer size, the returned player will have a
buffer size of 1024. Minim is able to play wav files, au files, aif files,
snd files, and mp3 files. When you call loadFile
, if you just
specify the filename it will try to load the file from the data folder of
your sketch. However, you can also specify an absolute path
(such as "C:\foo\bar\thing.wav") and the file will be loaded from that
location (keep in mind that won't work from an applet). You can also specify
a URL (such as "http://www.mysite.com/mp3/song.mp3") but keep in mind that
if you run the sketch as an applet you may run in to security restrictions
if the applet is not on the same domain as the file you want to load. You can
get around the restriction by signing the applet. Before you exit your sketch
make sure you call the close
method of any AudioPlayer
's
you have received from loadFile
, followed by the stop
method of Minim
.
Source code: AudioPlayer1datafolderChrono
Built with Processing