nnirror / facet Goto Github PK
View Code? Open in Web Editor NEWLive coding and synthesis with NodeJS and a browser
License: GNU General Public License v3.0
Live coding and synthesis with NodeJS and a browser
License: GNU General Public License v3.0
just so they can be referenced in documentation without the user needing to download or move samples into the directory themselves
Could be implemented following this, though I'm not sure how useful it would be. Pasting here as a reminder after briefly looking into it
Currently speed(2)
means twice as slow and speed(0.5)
means twice as fast. It might be more intuitive for users if these were switched, so smaller than 1 means slower.
The .speed()
method is used in several places in the FacetPattern.js
class, so need to make sure I test all those and make sure the related methods are working properly.
Input to the pan() method should be a float, array, or FacetPattern. clip the input between 0 and 1 and use for channel 0. Determine how many channels specified in this.dacs are set to 1. Loop through that many times and slowly interpolate from the original panning FP to the inverse, AM-ing the data. In a separate loop afterwards, for all this.dacs set to 0, AM the data by 0.
Save all files in tmp as ${name}-pan${channelnum}
If multiple panning FPs are supplied, there needs to be an extra loop that superposes those.
If the array of multiple panning FPs is larger than number of channels, first reduce the panning FPs to match.
If the array of multiple panning FPs is less than number of channels - e.g., two panning FPs on 8 channels - by default it should wrap, so it would go LRLRLRLR. but there should be another argument to the pan method that could make it go LLLLRRRR.
$('example').iter(16,()=>{this.append(_.randsamp().speed(0.1))}).play();
// error 'TypeError: cannot read property 'speed' of undefined'
There are two ways to set BPM and steps, and no (necessarily) conclusive way to know what BPM the transport is running. This metadata should be visible to the user somehow
Just followed instructions and installed: mostly seems to be working, but…
When I do '$('test').sine(100).play();' I can see temporary files being created in the /tmp/ directory, but Max seems to be looking in a subdirectory tmp/s/. Any ideas what's wrong here?
sfplay~: can't find file airhd:/Users/jsimon/Dropbox/github_repositories/facet/tmp/s
is the error from max
This looks like maybe a cleanup script failing when I do ctrl-c in the terminal?
^C/home/jsimon/Documents/GitHub/facet/js/facet_server.js:39
fs.readdirSync('tmp/').forEach(f => fs.rmSync(`tmp/${f}`));
^
TypeError: fs.rmSync is not a function
at /home/jsimon/Documents/GitHub/facet/js/facet_server.js:39:44
at Array.forEach (<anonymous>)
at Object.cleanUp (/home/jsimon/Documents/GitHub/facet/js/facet_server.js:39:28)
at process.<anonymous> (/home/jsimon/Documents/GitHub/facet/js/facet_server.js:162:18)
at process.emit (events.js:314:20)
This makes a horrible noise and becomes unresponsive after about thirty seconds:
$('rnd').randsamp().play(_.noise(4));
$('example').noise(1000).size(44100).play(_.noise(4));
Also: is there a command I can issue in the terminal to quit facet in npm rather than just closing the terminal?
not quite right given new structure, I've noticed some js/env.js diffs showing up in my git local and this will need to be fixed :)
the trick will be implementing with slices()
, iter()
, sometimes()
, etc.
running commands via [ctrl + enter] deletes the line rather than running. [ctrl + r] works so might just be a matter of browser-dependent event handling
The filter's impulse response is creating audible artifacts as it settles into steady-state behavior. I think it should be possible to prevent this by appending a second of silence in front of the audio prior to filtering, then removing the silence after processing. But it might be tricky to implement correctly because filters can have FacetPatterns as arguments, which are matched to the input data size, etc.
The current saveas()
implementation is written in a way that expects subdirectories to be specified with backslashes: "/".
This works:
$('rnd').randsamp().play(_.noise(4));
but every few seconds says 'TypeError: cannot read property 'play' of undefined'
Hey! I was trying to run facet but i get an issue on Ubuntu 22.04 when i run -> npm run facet after npm install.
the error that i get is the following:
TypeError: Cannot set property navigator of # which has only a getter
at Object. (/home/esquilo/Storage/Programs/facet/node_modules/webmidi/dist/cjs/webmidi.cjs.min.js:445:4390)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object. (/home/esquilo/Storage/Programs/facet/js/transport.js:4:19)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
Node.js v21.1.0
Any help on making this run would be appreciated!
Thanks :)
Implement the well-known "bouncing ball" type of descending stutter/echo.
Parameters could be: total delay time, number of repeats, "gravity" (rate of descension, positive or negative), pitch.
Sometimes the facet server wasn't starting and I tracked it down to an error on this line:
let percent_cpu = Number(stdout.split('\n')[1].trim());
While debugging, I found stdout
to be an empty string. Should probably guard against this.
I got around it by just setting the percent_cpu
variable to a phony constant string.
Encountered this on Windows 10 and Max 8.2.2.
.set()
, remove any previously-set variables with same name.env.js
and patterns.js
.patterns.js
would update as part of the callback in pattern_generator:js:run()
, when this condition is true: if ( fp.variables_to_set.length > 0 ) {
env.js
is loaded now load both filesInitially I had made it so failed commands would be reattempted, making it possible for commands that reference a variable to be executed in the same keystroke as the variable it depends on.
But it feels a bit clumsy as errors can start to pile up - especially if the error comes LATE in the command. It does a whole bunch of processing, then hits the error and retries indefinitely, eating up CPU. It would be better to preserve CPU and enforce that any variables be set in a separate command.
currently it feels a bit untrustworthy.. I can be sure it works by running stop, clearing, re-running stop, etc. but UX and reliability is not at 100%, as far as I can tell
certain oscillators (e.g. sine, tri) have a built-in 30ms fade at the end and beginning, which is good for absolutely preventing clicks but bad for LFOs and other processes that expect an exact sine wave. so there should be a mode to switch between these two possibilities
I have subdirectory of samples called fhitz02. Why does this not work:
$('dir').randsamp('../samples/fhitz02/').play();
Is it possible to do audio on mac os using the free Max standalone, or do you need the full paid programme? Also, presumably audio on Linux is not possible, no Max. Any scope for a different audio solution that does not require Max? Pd?
The easymidi package requires node v14. Newer versions of Node won't work with that package, which means the Facet server won't start properly.
currently it refocuses to the top of the editor window
Not an issue exactly, but had a go at installing on UbuntuStudio. Got as far as this, then lots of error messages about 'refused connections', truncated below:
jsimon@jsair:~/Documents/GitHub/facet$ npm run facet
> [email protected] facet
> node js/facet_server.js & node js/transport.js
(node:24037) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:1123
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1138:16)
Any ideas? (Sorry, pretty much a linux newbie here!)
Hello. Thanks for making this excellent project!
I tried some examples and, at first, it did not work with empty error messages from dict.unpack
. It seemed like the object failed to refer to dictionaries from specified ids.
Later I noticed that, removing [deferlow]
object in facet_server.maxpat between [node.script]
and [send facet_data]
resolved this error, and also, If I run Max with "Scheduler in Overdrive" mode in audio settings, it worked with [deferlow]
.
When "Scheduler in Overdrive" is turned off, all event scheduling happens in the main thread, in contrast to an independent thread launches for scheduling in SiO mode, so maybe, dict
messages sent to[deferlow]
object are dropped when not in SiO though I'm not sure.
As long as I tried, defer
object instead of deferlow
worked with both modes.
If left running with a closed laptop lid, when you reopen the laptop, the server seems to try to "catch up" and runs the transport way too fast. Instead the transport should be paused or potentially even the process exited when this happens.
I suspect this might be a bottleneck on the client side CPU since it has to load the entire data in plaintext via HTTP instead of loading the wav file from disk.
Some folks might need to set up MIDI drivers on their machine before they can pipe Facet into a DAW. I should add steps to the documentation :)
Via a suggestion in the TOPLAP discord:
Is there a way to silence a single pattern, instead of ctrl-period everything? Like, I don't know, $('a').randsamp().stop();?
Right now this feature is only working on MacOS, just needs platform detection prior to the exec'd command and maybe some additional logic but should (hopefully???!) be possible
ctrl-c conflicts with copy! eg to copy code elsewhere to work on later?
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.