Software engineers tinker with 1 and 0 to write their utopia, musicians who play with 12 average-law notes to build their Garden of Eden. Recently, I accidentally saw the "blue Bones" of the film, the actor is a hacker, but also a musical creative talent. In real life, although this is not typical, but is not a special case, I have some fiddling with 0 and 1 of friends, slightly emotional fever.
Previous blog post Rock Bar html5! Audio Front-end interaction! (a) , I introduced the 12 average law, introduced the pitch and value, and talked about its implementation in web audio. At this rhythm, the legato spectrum has a tune. Through this series of blog posts, I have compiled the audio interaction-related JavaScript framework that I wrote before, creating the jsonic.js. With Jsonic.js, audio visualization, speech recognition, audio encoding and composing can be achieved. This article describes how to use Jsonic.js to compose music.
official website http://jsonic.net
Jsonic's composer module is named Melody, where note, Musicscore, and Track3 classes correspond to the implementation of notes, music scores, and audio tracks, respectively. For specific documentation, bash the API!
Note Object can specify the note's roll, time value (full note, 1/2 notes, 1/4 notes ... ), pitch in the word group (default 0, small group), whether there is an attachment point
var New Jsonic.Melody.Note (1,1/2,0,true);
The Musicscore object can specify the mode, and the beat. The following code creates a score of 4/4 beats in E major.
var New Jsonic.Melody.MusicScore (' E ', ' major ', ' 4/4 ');
By changing the mode of the Musicscore, it is convenient to perform the lifting and lowering, and the Musicscore W method can write the note to the score and call the Complie method before playing.
MUSICSOCRE.W (new Jsonic.Melody.Note (3),new Jsonic.Melody.Note (4));
Track objects are used to play Musicscore objects, multiple track objects can play simultaneously, and chords and harmonies can be achieved using the same principle.
var New Jsonic.Melody.Track ();
Call the Play method to play the score, and you can specify the speed of the play, referring to the concept of the value mentioned earlier.
Track.play (musicscore,90);
can refer to the "until the end of the world" Demo, please click Start to play, exposure to childhood ... The demo also realizes the visualization of the signal in the frequency domain and expands it later.
Front-end is a composite career, a composition, I hope that the common progress.
Giithub https://github.com/ArthusLiang/jsonic
Forwarding Please specify the source:http://www.cnblogs.com/Arthus/p/4218572.html
Rock Bar html5! Audio Front-end interaction! (Hello, jsonic!)