gogins / cloud-5 Goto Github PK
View Code? Open in Web Editor NEWComplete browser-based computer music studio for algorithmic composition and live coding
License: Other
Complete browser-based computer music studio for algorithmic composition and live coding
License: Other
strudel
with a fresh checkout of cloud-music/strudel
. No difference.cloud-music/strudel
after patching. Nothing unexpected after pre-build patch.michaelgogins@Michaels-MBP ~/temp % find . -name "canvas.node" -ls
73342649 976 -rwxr-xr-x 3 michaelgogins staff 496744 Sep 7 19:55 ./strudel/node_modules/.pnpm/[email protected]/node_modules/canvas/build/Release/canvas.node
74410627 976 -rwxr-xr-x 1 michaelgogins staff 496984 Sep 13 10:43 ./cloud-music/strudel/website/node_modules/.pnpm/[email protected]/node_modules/canvas/build/Release/canvas.node
74449643 976 -rwxr-xr-x 1 michaelgogins staff 496840 Sep 13 10:46 ./cloud-music/strudel/node_modules/.pnpm/[email protected]/node_modules/canvas/build/Release/canvas.node
git bisect
in cloud-music/strudel. Didn't seem to do anything, but when I was done, it was working again.CsoundAC is designed to generate scores recursively outside of time, that is, transformations can move both forwards and backwards in time. The score must therefore be generated before it can be rendered.
This enhancement will enable CsoundAC to generate scores during rendering, normally in real time, thus enabling the composition of "always-on" or indefinitely playing pieces.
CsoundAC needs to support both terminating but repeating processes or cycles (as in Tidal Cycles and Strudel), and non-terminating processes (as used in my current cloud-music pieces). Ideally such cycles can be nested. Non-terminating processes can be implemented as cycles with an infinite duration.
I do not need any sort of live coding environment. Therefore, the new part of CsoundAC that will schedule and functionally compose cycles can probably be much simpler than the corresponding parts of Strudel. In fact, I should take care to make the scheduler as simple as possible.
In addition, the scheduler does not need (I think) to manage control channels, but only notes, thus the granularity of scheduling is the cycle duration. This can of course change from cycle to cycle. And there is a complicating case, where an indefinite process lasts much longer than any cycle. This case can be handled easily with a finite cycle that repeats an indefinite number of times, and whose generating process is not interrupted by the end of its cycle.
The SimpleWebServer app from the Play store will indeed run a local Web server than can also be accessed by Chrome running on the Chromebook. The Strudel REPL in cloud-5 runs just fine in this environment. Currently csound_loader.js
flunks on Chromebooks because operating_system
is unknown, but this is probably fixable.
https://github.com/google/swissgl
This might simplify running shader code in cloud-5.
This is what I have been missing. See https://web.dev/articles/custom-elements-best-practices.
<cloud5-score-generator>
<cloud5-visuals-to-notes>
<cloud5-notes-to-visuals>
<cloud5-strudel>
<cloud5-log>
<cloud5-about>
<cloud5-controls>
and finally:
<cloud5-infrastructure>
This makes the most sense if custom elements can properly extend other custom elements. In that case, there can be a JavaScript library that defines the base custom elements, and then the user will extend those base custom elements. I'm not doing this.
Alternatively, and perhaps more simply, the custom elements can simply accept hooks. That's what I'm doing.
To dos:
<csound5-piece>
.<cloud5-shadertoy>
custom element for adapting shaders from ShaderToy..bind(this)
, for all callbacks, etc.cloud-5.css
.cloud-5.js
into the automatically generated documentation. I can do that, but it works very poorly, doesn't pick up class properties, doesn't combine different files well, etc. So I'm putting this off.https://github.com/dbkaplun/driftless/blob/master/README.md
I think that Strudel uses this general idea.
Comment out pieces that don't bear repeated listening.
csoundn
to csoundm
.csoundn
to csoundm
.csoundn
to csoundm
.csound-ac
(a dependency of csound-wasm
).csound-wasm
.Currently the CsoundAC patterns work on "note" values in all Patterns, but the question arises: should they only work the Note Pattern, i.e. when onTrigger
is called? In that case, would the functions still compose?
The current implementation works, but is not always intuitive. That's why notes on the piano roll (which are only triggered notes) sometimes start jumping around when CsoundAC Patterns are applied.
I think I have to create a whole new set of functions to test this. Or maybe both sets should be implemented.
csoundac.mjs
and improve comments.I still have not got the stateful patterns correct. In http://localhost:8000/csoundac_example_03_acCT.html if the output is piano the music sounds correct, but the pianoroll is flattened and jumping. If the output is csoundn, the pianoroll shows up, but it only shows the haps from Logistic, and that is what csoundn plays, ignoring all the chord stuff that sounded like it was working with piano.
There are several versions of this utility... too many. The problem is here:
/**
* There is an issue on Android in that csound may be undefined when the page is
* first rendered, and be defined only when the user plays the piece.
*/
var load_csound = async function(csound_message_callback_) {
let operating_system = get_operating_system();
if (operating_system === "Android" && typeof csound === 'undefined') {
csound_message_callback("Operating system is Android, but Csound is not yet defined.\n");
// On Android, Csound uses only stdout for messages; this becomes
// console.log, so we assign our "csound message callback" to
// console.log.
return;
}
I've made a variant, csoundloader.js
, that omits this case, and should just proceed to load the WebAssembly build of Csound.
The objective is to build a zip file that contains the complete cloud-5 directory, and release that in this repository.
dist
to cloud-5
.make zip
script to package.json
.This might apply to ChordPatterns, ScalePatterns, and PitvPatterns.
The current chord would be assigned to a prior chord before undergoing a transformation.
Then, in the *Patterns class, there could be e.g. an option to derive a voiced chord as the closest voiceleading from the prior chord. For example, in addition to ChordPatterns.acT
there would be a ChordPatterns.acTL
. Or, there could be a flag to control this.
It might be that all the stateful patterns classes would have both a voiced and an unvoiced chord (and a voiced and an unvoiced prior chord) to facilitate this.
This would complete the project of getting the most important parts of the CsoundAC chord spaces and scales code working in the Strudel context.
Refactor and improve the cloud-music repository so that it can serve as my primary computer music playpen. Pros:
Cons:
Questions:
fs
module, but cloud-music is completely on the browser side. Possibly it can be done using the Emscripten filesystem APIs and an IndexedDB. I will look at the canonical Csound's WASM build for clues. Looks complex, don't want to write it or maintain it. Should be able to use a screen recorder extension for the browser.Tasks:
dist
as docs
to GitHub.It seems import("./MyModule.mjs")
works if "./" coincides with the Web server root; otherwise, not. For my GitHub pages, the Web server root is "gogins.github.io/". This is a serious problem.
This would make using a cloud-music repository as an actual computer music studio much more attractive.
Standard minimalist techniques of musical composition can be factored into classes or functions. I have done some of this before. Maybe I can use what I did, maybe I can add to it, or I may need to re-implement this.
piano
is in sync with csoundn
when different outputs are stacked, but piano
does not show up in pianoroll
. I think this is caused by how I color the notes, they sound correct.
I'm using the full kit here, pieces in HTML5 with other languages embedded, possibly including Strudel. The objective is to make all new pieces using a recent older piece as a template, regardless of the target platform, i.e. browser vs. NW.js, with as many resources as make sense already embedded in the piece.
I will create several templates by updating the best pieces, all in the cloud-5/public
directory:
Poustinia-v5e.html
, generates a score using CsoundAC and both plays and renders it using native plugins, with a piano roll score. Runs only in NW.js.cloud_music_no_1.html
, generates an animated visual using GLSL, samples it, and plays it using pure HTML. Runs both in browsers and in NW.js.
cloud_music_no_9.html
, runs a Strudel patch that can be live coded, with an accompanying GLSL music visualization. Runs both in browsers and in NW.js.
I shouldn't go crazy here.
I think the problem is that Haps from generative patterns that go to a default output are flat and jumping.
When this is working I may put it in a pull request to Strudel.
The idea is to simplify writing custom Patterns with arbitrary callables that deal only with primitive JavaScript types.
Inputs and outputs should include controls as well as pitch. Time should be available in the interface as linear time from the beginning of the performance, linear time from the beginning of the cycle, and time as a fraction of the cycle.
The underlying motivation is to use cloud-music and therefore Strudel as a platform for compositions using CsoundAC and /or that depend upon computational irreducibiity.
The licenses used in cloud-music may may or may not be compatible.
My patches and Roos' patches are compatible.
Useful with Chords, Scales, and PITV. Should take a Chord as a stateful parameter, and as a Pattern, emit a stack
of the notes
comprising the chord.
Everything is peachy keen and I have solved some problems that I thought would stop my show.
However, I don't always see my pieces on gogins.github.io unless I manually clear the browser cache and/or application memory from the developer console. This applies to the REPL iframe as well.
I need to:
Shader program uniforms are not defined...
This is research on resources to stimulate thinking for new pieces.
Put diagnostic messages in cloud-5 that will prove or disprove the correctness of scheduling in Strudel-based pieces. These will be marked sync
so that the console can be filtered to show only these messages. Each trigger will increment and print a counter. Some of this already exists, but they need to be put in for all triggers, and to be in a uniform format.
For reasons yet unknown, acPVVV
does not seem affected by add
, so I added a patternifiable bass
parameter and then it works.
Recent updates (CsoundAC? csound-wasm? Strudel?) have broken cloud-5.
I'm trying to see if one of my patches to cloud-5 is the problem:
michaelgogins@Michaels-MacBook-Pro ~/cloud-5 % code --diff strudel/packages/webaudio/webaudio.mjs ../cloud-5.save/strudel/packages/webaudio/webaudio.mjs
// Duplicates of declaration/initialization here:
michaelgogins@Michaels-MacBook-Pro ~/cloud-5 % code --diff strudel/packages/core/cyclist.mjs ../cloud-5.save/strudel/packages/core/cyclist.mjs
michaelgogins@Michaels-MacBook-Pro ~/cloud-5 % code --diff strudel/packages/core/pianoroll.mjs ../cloud-5.save/strudel/packages/core/pianoroll.mjs
michaelgogins@Michaels-MacBook-Pro ~/cloud-5 % code --diff strudel/packages/core/pattern.mjs ../cloud-5.save/strudel/packages/core/pattern.mjs
michaelgogins@Michaels-MacBook-Pro ~/cloud-5 % code --diff strudel/website/astro.config.mjs ../cloud-5.save/strudel/website/astro.config.mjs
michaelgogins@Michaels-MacBook-Pro ~/cloud-5 % code --diff strudel/packages/superdough/sampler.mjs ../cloud-5.save/strudel/packages/superdough/sampler.mjs
michaelgogins@Michaels-MacBook-Pro ~/cloud-5 % code --diff strudel/packages/csound/index.mjs ../cloud-5.save/strudel/packages/csound/index.mjs
michaelgogins@Michaels-MacBook-Pro ~/cloud-5 % code --diff cloud-5/strudel_repl.html ../cloud-5.save/cloud-5/strudel_repl.html
I fixed the patch to cyclist.mjs
, does that help?
Bring Strudel back into cloud-music, but only as a Web resource, not as a submodule or a branch of Strudel. If possible. And it should be loaded from the Web server filesystem, not from a remote URL.
csoundn
Pattern to work from user code, or else patch csound/index.mjs
with my code. The csoundn
pattern is now registered in csoundac.mjs
.csoundac.mjs
to use stateful Patterns. Added eOP
and O
for octavewise revoicing.csound
with a minimal working example. This has been fixed by Roos.StatefulPatterns
class with a minimal working example in the discussion about state. Not doing this, as I can't actually get it to work.pianoroll
not working with this stuff with a minimal working example. Felix Roos explained this, I don't think this is easily solvable. It arises from the unpredictability of mixing the stateless chain of queries with stateful objects.I checked out the Mercury Playground, it does not seem as capable as either Strudel or cloud-5.
The total-serialism code itself contains much duplication of what already exists elsewhere, but it looks well-written.
In particular "algorithmic methods" has stuff that I don't have and that looks useful.
God save me from re-inventing every wheel that rolls along.
The objective is to have a directory containing all of cloud-music that can simply be run from a thumb drive (or copied somewhere) and run in place, similar to a Flatpak installation in Linux. The package would be virtually the same as the current cloud-music dist
directory, but with different pieces and an index.html
page.
On a thumb drive, the computer music studio is pocketable and can be plugged into anything from a phone to a desktop workstation. Work becomes completely portable.
The actual plan now: rename cloud-music to cloud-5, take out all pieces that are not examples, and do all new compositions in gogins.github.io (the online cloud-music).
pianoroll
, but that's a separate issue.index.html
that doesn't interfere with the cloud-music Web site, and is about how to use the thing.minimal.http
and cloud_music_no_1.http
examples play, but `message.html1 does not, and there is an issue with the Csound loader on Android.Further testing will be done by trying to write a real composition.
Switch to using the regular or "canonical" build of Csound for WebAssembly from the Csound repository. This can be done by just loading the file from a server, or from the Web server's public HTML filesystem (which is what I need, for stability).
See https://kunstmusik.github.io/icsc2022-csound-web/ and https://vlazzarini.github.io/vanilla/. The latter is more useful as it assumes less.
To load as an ECMAScript module:
<script type="module">
import csoundbrowser from 'https://cdn.jsdelivr.net/npm/@csound/[email protected]/+esm'
</script>
I don't know where the bug is. The "i" statements that go to Csound.InputMessage
are correct, and they produce the intended result. But, when the invoked instrument instance runs, it only prints 0 for p1 and therefore nstrstr
returns an empty string.
I suspect the problem is caused by routing a string to p6 with Strudel controls encoded as text. I will back that out and see if that helps. Yes, that fixed it so that's the cause.
Get this thing off the ground:
<script>
elements and commenting them. Actually, not doing this due to the mixture of languages (HTML, JavaScript, WebGL/GLSL, Csound. I simply put in a comment.Not sure if this is possible, but it sure would be great to have.
Add a pnpm run deploy
option in package.json
that will:
_astro
directory and contents from cloud-music.assets
directory.cloud-5/cloud-5/*
to the cloud-music root directory.to
cloud-5.html` in cloud-music.CLOUD-MUSIC.md
file in cloud-music to README.md
.fout
.fout
will be automatically downloaded to the user's computer, and recording to the fout
file will pause.With repeated starts and stops, the output soundfile will grow, but will not usually be as long as the actual performance.
See:
I'm not sure I need all this. After all the soundfile already exists in MEMFS and I know its filepath.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.