Here's how you can get your Arduino to tell your laptop to play a music or sound file. To do this, you'll first need to install Processing on your laptop. Processing is a programming language for doing things on your laptop. One nice thing about Processing is that it is very similar to (but not identical to) Arduino programming. Installing Processing, once you've downloaded it from the Processing website, should hopefully be straightforward.

Get Processing running; you'll then need to install the Minim library. To do this, go the Sketch menu, then choose "Import Library," then "Add Library." In the search box under Libraries, type "Minim". Click "Minim", then click the "Install" button further down the window.

Then find a music or a sound file you'd like your laptop to play. I've successfully gotten it to work with MP3 and AIFF files; I suspect it will play all sorts of formats. The idea is that you're going to create an Arduino program to write bytes to the serial connection to your computer, across the USB cable; then you'll use Processing to monitor that connection, and if a certain code is detected, then to play a sound. Here is some sample code.

Arduino program:

int button = 2;
byte arbitraryCode = 97;
 
void setup() {
  Serial.begin(9600);
}
 
void loop() {
  if (!digitalRead(button)) {
    Serial.write(arbitraryCode);
    delay(500);
  }
}


Processing program:

import processing.serial.*;
import ddf.minim.*;
 
Serial myPort;
Minim minim;
AudioPlayer player;
byte arbitraryCode = 97;
 
void setup()
{
  // In the next line, you'll need to change this based on your USB port name
  myPort = new Serial(this, "/dev/tty.usbserial-A601FUX6", 9600);
  minim = new Minim(this);
 
  // Put in the name of your sound file below, and make sure it is in the same directory
  player = minim.loadFile("soundfile.mp3");
}
 
void draw() {
  while (myPort.available() > 0) {
    int inByte = myPort.read();
    if (inByte == arbitraryCode) {
      player.rewind();
      player.play();
    }
  }
}