GithubHelp home page GithubHelp logo

nvdnkpr / ion.sound Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ionden/ion.sound

0.0 3.0 0.0 762 KB

jQuery-plugin for playing sounds on events

Home Page: http://ionden.com/a/plugins/ion.sound/en.html

ion.sound's Introduction

Ion.Sound 1.3.0

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

Plugin for playing sounds on events.


Description

  • Crossbrowser support: Google Chrome, Mozilla Firefox, Opera, Safari, IE(9.0+) and mobile browsers
  • GitHub Page.
  • Ion.Sound freely distributed under terms of MIT licence.
  • Ion.Sound includes 25 free sounds

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.

Dependencies

Usage

Import this libraries:

  • jQuery
  • 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

It is not enough to have only Mp3-file, you should make Ogg-file too, because not all browsers support Mp3.
You can easily convert you Mp3-s to Ogg-s at Media.io or at CloudConvert.org.

Initialisation

To initialise plugin call this method:

$.ionSound({
    sounds: [
        "my_cool_sound"
    ]
});

And play sound!

$.ionSound.play("my_cool_sound");

Settings

Settings Default Description
sounds ["water_droplet:0.5"] Optional property, you can set your own sounds collection here. It is array.
:0.5 - optional individual volume. Example: sound_name:0.2
path "static/sounds/" Optional property, set path to folder with sounds.
multiPlay true Optional property, if set to false, will allow plugin to play only 1 sound at once.
volume 0.5 Optional property, will set base volume from 0.0 to 1.0

An example of a customised plugin:

$.ionSound({
    sounds: [                       // set needed sounds names
        "beer_can_opening",
        "bell_ring:0.3",            // :0.3 - individual volume
        "branch_break",
        "metal_plate",
        "pop_cork:0.8",             // :0.8 - individual volume
        "staple_gun",
        "water_droplet:0.4"         // :0.4 - individual volume
    ],
    path: "sounds/",                // set path to sounds
    multiPlay: false,               // playing only 1 sound at once
    volume: "0.3"                   // not so loud please
});

Methods

Playing sound:

$.ionSound.play("button_tiny");

// For example playing sound on button click

$("#myButton").on("click", function(){
    $.ionSound.play("button_tiny");
});

// or reset the sound volume

$("#myButton").on("click", function(){
    $.ionSound.play("button_tiny:0.5");
});

Stop sound playback:

$.ionSound.stop("button_tiny");

Remove sound from memory:

$.ionSound.kill("button_tiny");

Destroying the plugin:

$.ionSound.destroy();

Update history

  • November 30, 2013 - new methods "stop" and "kill". Ability to reset sound volume.
  • October 13, 2013 - now you can set individual volume for any sound. Improved test environment.
  • September 21, 2013 - plugin moved to jQuery namespace, new method and 10 new sounds
  • September 08, 2013 - iOS not playing sound bug fix
  • September 08, 2013 - Little enhancement
  • September 07, 2013 - Plugin release

ion.sound's People

Contributors

ionden avatar

Watchers

Navid Nikpour avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.