Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sound-play

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sound-play

An sound player for NodeJS.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

sound-play

Dead simple sound player for Node -- because it should be simple.

const sound = require("sound-play");
sound.play("file.mp3");
  • Support .wav, .mp3 and other extensions.

  • Work on Windows and MacOS

Install

npm install sound-play
yarn add sound-play

Examples

Relative path

sound.play("file.mp3");

or

const path = require("path");
const filePath = path.join(__dirname, "file.mp3");
sound.play(filePath);

Adjusting Volume

/**
 * 0   = silent
 * 0.5 = default
 * 1   = max volume
 */
volume = 0.1;
sound.play("file.mp3", volume);

Absolute path

sound.play("C:\\file.mp3");

Promise

sound.play("file.mp3").then((response) => console.log("done"));

Async/await

try {
  await sound.play("file.mp3");
  console.log("done");
} catch (error) {
  console.error(error);
}

License

MIT

Keywords

FAQs

Package last updated on 03 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc