{"id":13530600,"url":"https://github.com/mildsunrise/simplejack","last_synced_at":"2025-04-01T18:32:01.154Z","repository":{"id":22048543,"uuid":"25377209","full_name":"mildsunrise/simplejack","owner":"mildsunrise","description":"Simple, realtime JACK audio in Node.JS","archived":false,"fork":false,"pushed_at":"2014-10-20T15:58:50.000Z","size":128,"stargazers_count":13,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-29T16:18:57.521Z","etag":null,"topics":["audio","jack","nodejs","real-time"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mildsunrise.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-17T21:07:42.000Z","updated_at":"2022-03-29T06:20:42.000Z","dependencies_parsed_at":"2022-08-18T23:40:13.939Z","dependency_job_id":null,"html_url":"https://github.com/mildsunrise/simplejack","commit_stats":null,"previous_names":["jmendeth/simplejack"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mildsunrise%2Fsimplejack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mildsunrise%2Fsimplejack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mildsunrise%2Fsimplejack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mildsunrise%2Fsimplejack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mildsunrise","download_url":"https://codeload.github.com/mildsunrise/simplejack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246691657,"owners_count":20818545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","jack","nodejs","real-time"],"created_at":"2024-08-01T07:00:52.341Z","updated_at":"2025-04-01T18:32:00.927Z","avatar_url":"https://github.com/mildsunrise.png","language":"C++","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# simplejack\n\n[JACK][] is a platform that enables sound applications to easily send and receive realtime sound from other applications or hardware.\n\nThis module enables you to register simple [JACK][] clients:\n\n~~~ js\n// Create the client\nvar simplejack = require(\"simplejack\");\nvar client = simplejack(\"my-client\");\n\n// Register audio callback\nclient.callback(function(t) {\n  return Math.sin(2*Math.PI * 440 * t);\n});\n\n// Start the client!\nclient.activate();\n~~~\n\nThis will create a JACK client named `my-client`, with 1 audio port that\noutputs a 440Hz tone. The `t` passed to the callback is the time in seconds since\nthe client was last activated, or the callback was last changed.\n\n\n## Install\n\nFirst make sure you have JACK v2 development files installed. On Debian/Ubuntu and\nderivatives, you can do it with:\n\n    sudo apt-get install libjack-jackd2-dev\n\nThen install the module as usual, e.g.\n\n    npm install simplejack\n\n\n## Options\n\nYou can pass an object to `simplejack()` in order to customize options:\n\n~~~ js\nvar client = simplejack({ name: \"foo\", forceName: true, ports: 2 });\n~~~\n\nThe available options (and their default values) are:\n\n~~~ js\n{\n  // Name of the client.\n  name: \"simplejack\",\n\n  // If enabled and a client with the same name exists, creation\n  // will fail. Otherwise a unique name will be created.\n  forceName: false,\n\n  // Outgoing audio ports. If this is an array of strings,\n  // the strigs are the names of the created ports.\n  // If an integer N is passed, then N ports will be\n  // created with names \"out-0\", \"out-1\", etc.\n  ports: 1,\n\n  // Mark the ports as \"terminal\", meaning the audio in these\n  // ports is \"original\" and not available on any other port.\n  // Synthesizers, hardware interfaces, etc. should set this flag.\n  terminal: false,\n\n  // Mark the ports as \"physical\", meaning these ports correspond\n  // to some kind of physical I/O connector.\n  physical: false,\n\n  // Explicitely connect to the server with that name.\n  // Otherwise JACK will try to guess or use \"default\".\n  server: null,\n\n  // If the server isn't started, fail instead of starting it.\n  noStartServer: null\n}\n~~~\n\n\n## Multiple ports\n\nIf you open more than one port, the second argument passed to the callback\nis the index of the port for which the sample is being produced.\n\nSo, to produce a 500Hz tone on the first port and white noise on the other, do:\n\n~~~ js\nvar client = simplejack({ ports: 2 });\n\nclient.callback(function(t, port) {\n  if (port === 0)\n    return Math.sin(2*Math.PI * 500 * t);\n  else\n    return 2 * Math.random() - 1;\n});\n~~~\n\n\n## Implementation \u0026 limitations\n\n**Disclaimer:** yes I know Node.JS is the worst platform to do realtime sound\nprocessing because there's a single event loop and blah, blah, blah...\n\nA buffer is kept (always with the correct size), on which samples are precalculated\nand saved. When the \"process\" callback gets called for the first time, zeros are\nreturned, and we queue UV to calculate the next samples by calling the JS callback\nand save them on the buffer.\n\nThe next time the \"process\" callback gets called the calculated samples on the buffer\nare simply copied to JACK's output buffer, and the next samples calculation is\nscheduled, and so on. If for some reason the samples aren't ready when the \"process\"\ncallback is called, zeros are returned instead.\n\nWhen the client is deactivated the buffer is zeroed. FIXME\n\nOne of the problems with JS is that there aren't fixed integers, it's all floating\npoint numbers. And I decided to pass time in seconds instead of sample number,\nwhich makes it worse. Consequence: you will loose a bit of precision in the time,\nand thus in the generated samples. I don't think it's noticeable though.\n\n\n\n[JACK]: http://jackaudio.org \"JACK Audio Connection Kit\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmildsunrise%2Fsimplejack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmildsunrise%2Fsimplejack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmildsunrise%2Fsimplejack/lists"}