Git Product home page Git Product logo

sssynthesiser.js's Introduction

SSSynthesiser.js

Web Audio API synthesiser. Pure HTML5 implementation. Compatible with desktop and mobile Chrome/Opera/Firefox/Safari/Edge.

Examples

Using

Add link to your page:

<script src="SSSynthesiser.js"></script>

Download song data and initialize engine:

var sssynthesiser = null;
var xmlHttpRequest = new XMLHttpRequest();
xmlHttpRequest.open('GET', "http://molgav.nn.ru/x/sviridovtimeforward.molgav", true);
xmlHttpRequest.onload = function () {
	var o = JSON.parse(xmlHttpRequest.response);
	sssynthesiser = new SSSynthesiser(o);
};
xmlHttpRequest.send();

Start play:

sssynthesiser.startPlaySong()

Stop play:

sssynthesiser.stopPlaySong();

Change instruments's properties:

sssynthesiser.findSampleBySubPath("drums/000/Chaos_128/061_046-046_60_-4600.0_8-34789_32000").volume = 0.25;

Control play order:

sssynthesiser.moveToNextPosition = function(){
	if((sssynthesiser.currentX == 3 && sssynthesiser.currentY == 2) || sssynthesiser.currentY < 1 || sssynthesiser.currentY >2 ){
		sssynthesiser.currentX = 0;
		sssynthesiser.currentY = 1;
		sssynthesiser.currentPosition = sssynthesiser.findPosition(sssynthesiser.currentX, sssynthesiser.currentY);
		return;
	}
	else{
		sssynthesiser.findAndMoveToNextPosition();
	}
};

Play a instrument:

sssynthesiser.playKey(sssynthesiser.findSampleBySubPath(s),1000,45);

Play a drum:

sssynthesiser.playSample(sssynthesiser.findSampleBySubPath(s),2000);

Play a chord:

sssynthesiser.playChord(sssynthesiser.findSampleBySubPath(s),2000,[48,52,55,60,64]);

Song data format

Song similar to tracker modules. It should include patterns, positions, binary samples etc. See example of song.

You can use Molgav to create song data or convert your MIDI-files.

  • open Molgav
  • select menu item 'import from.mid'
  • edit song
  • select menu item 'save song as'

sssynthesiser.js's People

Contributors

surikov avatar

Watchers

James Cloos 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.