npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ion-sound

v3.0.7

Published

JavaScript plugin for playing sounds and music in web

Downloads

1,030

Readme

ion.sound

English description | Описание на русском

JavaScript plugin for playing sounds on user actions and page events.


  • Version: 3.0.7
  • Project page and demos
  • Download ZIP

Description

  • Ion.Sound — JavaScript-plugin for playing sounds based on Web Audio API.
  • Plugin is working on most popular desktop and mobile browsers and can be used everywhere, from common web sites to browser games.
  • For not so modern browsers plugin falls back to HTML5 audio.
  • Audio-sprites support included.
  • Ion.Sound freely distributed under terms of MIT licence.
  • 25 free sounds included

Today websites are full of events (new mail, new chat-message, content update etc.). Often it is not enough to indicate this events only visually to get user attention. You need sounds! This library, made for playing small sounds, will help you with this task. Also, new version of Ion.Sound is capable to handle browser games audio. It has full control of loading, playing and removing audio files. And audio-sprites support of course.

Supported browsers

Desktop Windows, OS X, Linux:

  • Google Chrome
  • Mozilla Firefox
  • Microsoft Internet Explorer 9.0+
  • Opera 12.16+
  • Safari 5.1+ (Safari on Windows requires QuickTime to play sounds)

Mobile:

  • iOS Safari and others (with some restrictions)
  • Android Google Chrome and others (with some restrictions also)
  • WP8 Internet Explorer

Can i use Web Audio API and HTML5 Audio?

Demos

  • Basic demo
  • Advanced demo

Dependencies

  • None

Usage

Import this library:

  • ion.sound.min.js

Prepare sound-files (25 sounds are included) and put them in some folder (eg. "sounds"):

  • my_cool_sound.mp3
  • my_cool_sound.ogg
  • my_cool_sound.aac

It is not enough to have only MP3-file, you should make OGG and AAC-file too, because not all browsers support MP3. You can easily convert you MP3-s to OGG-s and AAC-s at Media.io or at CloudConvert.org. AAC support was added to improve cross browser support of iOS 8.x devices (iPhone, iPad)

Install with bower

  • bower install ionsound

Install with npm

  • npm install ion-sound

Install with spm

  • spm install ion-sound

Initialisation

To initialise plugin call this method:

ion.sound({
    sounds: [
        {
            name: "my_cool_sound"
        },
        {
            name: "notify_sound",
            volume: 0.2
        },
        {
            name: "alert_sound",
            volume: 0.3,
            preload: false
        }
    ],
    volume: 0.5,
    path: "sounds/",
    preload: true
});

And play sound!

// Simple
ion.sound.play("my_cool_sound");

General settings

    <tr>
        <td>path</td>
        <td>-</td>
        <td>string</td>
        <td>Path to file</td>
    </tr>
    <tr>
        <td>preload</td>
        <td>false</td>
        <td>boolean</td>
        <td>Preloading sounds</td>
    </tr>
    <tr>
        <td>multiplay</td>
        <td>false</td>
        <td>boolean</td>
        <td>Sound multi play. If set, will allow to play multiple instances of one sound at once</td>
    </tr>
    <tr>
        <td>loop</td>
        <td>false</td>
        <td>boolean/number</td>
        <td>If set to true will enable infinite loop. Or paste a number to set loop limit</td>
    </tr>
    <tr class="options__step">
        <td>volume</td>
        <td>1.0</td>
        <td>number</td>
        <td>Playback volume from 0 to 1</td>
    </tr>

    <tr>
        <td>scope</td>
        <td>null</td>
        <td>object</td>
        <td>Callbacks will be called in that object's scope</td>
    </tr>
    <tr>
        <td>ready_callback</td>
        <td>null</td>
        <td>function</td>
        <td>Called after sound file is fully uploaded (or ready to play for HTML5 audio)</td>
    </tr>
    <tr>
        <td>ended_callback</td>
        <td>null</td>
        <td>function</td>
        <td>Called each time then sound file will reach it's end</td>
    </tr>
</tbody>

Sound object

Plugin can be launched in jQuery namespace

  • Use aliases to call any plugin methods: ion.sound(); -> $.ionSound();
  • ion.sound.play("sound_name"); -> $.ionSound.play("sound_name");
  • Etc.

Update history


Support Ion-series plugins development:

  • Donate through Pledgie service:

  • Donate direct to my Paypal account: https://www.paypal.me/IonDen

  • Donate direct to my Yandex.Money account: http://yasobe.ru/na/razrabotku