Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

<button id="tonejs_kaeru">カエルの歌</button>
<button id="tonejs_kaeru">カエルの歌(1小節遅れ)</button>
<button id="tonejs_kaerusuper">カエルの歌(ゴージャス)</button>
<button id="tonejs_kaerusuper_time">カエルの歌(絶対値での指定)</button>
<button id="transport_start">Transport_start</button>
<button id="transport_stop">Transport_stop</button>
<button id="transport_stop_delete">Transport_stop(イベントも削除)</button>

let synth = new Tone.PolySynth().toMaster();

let kaeru = ['C5','D5','E5','F5','E5','D5','C5',null,'E5','F5','G5','A5','G5','F5','E5',null,'C5',null,'C5',null,'C5',null,'C5',null,['C5','C5'],['D5','D5'],['E5','E5'],['F5','F5'],'E5','D5','C5']; 

let CM=["C3","E3","G3","C4"];
let kaerusuper = [

let kaerusuper_time = [{"time": 0, "note":["C4","E4","G4","C5"], "duration": "4n"},//←変数の指定はできる
         {"time": 1, "note": "D5", "duration": "4n"},
         {"time": 2, "note":["E4","G4","B4","E5"], "duration": "4n"},//←個別和音と変数を同時に指定することはできない
         {"time": 3, "note": "F5", "duration": "4n"},
         {"time": 4, "note": "E5", "duration": "8n"},
         {"time": 4.25, "note": "C5", "duration": "8n"},
         {"time": 4.5, "note": "D5", "duration": "8n"},
         {"time": 4.75, "note": "E5", "duration": "8n"},
         {"time": 5, "note": "D5", "duration": "4n"},
         {"time": 6, "note": "C5", "duration": "4n"},

function playkaerusuper_time(){
    let part = new Tone.Part(function(time, note){
        //the notes given as the second element in the array
        //will be passed in as the second argument
        synth.triggerAttackRelease(note.note, note.duration, time);
    }, kaerusuper_time).start(0);

function kaeruPlay(time, note) {
    synth.triggerAttackRelease(note, '4n', time);

    let melody = new Tone.Sequence(kaeruPlay, kaeru).start()
    melody.loop = 2

function kaeruPlay_8n(time, note) {
    synth.triggerAttackRelease(note, '8n', time);

    let kaerusuper_play = new Tone.Part(kaeruPlay_8n, kaerusuper).start();



Tone.Transport.bpm.value = 90;


🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.