Scratch for Java

Stage::addSound()

Adds a new sound.

Examples

import org.openpatch.scratch.*;

public class StageAddSound {

  public StageAddSound() {
    Stage myStage = new Stage(600, 240);
    myStage.addSound("bump", "assets/bump.wav");
    myStage.exit();
  }

  public static void main(String[] args) {
    new StageAddSound();
  }
}

View on GitHub

Syntax

Java

.addSound(name, filePath)

Scratch

Parameters

NameData TypeDescription
nameStringThe name of the sound
filePathStringThe file path of the sound file

Return

void