Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
ec334891fThis file is pinned to the selected release. Download the original to open it in your design tool.
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="amyrepl.css"/>
<title>Tulip Web</title>
<meta charset="UTF-8">
<meta property="og:title" content="Tulip Web">
<meta property="og:image" content="https://tulip.computer/img/tulip_hero.jpg">
<meta property="og:description" content="Tulip on the web. Run Tulip in the browser. Share your creations with others.">
<meta property="og:type" content="product" />
<meta property="og:url" content="https://tulip.computer"/>
<meta property="og:site_name" content="Tulip Web"/>
<meta property="product:price:amount" content="58.90"/>
<meta property="product:price:currency" content="USD"/>
<meta property="og:availability" content="instock" />
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
<meta name="description" content="Tulip on the web. Run Tulip in the browser. Share your creations with others.">
<meta name="author" content="shore pine sound systems">
<meta name="HandheldFriendly" content="true">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@shorepinesound">
<meta name="twitter:creator" content="@shorepinesound">
<meta name="twitter:title" content="Tulip Web">
<meta name="twitter:description" content="Tulip on the web. Run Tulip in the browser. Share your creations with others.">
<meta name="twitter:image" content="https://tulip.computer/img/tulip_hero.jpg">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="icon" type="image/png" sizes="96x96" href="/img/favicon.png">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.48.4/codemirror.min.css" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
<link rel="stylesheet" href="/css/all.css" id="treejs_styles">
<script src="tree.js"></script>
<link rel="stylesheet" href="treejs.css" id="treejs_styles">
<script src="./mini-coi.js" scope="./"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/webmidi@latest/dist/iife/webmidi.iife.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/mode/python/python.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.63.3/codemirror.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.63.3/mode/python/python.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<!-- These filenames are replaced by the build system -->
<script src="TULIPCCMJS" type="module"></script>
<script type="text/javascript" src="AMYJS"></script>
<script type="text/javascript" src="examples.js"></script>
<script type="text/javascript" src="spss.js"></script>
</head>
<body>
<script type="module">
mp = await loadMicroPython({
stdout:null,
linebuffer: false,
pystack: 64 * 1024,
heapsize: 8 * 1024 * 1024
});
// Tell MP to start serving a REPL
await mp.replInit();
// Start up the Tulip stuff
await start_tulip();
// Fill the ree
await fill_tree();
// Create the editor and see if there's a share URL to decompress into it
var editorElement = document.getElementById('collapseEditor');
editor = CodeMirror.fromTextArea(document.getElementById(`code`), {
mode: {
name: "python",
version: 3,
singleLineStringErrors: false,
lint: false
},
lineNumbers: true,
indentUnit: 4,
matchBrackets: true,
spellCheck: false,
autocorrect: false,
theme: "lucario",
lint: false,
});
editor.setSize(null,200);
// Load in the share code if given
const queryString = window.location.search;
const url_params = new URLSearchParams(queryString);
var share = url_params.get('share');
if(share != null) {
var bsCollapse = new bootstrap.Collapse(editorElement, { toggle: true });
show_editor();
try {
var code = await decompress(decodeURIComponent(share));
editor.setValue(code);
var fn = url_params.get('fn');
if(fn != null) {
document.getElementById('editor_filename').value = fn;
}
setTimeout(function () { editor.save() }, 100);
setTimeout(function () { editor.refresh() }, 250);
setTimeout(function () { window.scrollTo(0,0) }, 300);
} catch (e) {
console.log("Couldn't decode share");
}
}
</script>
<div class="container my-2">
<div class="px-2 maintulipview">
<h1><A HREF="https://tulip.computer/"><img src="/img/favicon.png"/ width=40></A>Tulip Web</h1>
<p>
<button class="btn btn-sm btn-primary" type="button" id="showhideeditor" data-bs-toggle="collapse" data-bs-target="#collapseEditor" aria-expanded="true" aria-controls="collapseEditor" onclick="show_editor();">
Show code editor
</button>
</p>
<div class="editor collapse" id="collapseEditor">
<div class="alert fixed-top d-none" id="alert_box"></div>
<div class="row g-0 headertext">
<div class="col-3 headertext">
<span class="px-1 small align-middle">Tulip files</span>
<div id="treecontainer"></div>
</div>
<div class="col-9 headertext">
<span class="px-1 small align-middle">Code editor</span>
<section class="input">
<div><textarea id="code" name="code"></textarea></div>
</section>
</div>
</div>
<div class="row">
<div class="col-3">
<div class="align-self-center my-3">
<button type="button" title="Refresh Tulip file list" data-toggle="tooltip" data-placement="top" class="btn btn-sm btn-warning" onclick="fill_tree()"><i class="fas fa-sync"></i></button>
<button type="button" title="Download file from Tulip" data-toggle="tooltip" data-placement="top" class="btn btn-sm btn-success" onclick="download()"><i class="fas fa-download"></i></button>
<button type="button" title="Upload file to Tulip into the selected folder" data-toggle="tooltip" data-placement="top" class="btn btn-sm btn-primary" onclick="upload()"><i class="fas fa-upload"></i></button>
<button type="button" title="Load selected Tulip file into editor" data-toggle="tooltip" data-placement="top" class="btn btn-sm btn-danger" onclick="load_editor()"><i class="fas fa-chevron-circle-right"></i></button>
</div>
</div>
<div class="col-9">
<div class="align-self-center my-3">
<button type="button" title="Save editor contents to file on Tulip into the selected folder" data-toggle="tooltip" data-placement="top" class="btn btn-sm btn-danger" onclick="save_editor()"><i class="fas fa-chevron-circle-left"></i></button>
<button type="button" title="Run editor contents in Tulip" data-toggle="tooltip" data-placement="top" class="btn btn-sm btn-success" onclick="runEditorBlock()"><i class="fas fa-running"></i></button>
<button type="share" title="Share editor contents (and filename, if given) as a URL" data-toggle="tooltip" data-placement="top" class="btn btn-sm btn-warning" id="shareButton" onclick="shareCode()"><i class="fas fa-share-square"></i></button>
<input type='text' title="Filename for saving or sharing" data-toggle="tooltip" data-placement="top" id="editor_filename" class="small" placeholder="Filename"/>
<button type="button" class="btn btn-sm btn-primary float-end" onclick="hide_editor();"
data-bs-toggle="collapse" title="Hide editor" data-toggle="tooltip" data-placement="top" data-bs-target="#collapseEditor" aria-expanded="true" aria-controls="collapseEditor">
Hide
</button>
</div>
</div>
</div>
</div>
<!-- Fake textarea to capture keystrokes to the SDL canvas -->
<textarea id="textinput" autocapitalize="off" rows="1"></textarea>
<!-- Tulip's SDL canvas -->
<canvas id="canvas" tabindex=0 class="canvas-solo"></canvas>
<!-- MIDI settings panel if MIDI is available -->
<form name="tulip_settings">
<div class="row align-items-start" id="midi_settings">
<div class="col-4 align-self-start small">
MIDI input device:
<select onchange="setup_midi_devices()" name="midi_input" class="form-select form-select-sm" aria-label=".form-select-sm example">
<option selected>[Not available]</option>
</select>
</div>
<div class="col-4 align-self-start small">
MIDI output device:
<select onchange="setup_midi_devices()" name="midi_output" class="form-select form-select-sm" aria-label=".form-select-sm example">
<option selected>[Not available]</option>
</select>
</div>
</div>
</form>
</div>
</div>
<div class="container my-2">
<div class="px-2 py-4">
<h2>Welcome to a version of <a href="https://tulip.computer/">Tulip</a> running locally in your browser.</h2>
<!-- Tutorial pills block -->
<div class="py-2">
<div class="card">
<div class="card-header">
Try some examples! They'll load and run in the Tulip window above.
</div>
<div class="card-body" id="tutorials"></div>
</div>
</div>
<p>
Tulip is a creative computer running Python with lots of music and graphics functionality. <A HREF="https://tulip.computer">You can buy a hardware Tulip for $59.</A>
</p>
<P>
This version of Tulip runs locally live in your browser. The files are stored in your browsers' storage. It's almost perfectly like a real Tulip, including support for MIDI, graphics, synthesis and Python. There's some small changes and things we haven't yet ported over to the web, see below.
</p>
<p>If you've never used Tulip before, please check out the examples above and these getting started tips:</p>
<div class='row'>
<div class='col-4'>
<ul>
<li><A href="https://github.com/shorepine/tulipcc/blob/main/docs/getting_started.md">Getting Started on Tulip</A></li>
<li><A href="https://github.com/shorepine/tulipcc/blob/main/docs/music.md">Make music tutorial</A></li>
<li><A href="https://github.com/shorepine/tulipcc/blob/main/docs/tulip_api.md">Full Tulip API</A></li>
<li><A href="https://github.com/orgs/shorepine/projects/1">Roadmap</A></li>
</ul>
</div>
<div class='col-8 overflow-hidden'>
<P>
<a href="https://tulip.computer"><img src="/img/tulip-shop-1.jpg" width=500/></a>
</P>
</div>
</div>
<h3>Some notes on the web port:</h3>
<ul>
<li>If you're using Private Browsing mode, we can't keep your files around after you reload. And on <A HREF="https://bugzilla.mozilla.org/show_bug.cgi?id=1320796">Firefox Private Browsing, the page won't work at all.</A> Don't worry, we're not doing anything nefarious here. No data leaves this page, unless you choose to connect to Tulip World to send a message or download a program. <a href="https://github.com/shorepine/tulipcc/tree/main/tulip/web">Everything is open source.</a>
<li>MIDI works on almost all browsers <a href="https://webmidijs.org/docs/getting-started/">except for Safari</a></li>
<li>Tulip World works, as does <code>url_save</code>. Other Tulip network calls may return a JS "promise" rather than a Python result.</li>
<li>Anything relying on <code>input</code> will fail. Most things using <code>time.sleep()</code> will sleep, but will block all other callbacks, audio and graphics from updating. Instead, use callbacks, <code>asyncio</code> or <code>tulip.defer</code> if you want to block or defer execution in Tulip.</li>
<li>Audio input is available on Tulip but not here, as the microphone privacy prompt is too annoying and you can't change input sources for audio processing on the web yet. You can change our <code>amy.js</code> include to <code>amy-audioin.js</code> if you want it.</li>
</ul>
<div class="row py-3 my-5 px-1 mx-1 bg-light bg-gradient">
<div class="col-4 py-vh-3" data-aos="fade-up">
<a href="https://tulip.computer/"><img src="/img/tulip.svg" width=42 height=42></a>
<a href="https://tulip.computer/"><h3 class="h5 my-2">Want more? Get a Tulip</h3></a>
<p>Get your own hardware Tulip for only US$59.</p>
</div>
<div class="col-4 py-vh-3" data-aos="fade-up">
<a href="https://discord.com/invite/TzBFkUb8pG"><img src="/img/discord-mark-black.svg" width=42 height=42></a>
<a href="https://discord.com/invite/TzBFkUb8pG"><h3 class="h5 my-2">Discord</h3></a>
<p>Join the <strong>shore pine sound systems</strong> Discord to chat about Tulip, AMY and Alles. A fun small community!</p>
</div>
<div class="col-4 py-vh-3" data-aos="fade-up" data-aos-delay="200">
<a href="https://github.com/shorepine/tulipcc"><img src="/img/github-mark.svg" width=42 height=42/></a>
<a href="https://github.com/shorepine/tulipcc"><h3 class="h5 my-2">Github</h3></a>
<p>Check out the Tulip Github page for issues, discussions and the code.</p>
</div>
</div>
<div class="row py-3 my-5 px-1 mx-1 bg-light bg-gradient">
<h3 class="h5 my-2"><A href="https://confirmsubscription.com/h/y/204B1B40E85DDBA3">Join our email list</A></h3>
<p>We'll send you <A HREF="https://confirmsubscription.com/h/y/204B1B40E85DDBA3"><strong>very rare</strong> updates</A> about Tulip, Alles, AMY and other projects we're working on.</p>
</div>
</div>
</div>
<script language="javascript">
// On keypress or click anywhere, start audio worklet
document.body.addEventListener('click', start_audio, true);
document.body.addEventListener('keydown', start_audio, true);
// We have to force that a click on the canvas focuses a hidden textinput, so that SDL can receive keypresses.
document.querySelector('#canvas').addEventListener('click', function() {
document.getElementById("textinput").focus({preventScroll:true});
});
$(function () {
$('[data-toggle="tooltip"]').tooltip({delay: { "show": 1000, "hide": 100 }})
})
fill_examples();
</script>
</body>
</html>