Code Monkey home page Code Monkey logo

facet's Introduction

facet's People

Contributors

kindohm avatar nnirror avatar nthitz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

facet's Issues

Horrible noisy crash :)

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?

source of truth for current BPM / steps

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

Windows / Linux friendly getCpuUsage

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

Feature: pan() method

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.

method for stopping a single command

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();?

sfplay~: can't find file airhd:/Users/jsimon/Dropbox/github_repositories/facet/tmp/s

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

add several samples to repo

just so they can be referenced in documentation without the user needing to download or move samples into the directory themselves

Samples from subdirectory?

I have subdirectory of samples called fhitz02. Why does this not work:

$('dir').randsamp('../samples/fhitz02/').play();

Requirement for Max? Standalone? Linux?

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?

how to best handle commands that have errors in them

Initially 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.

Example throws error

$('example').iter(16,()=>{this.append(_.randsamp().speed(0.1))}).play();
// error 'TypeError: cannot read property 'speed' of undefined'

percent cpu calculation "cannot read property 'trim' of undefined"

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());

image

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.

add documentation for MIDI setup

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 :)

Safari compatibility

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

Feature: user-set variables / system-level variables improvements

  • When a user sets a variable via .set(), remove any previously-set variables with same name.
  • Separate into two separate files the "user-set" variables (which can potentially be expensive, containing multiple seconds of audio) from the system-level variables (which should be updated very frequently, e.g. every ~20ms): 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 ) {
  • make sure all places that env.js is loaded now load both files

feature: editor compatibility for safari

  • some commands do not work properly. For example, [ctrl+enter] causes the selected line(s) of code to be deleted.
  • will need to approach AudioContext differently as Safari uses a different object for that and there are currently errors in the console.

Ubuntu problem

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!)

Another TypeError message

This works:

$('rnd').randsamp().play(_.noise(4));

but every few seconds says 'TypeError: cannot read property 'play' of undefined'

error loading custom samples

Copied some of my own samples in, and received this error when loading one by name:

new $('x').sample('by2 - Marker #1.wav');

image

I'm guessing that Facet requires a specific sample rate; I haven't tried to confirm this yet.

Compatibility errors with recent Node.js versions

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 :)

[deferlow] in facet_server works only with "Scheduler in Overdrive" mode in audio settings

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.

error when using speed function

I receive this error whenever using the speed function in my facet code:

new $('x')
 	.noise(50)
	.times(_.sine(1,128))
  	.speed(-3);

error: input must be a FacetPattern object; type found: number, command: new $('x') .noise(50) .times(_.sine(1,128)) .speed(-3);

image

configurable fade on sine() and other oscillator methods

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

Remove filter ringing artifacts present in first ~second of filtered audio

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.

Invert speed controls

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.

TypeError: fs.rmSync is not a function

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)

feature: "bouncing ball" effect

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.