LoginSignup
22
21

More than 5 years have passed since last update.

おめぇの出番だ、悟飯!

Last updated at Posted at 2015-07-25

HTMLで保存してchromeブラウザで開いて
↑x↓blyraと入力してください

残念ながら、カカカ…は再現できませんでした。。

uxdblyra.html
<!DOCTYPE html>
<html>
<title>おめぇの出番だ、悟飯!</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript">
var comp_ary = [];
var base_ary = [38,88,40,66,76,89,82,65];// ↑x↓blyra
$( document ).on('keydown', function(event) {
    comp_ary.push(event.keyCode);
    if (comp_ary.length > base_ary.length) {
        comp_ary.shift();
    }
    $('#comp').text(comp_ary.join(","));
    $('#base').text(base_ary.join(","));
    if (comp_ary.toString() == base_ary.toString()) {
       voice_load("カカロットォー");
    }
});

function voice_load(str) {
    var msg = new SpeechSynthesisUtterance();
    msg.volume = 0.4;
    msg.rate   = 0.5;
    msg.pitch  = 0.1;
    msg.text = str;
    msg.lang = 'ja-JP';
    speechSynthesis.speak(msg);
}

</script>
<body>
<p id="base">aaa</p>
<p id="comp">aaa</p>
</body>
</html>

参考

上X下BLYRAとは (カカロットォとは) [単語記事] - ニコニコ大百科
http://dic.nicovideo.jp/a/%E4%B8%8Ax%E4%B8%8Bblyra
えっ、ブラウザが喋った!スピーチAPIを試してみたよ。【HTML5/Web Speech API】 : フタパパ
http://www.pondad.com/?p=8734

22
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
22
21