Rock it HTML5! Sound frontend interaction! (Hello, Jsonic !), Html5jsonic

Source: Internet
Author: User

Rock it HTML5! Sound frontend interaction! (Hello, Jsonic !), Html5jsonic

Software engineers are playing with 1 and 0 to write their utopia, And the musicians are playing the notes on the 12 average law to build their Garden of Eden. Recently, I happened to watch the blue bone movie. The leading man in the film is a hacker and has the talent of music creation. In real life, although this is not a special case, I have some friends playing with 0 and 1, with a slight fever.

Previous blogRock it HTML5! Sound frontend interaction! (1)In, I introduced the 12 average law, introduced the sound height and the value, and talked about its implementation in Web Audio. According to this rhythm, the music becomes a music. Through this series of blog posts, I sorted out the previously written Javascript framework related to audio interaction and created jsonic. js. Jsonic. js can be used to achieve audio visualization, speech recognition, audio encoding, and music. This article describes how to use Jsonic. js to make music.

  Official http://jsonic.net

The music module of Jsonic is named Melody. Note, MusicScore, and trackare three categories that correspond to the implementation of notes, music scores, and audio tracks respectively. ClickAPI!

The Note object can specify the name of the Note, the value (full Note, 1/2 Note, 1/4 Note ......), Whether the word group of the pitch is included (0 by default, a group of small words ).

var note = new Jsonic.Melody.Note(1,1/2,0,true);

The MusicScore object can specify the mode and cycle. The following code creates a music score of 4/4 beats in E major.

var musicSocre = new Jsonic.Melody.MusicScore('E','major','4/4');

By changing the mode of musicScore, you can easily tune up or down the music. You can use the w Method of MusicScore to write notes to music scores. You need to call the complie method before playing the music.

musicSocre.w(new Jsonic.Melody.Note(3),new Jsonic.Melody.Note(4));

The Track object is used to play the MusicScore object. Multiple Track objects can be played at the same time, and the chord and harmony can be implemented using the same principle.

var track = new Jsonic.Melody.Track();

Call the play method to play the music score and specify the playing speed. For more information, see the concept of time value.

track.play(musicScore,90);

For details, refer to "till the end of the world"Demo, Please click start to start playing, exposing childhood... The Demo also visualizes the signal in the frequency domain and will be expanded later.

The front-end is a composite profession and an essay, hoping to make progress together.

Giithub https://github.com/ArthusLiang/jsonic

Please indicate the source of forwarding: http://www.cnblogs.com/Arthus/p/4218572.html

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.