From bda3a99797df33f8bff48960318b14a0d81c52a3 Mon Sep 17 00:00:00 2001 From: Richard Date: Wed, 16 Apr 2025 01:04:34 +0100 Subject: remove .pyc files --- .gitignore | 1 + site/app/base/base.js | 1 + site/app/twirl/appdata.js | 8 ++++---- site/app/twirl/transform.js | 8 ++++---- site/app/twirl/twirl.js | 10 ++++++++-- site/app/twirl/twirl_compiler.py | 15 +++++++++++---- site/app/twist/index.html | 2 ++ site/app/twist/twist.js | 30 +++++++++++++++++++++++++++++- site/app/twist/twist_ui.js | 12 ++++++++++++ site/service/config.pyc | Bin 275 -> 0 bytes site/service/db.pyc | Bin 1933 -> 0 bytes site/udo/twist/transforms/generate.udo | 8 ++++---- 12 files changed, 76 insertions(+), 19 deletions(-) delete mode 100644 site/service/config.pyc delete mode 100644 site/service/db.pyc diff --git a/.gitignore b/.gitignore index f091da1..3e0e9c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ site/service/config.py site/udo/__config__.udo +*.pyc diff --git a/site/app/base/base.js b/site/app/base/base.js index 8bf12f2..5438e16 100644 --- a/site/app/base/base.js +++ b/site/app/base/base.js @@ -75,6 +75,7 @@ var CSApplication = function(appOptions) { async function copyUrlToLocal(url, name) { if (!csound) return; + if (!name) name = basename(url); const response = await fetch(url); const arrayBuffer = await response.arrayBuffer(); await copyDataToLocal(arrayBuffer, name); diff --git a/site/app/twirl/appdata.js b/site/app/twirl/appdata.js index b417c3f..b8a7734 100644 --- a/site/app/twirl/appdata.js +++ b/site/app/twirl/appdata.js @@ -271,7 +271,7 @@ twirl.appdata = { parameters: [ {preset: "amp"}, {presetgroup: "notefreq"}, - {name: "Feedback", min: 0.1, max: 10, dfault: 1.1}, + {name: "Feedback", min: 0.1, max: 10, dfault: 2}, {name: "Filter bandwidth", channel: "bandwidth", min: 10, max: 500, dfault: 125}, {name: "Post gain", channel: "postgain", min: 0.1, max: 2, dfault: 1}, {presetgroup: "applymode"} @@ -285,10 +285,10 @@ twirl.appdata = { parameters: [ {preset: "amp"}, {presetgroup: "notefreq"}, - {name: "Frequency step multiplier", channel: "multiplier", min: 1.0001, max: 2, dfault: 1.1}, - {name: "Frequency multiplier", channel: "stepmultiplier", min: 0.5, max: 2, dfault: 1}, + {name: "Frequency step multiplier", channel: "stepmultiplier", min: 1.0001, max: 2, dfault: 1.1}, + {name: "Frequency multiplier", channel: "multiplier", min: 0.5, max: 2, dfault: 1}, {name: "Amplitude smoothing", channel: "ampprofile", min: 0, max: 1, step: 1, dfault: 1}, - {name: "Harmonics", min: 2, max: 256, dfault: 64, automatable: false}, + {name: "Harmonics", min: 2, max: 128, step: 1, dfault: 64, automatable: false}, {presetgroup: "applymode"} ] } diff --git a/site/app/twirl/transform.js b/site/app/twirl/transform.js index 1feff51..2d89d8c 100644 --- a/site/app/twirl/transform.js +++ b/site/app/twirl/transform.js @@ -1011,11 +1011,11 @@ twirl.transform.Transform = function(options) { } } groupParameters = [ - {name: "Apply mode", channel: "applymode", absolutechannel: true, description: "Apply mode", automatable: true, options: ["Replace", "Mix", "Modulate", "Demodulate", "Filter"], dfault: 0, conditions: pdef.conditions}, + {name: "Apply mode", channel: "applymode", absolutechannel: true, description: "Apply mode", automatable: true, options: ["Replace", "Mix", "Modulate", "Demodulate", "Filter mix"], dfault: 0, conditions: pdef.conditions}, {name: "Dry mix", description: "Original signal amplitude", channel: "applymodedry", absolutechannel: true, conditions: conditionsMix, min: 0, max: 1, dfault: 1}, {name: "Wet mix", description: "Transformed signal amplitude", channel: "applymodewet", absolutechannel: true, conditions: conditionsMix, min: 0, max: 1, dfault: 1}, - {name: "Minimum frequency", description: "Minimum frequency to transform", channel: "applymodedry", absolutechannel: true, conditions: conditionsFilter, min: 20, max: 44100, dfault: 500}, - {name: "Maximum frequency", description: "Maximum frequency to transform", channel: "applymodedry", absolutechannel: true, conditions: conditionsFilter, min: 20, max: 44100, dfault: 2000} + {name: "Minimum frequency", description: "Minimum frequency to transform", channel: "applymodehpf", absolutechannel: true, conditions: conditionsFilter, min: 20, max: 22000, dfault: 500}, + {name: "Maximum frequency", description: "Maximum frequency to transform", channel: "applymodelpf", absolutechannel: true, conditions: conditionsFilter, min: 20, max: 22000, dfault: 2000} ]; } else if (pdef.presetgroup == "pvanal") { @@ -1195,7 +1195,7 @@ twirl.transform.TreeView = function(options) { var dp = items[k].added.split("-"); var added = new Date(dp[0], dp[1] - 1, dp[2]); if (Math.round((new Date() - added) / (1000 * 60 * 60 * 24)) <= 14) { - x.html(name + "

  [new]

"); + content = name + "

  [new]

"; } } li.html(content).css("cursor", "pointer").click(function() { diff --git a/site/app/twirl/twirl.js b/site/app/twirl/twirl.js index 5f201f6..71c3316 100644 --- a/site/app/twirl/twirl.js +++ b/site/app/twirl/twirl.js @@ -31,7 +31,7 @@ twirl.init = function() { var NoteData = function() { var self = this; this.data = null; - fetch("https://apps.csound.1bpm.net/app/twirl/notedata.json").then(function(r) { + fetch("../twirl/notedata.json").then(function(r) { r.json().then(function(j) { self.data = j; }); @@ -93,6 +93,12 @@ twirl.random = { } }; +twirl.getSharedFiles = async function() { + var data = await fetch("../sounddb/data.json"); + var json = await data.json(); + return json; +}; + twirl.createIcon = function(definition) { var state = true; var active = true; @@ -272,7 +278,7 @@ twirl.sendErrorState = async function(errorObj) { if (twirl._remote.sessionID) { data.session_id = twirl._remote.sessionID; } - var resp = await fetch("https:///service/", { + var resp = await fetch("https:///apps.csound.1bpm.net/service/", { method: "POST", headers: { "Content-type": "application/json" diff --git a/site/app/twirl/twirl_compiler.py b/site/app/twirl/twirl_compiler.py index cc2ba3e..5a72e2d 100644 --- a/site/app/twirl/twirl_compiler.py +++ b/site/app/twirl/twirl_compiler.py @@ -64,7 +64,7 @@ def compile(app): with open(os.path.join(target_dir, "{}.css".format(app)), "w") as f: f.write(css_data) - links = [ + dups = [ [twirl_path, "twirl"], [os.path.join(twirl_path, "font"), "font"], [os.path.join(top_path, "udo"), "udo"], @@ -72,11 +72,18 @@ def compile(app): [os.path.join(app_path, "{}.csd".format(app)), "{}.csd".format(app)] ] - for l in links: + for l in dups: target = os.path.join(target_dir, l[1]) - if os.path.islink(target): + if os.path.islink(target) or os.path.isfile(target): os.unlink(target) - os.symlink(l[0], target) + elif os.path.isdir(target): + shutil.rmtree(target) + + if os.path.isfile(l[0]): + shutil.copy2(l[0], target) + elif os.path.isdir(l[0]): + shutil.copytree(l[0], target) + #os.symlink(l[0], target) copies = ["documentation.html", "developer_documentation.html"] for c in copies: diff --git a/site/app/twist/index.html b/site/app/twist/index.html index 4652991..c629b31 100644 --- a/site/app/twist/index.html +++ b/site/app/twist/index.html @@ -90,6 +90,8 @@ diff --git a/site/app/twist/twist.js b/site/app/twist/twist.js index a7a248c..515235c 100644 --- a/site/app/twist/twist.js +++ b/site/app/twist/twist.js @@ -108,7 +108,7 @@ var Twist = function() { }; } - twist.version = 1; + twist.version = 1.1; this.currentTransform = null; var errorState; var instanceIndex = 0; @@ -967,6 +967,34 @@ var Twist = function() { app.insertScore("twst_getbuffers", [0, 1, cbid]); }; + this.loadFileFromURL = async function(url, name, onComplete) { + if (!name) name = url.split("/").reverse()[0]; + await app.copyUrlToLocal(url, name); + var cbid = app.createCallback(async function(ndata){ + twirl.loading.hide(); + if (ndata.status > 0) { + if (waveformTabs.length == 0) { + self.createNewInstance(true); + instanceIndex = 0; + } + self.waveformTab.text(name); + await globalCallbackHandler(ndata); + waveformFiles[instanceIndex] = name; + waveformLoaded[instanceIndex] = true; + } else if (ndata.status == -1) { + twirl.prompt.show("File not valid"); + } else if (ndata.status == -2) { + twirl.prompt.show("File too large"); + } else { + twirl.prompt.show("File loading error"); + } + if (onComplete) { + onComplete(ndata); + } + }); + app.insertScore("twst_loadfile", [0, 1, name]); + }; + this.loadFileFromClipboard = function() { if (!twist.hasClipboard) { return twirl.prompt.show("Cannot create: clipboard is empty"); diff --git a/site/app/twist/twist_ui.js b/site/app/twist/twist_ui.js index 08e5fe1..15e7b44 100644 --- a/site/app/twist/twist_ui.js +++ b/site/app/twist/twist_ui.js @@ -143,6 +143,9 @@ var twistTopMenuData = [ {name: "Help", click: function(twist){ $("#twist_documentation")[0].click(); }}, + {name: "Walkthrough video", click: function(twist){ + $("#twist_video")[0].click(); + }}, {name: "Developer reference", click: function(twist){ $("#twist_developer_documentation")[0].click(); }}, @@ -155,6 +158,9 @@ var twistTopMenuData = [ {name: "Submit transform code", click: function(twist){ $("#twist_developer_submit")[0].click(); }}, + {name: "Source code", click: function(twist){ + $("#twist_sourcecode")[0].click(); + }}, {name: "About", click: function(twist) { twist.ui.showAbout(); }}, @@ -474,6 +480,12 @@ var TwistUI = function(twist) { }); }; + this.globalFiles = function() { + //twirl.getSharedFiles(); + + //"/sounddb/" + path + }; + this.developerConsole = function() { $("#twist_developer").show(); $("#twist_inject_devcsound").click(async function() { diff --git a/site/service/config.pyc b/site/service/config.pyc deleted file mode 100644 index 4df456d..0000000 Binary files a/site/service/config.pyc and /dev/null differ diff --git a/site/service/db.pyc b/site/service/db.pyc deleted file mode 100644 index 81639ee..0000000 Binary files a/site/service/db.pyc and /dev/null differ diff --git a/site/udo/twist/transforms/generate.udo b/site/udo/twist/transforms/generate.udo index e7355a8..8ccdda9 100755 --- a/site/udo/twist/transforms/generate.udo +++ b/site/udo/twist/transforms/generate.udo @@ -60,7 +60,7 @@ opcode twst_tf_gensimpleadditive, a, kkkkkio endif aosc oscili (1 / iharmonics) * kgain, (kfreq * kmultiplier) if (index < iharmonics) then - arec twst_tf_gensimpleadditive, min:k(kfreq * kstepmult, sr / 2), kstepmult, kampprofile, iharmonics, index + 1 + arec twst_tf_gensimpleadditive kamp, kmultiplier, min:k(kfreq * kstepmult, sr / 2), kstepmult, kampprofile, iharmonics, index + 1 aosc += arec endif xout aosc * kamp @@ -93,7 +93,7 @@ opcode twst_tf_genfeedback, a, kkkk asig += (adel * kfeedback) asig butterbp asig, kfreq, kbw asig butterbp asig, kfreq, kbw - asig tanh ain + asig tanh asig asig *= kpostgain xout asig endop @@ -107,11 +107,11 @@ instr twst_tf_genfeedback kpostgain = twst_param:k("postgain") kbw = twst_param:k("bandwidth") if (ileft == 1) then - aL twst_tf_genfeedback kfeedback, kfreq, kpostgain + aL twst_tf_genfeedback kfeedback, kfreq, kpostgain, kbw aL *= kamp endif if (iright == 1) then - aR twst_tf_genfeedback kfeedback, kfreq, kpostgain + aR twst_tf_genfeedback kfeedback, kfreq, kpostgain, kbw aR *= kamp endif outs aL, aR -- cgit v1.2.3