Coder Social home page Coder Social logo

talking-image's Introduction

Talking Image

Add audio to Web images

What is Talking Image?

Talking Image is a JavaScript library for playing audio appended to GIF, JPEG, and PNG images. Include the talking-image.min.js on a webpage with a talking image (image with appended audio) and hear the sound come alive.

Give me a quick demo!

Demos be here: http://hacksparrow.github.io/talking-image/

To see the demos from the repo, make sure you have Node.js installed on your system. Clone the repo and run the demo server to see the demos. Follow these instructions:

$ git clone [email protected]:hacksparrow/talking-image.git  
$ npm install  
$ node demos

Then load http://localhost:3000/demos.html.

If you don't want to clone the repo, download talking-image.min.js and the files from the demo/public directory and host them on any HTTP server of your own.

What is a talking image

Talking image refers to an image with an audio payload appended at the end of image data. Currently OGG and MP3 audio formats are supported.

How do I add talking images to my webpage?

You use the regular <img> tag but add an additional attribute called data-audio, in which you set the options. Eg: <img src="cool.gif" data-audio="autoplay loop">.

Options for the audio attribute

  1. autoplay - start playing the audio as soon as possible. If autoplay is not set, you will have to click on the image to start playing the sound.
  2. sync - try to sync the animation and the audio. There is no guarantee they will be in sync.
  3. loop - loop the audio
  4. volume - specify the volume. 1 for max volume. Eg: <img src="" data-audio="volume=0.5">

Note: You can click on the image to mute the audio any time you want.

Where can I find some talking images?

This project hosts some talking images in the public directory under the demos directory.

How can I create talking images?

The idea behind talking images is to append OGG or MP3 data to an existing image file - nothing more than that.

On Linux / Mac:

$ cat music.ogg >> funny.gif

or

$ cat beethoven.mp3 >> welcome.jpg

On Windows:

> copy /b funny.gif + music.ogg funny-music.gif

There are some 'clean' images and audio snippets in the resources directory, play around with it.

Note: Audio file should be appended to the image file to create a valid talking file. Reversing the order will generate a corrupted file.

Why is it called Talking Image?

Images on the Web have been 'mute' so far, the technique described here and the library add sound to Web images. The 'talking' in Talking Image comes from talkies.

Is it of any use?

Now you can enjoy the audio-visual experience of Nyan Cat for infinite hours without loading a YouTube video.

How does it work?

Using binary data in the browser powered by jDataView and jBinary.

License (MIT)

Copyright (c) 2012 Hage Yaapa <http://www.hacksparrow.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

talking-image's People

Contributors

hacksparrow avatar mikach avatar

Watchers

 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.