9 Working with Sound
Sketch 71: Playing a Sound File
One displays an image but plays a sound; why is that? Whatever the reason, Processing has no standard facility for displaying audio. It does have some libraries for that purpose, however, most importantly Minim. (We used a library in Sketch 50.)
Using Minim, this sketch will play an MP3 or WAV sound file using the standard PC sound interface. Adding to this, if the user presses the A key, the sound will move toward the left speaker, and if they press the D key (which is to the right of the A key), the sound will move toward the right speaker.
The first statement in the program 1 indicates ...
Get An Artist's Guide to Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.