npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

songle-api

v1.2.2

Published

Songle API client library

Downloads

734

Readme

Songle API

Songle API とは

能動的音楽鑑賞サービス Songle (ソングル)の機能や解析結果をあなたのアプリケーションから利用することができるアプリケーション開発者向け API です。 Songle API の提供する機能を組み合わせることで、ウェブ上の好きな音楽の再生に合わせて動作するアプリケーションを容易に開発することができます。大規模音楽連動制御プラットフォーム Songle Sync (ソングルシンク)の機能を使う場合も、こちらをご利用ください。

ドキュメント

詳細な使い方は api.songle.jp よりご確認ください。

クイックスタート

動作要件

Songle API モジュールは、次の環境で動作することが確認されています。

ブラウザ

  • Microsoft Edge 17
  • Mozilla Firefox 62
  • Google Chrome 70
  • Safari 12
  • Opera 55
  • Android Browser 67
  • iOS Safari 11.4
  • Google Chrome for Android 69

Node.js

  • 8.x
  • 9.x
  • 10.x

インストール

ブラウザ

Songle API モジュールは script タグもしくは npm などのパッケージマネージャからインストールすることができます。

<script src="https://api.songle.jp/v2/api.js"></script>

npm

$ npm install songle-api

Hello, Songle API !!

ウェブブラウザから Songle API モジュールを利用した場合、その利用準備の完了を通知する onSongleAPIReady が Songle API モジュールによって自動的に呼び出されます。

self.onSongleAPIReady =
  function(Songle) {
    alert("Hello Songle API !!");
  }

サンプルプログラム

次のサンプルプログラムは、音楽の拍子と連動するプログラムです。サンプルからも分かるように、音楽に連動したイベント駆動のプログラムを容易に記述することができます。

サンプルプログラム1

self.onSongleAPIReady =
  function(Songle) {
    var player =
      new Songle.Player({
        mediaElement: "#songle"
      });

    player.addPlugin(new Songle.Plugin.Beat());
    player.useMedia("https://www.youtube.com/watch?v=zweVJrnE1uY");

    player.on("beatPlay",
      function(ev) {
        switch(ev.data.beat.position) {
          case 1:
            console.log("1st beat !!");
            break;

          case 2:
            console.log("2nd beat !!");
            break;

          case 3:
            console.log("3rd beat !!")
            break;

          case 4:
            console.log("4th beat !!");
            break;
        }
      });
  }

Songle Sync の使い方

Songle Sync (ソングルシンク)とは

ウェブ上の音楽の再生に合わせて多種多様な機器を同時制御することで、一体感のある演出ができる大規模音楽連動制御プラットフォームです。誰でも自分のスマートフォンやパソコン等の機器を自由自在に組み合わせて、好きな楽曲の再生に合わせて光ったり動いたりする演出を作ることができます。

はじめに

この機能を使うためには Songle API のウェブサイトからユーザ登録を行い、トークンを取得する必要があります。取得方法の詳細はチュートリアルのステップ3を参照してください。

チュートリアル

チュートリアルサイトでは、より実践的な使い方を実際に体験しながら学ぶことができます。チュートリアルの内容は、アプリケーション開発者をメインターゲットとしていますが、途中までは、プログラミングの知識がない方でもより高度な大規模音楽連動制御を楽しみながら体験できます。

サンプルプログラム2

次のサンプルプログラムは、サンプルプログラム1を大規模音楽連動制御に対応させたプログラムです。取得したトークンを記述して複数のブラウザからマスターとスレーブを実行してみて、イメージを掴んでみましょう。

ウェブブラウザ / マスター
self.onSongleAPIReady =
  function(Songle) {
    var player =
      new Songle.SyncPlayer({
        accessToken: "YOUR-ACCESS-TOKEN-HERE", // Please edit your access token
        secretToken: "YOUR-SECRET-TOKEN-HERE", // Please edit your secret token
        mediaElement: "#songle"
      });

    player.addPlugin(new Songle.Plugin.Beat());
    player.useMedia("https://www.youtube.com/watch?v=zweVJrnE1uY");

    player.on("beatPlay",
      function(ev) {
        switch(ev.data.beat.position) {
          case 1:
            console.log("1st beat !!");
            break;

          case 2:
            console.log("2nd beat !!");
            break;

          case 3:
            console.log("3rd beat !!")
            break;

          case 4:
            console.log("4th beat !!");
            break;
        }
      });
  }
ウェブブラウザ / スレーブ
self.onSongleAPIReady =
  function(Songle) {
    var player =
      new Songle.SyncPlayer({
        accessToken: "YOUR-ACCESS-TOKEN-HERE", // Please edit your access token
        mediaElement: "#songle"
      });

    player.addPlugin(new Songle.Plugin.Beat());
    player.useMedia("https://www.youtube.com/watch?v=zweVJrnE1uY");

    player.on("beatPlay",
      function(ev) {
        switch(ev.data.beat.position) {
          case 1:
            console.log("1st beat !!");
            break;

          case 2:
            console.log("2nd beat !!");
            break;

          case 3:
            console.log("3rd beat !!")
            break;

          case 4:
            console.log("4th beat !!");
            break;
        }
      });
  }
Node.js / スレーブ

次のサンプルプログラムは Node.js 上で動作するスレーブのサンプルです。

var Songle = require("songle-api");

var player =
  new Songle.SyncPlayer({
    accessToken: "YOUR-ACCESS-TOKEN-HERE", // please edit your access token
  });

player.addPlugin(new Songle.Plugin.Beat());

player.on("beatPlay",
  function(ev) {
    switch(ev.data.beat.position) {
      case 1:
        console.log("1st beat !!");
        break;

      case 2:
        console.log("2nd beat !!");
        break;

      case 3:
        console.log("3rd beat !!")
        break;

      case 4:
        console.log("4th beat !!");
        break;
    }
  });

より詳細なサンプルプログラム

ライセンス

Songle API を利用するためには、利用規約に同意する必要があります。


Copyright (c) 2017-2019 AIST Songle Project