commit 1b001e49ee9a76ec4165a5f547fa1073a2cb2d74 Author: Niten Date: Thu Dec 22 09:48:48 2022 -0800 initial checkin diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0036c1b --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +.DS_Store +.idea +*.log +tmp/ + +.cpcache/ +.nrepl-port +target/ +result +.clj-kondo +native/ diff --git a/deps.edn b/deps.edn new file mode 100644 index 0000000..367581a --- /dev/null +++ b/deps.edn @@ -0,0 +1,7 @@ +{ + :paths ["src"] + :deps { + org.clojure/clojure {:mvn/version "1.11.0"} + overtone/overtone {:mvn/version "0.10.6"} + } + } diff --git a/deps.nix b/deps.nix new file mode 100644 index 0000000..e217091 --- /dev/null +++ b/deps.nix @@ -0,0 +1,1138 @@ +# generated by clj2nix-1.1.0-rc +{ fetchMavenArtifact, fetchgit, lib }: + +let repos = [ + "https://repo1.maven.org/maven2/" + "https://repo.clojars.org/" ]; + + in rec { + makePaths = {extraClasspaths ? []}: + if (builtins.typeOf extraClasspaths != "list") + then builtins.throw "extraClasspaths must be of type 'list'!" + else (lib.concatMap (dep: + builtins.map (path: + if builtins.isString path then + path + else if builtins.hasAttr "jar" path then + path.jar + else if builtins.hasAttr "outPath" path then + path.outPath + else + path + ) + dep.paths) + packages) ++ extraClasspaths; + makeClasspaths = {extraClasspaths ? []}: + if (builtins.typeOf extraClasspaths != "list") + then builtins.throw "extraClasspaths must be of type 'list'!" + else builtins.concatStringsSep ":" (makePaths {inherit extraClasspaths;}); + packageSources = builtins.map (dep: dep.src) packages; + packages = [ + rec { + name = "javax.inject/javax.inject"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "javax.inject"; + groupId = "javax.inject"; + sha512 = "e126b7ccf3e42fd1984a0beef1004a7269a337c202e59e04e8e2af714280d2f2d8d2ba5e6f59481b8dcd34aaf35c966a688d0b48ec7e96f102c274dc0d3b381e"; + version = "1"; + + }; + paths = [ src ]; + } + + rec { + name = "data.json/org.clojure"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "data.json"; + groupId = "org.clojure"; + sha512 = "ce526bef01bedd31b772954d921a61832ae60af06121f29080853f7932326438b33d183240a9cffbe57e00dc3744700220753948da26b8973ee21c30e84227a6"; + version = "0.2.6"; + + }; + paths = [ src ]; + } + + rec { + name = "clojure/org.clojure"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "clojure"; + groupId = "org.clojure"; + sha512 = "efb87dfd347d2be6cb251d550e312d77797e35500b75ebe8e3fca824d16223803305ce89d4ae0349e5dff22a99c24b8719bf791f24685a12404bd56a44693010"; + version = "1.11.0"; + + }; + paths = [ src ]; + } + + rec { + name = "overtone/overtone"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "overtone"; + groupId = "overtone"; + sha512 = "5bb46e3f0e7babda362eb64784d054884c99697c77a92472e7368170402f4b5578da46dcae34fd56325ff258ccb42d2e92fa1992a6cd8c8772bfb6addebcd0cf"; + version = "0.10.6"; + + }; + paths = [ src ]; + } + + rec { + name = "scsynth-extras/overtone"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "scsynth-extras"; + groupId = "overtone"; + sha512 = "85c69a2824068c73fd10fca83b6b1150711dc540812c760d90b753d743de0c97ab2ff6ef9908a47fdf04b626a08e43967b4254ae3d27f74f48405513b2136561"; + version = "3.10.2"; + + }; + paths = [ src ]; + } + + rec { + name = "joda-time/joda-time"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "joda-time"; + groupId = "joda-time"; + sha512 = "8c2725ddbb779442ad9a8417b594fd0d8ee4b3bba568d4f5f58de345c5de16aacf0777ce7bf01e943cc054cb2fc97d2702e181e0ce22453cc4386cef325d4902"; + version = "2.8.1"; + + }; + paths = [ src ]; + } + + rec { + name = "commons-codec/commons-codec"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "commons-codec"; + groupId = "commons-codec"; + sha512 = "8edecc0faf38e8620460909d8191837f34e2bb2ce853677c486c5e79bb79e88d043c3aed69c11f1365c4884827052ee4e1c18ca56e38d1a5bc0ce15c57daeee3"; + version = "1.10"; + + }; + paths = [ src ]; + } + + rec { + name = "plexus-component-annotations/org.codehaus.plexus"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "plexus-component-annotations"; + groupId = "org.codehaus.plexus"; + sha512 = "e20aa9fdb3fda4126f55ef45c36362138c6554ede40fa266ff6b63fe1c3b4d699f9eb95793f26527e096ec7567874aa7af5fe84124815729fdb2d4abaa9ddea8"; + version = "1.7.1"; + + }; + paths = [ src ]; + } + + rec { + name = "commons-lang3/org.apache.commons"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "commons-lang3"; + groupId = "org.apache.commons"; + sha512 = "9e6ff20e891b6835d5926c90f237d55931e75723c8b88d6417926393e077e71013dab006372d34a6b5801e6ca3ce080a00f202cba700cab5aabfc17bbbdcab36"; + version = "3.5"; + + }; + paths = [ src ]; + } + + rec { + name = "aws-maven/org.springframework.build"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "aws-maven"; + groupId = "org.springframework.build"; + sha512 = "2f7699aec317c4d2d8d6487c8c229c2033dbeed69b2d931afcba9911a4922b9a06283ef4177ed1767dbfb617e2de7d86fbfd6b82358419ad107afec5fbe5454a"; + version = "5.0.0.RELEASE"; + + }; + paths = [ src ]; + } + + rec { + name = "core.specs.alpha/org.clojure"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "core.specs.alpha"; + groupId = "org.clojure"; + sha512 = "f521f95b362a47bb35f7c85528c34537f905fb3dd24f2284201e445635a0df701b35d8419d53c6507cc78d3717c1f83cda35ea4c82abd8943cd2ab3de3fcad70"; + version = "0.2.62"; + + }; + paths = [ src ]; + } + + rec { + name = "clj-native/clj-native"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "clj-native"; + groupId = "clj-native"; + sha512 = "064ce06550104988090074ee8e8fbe4e115f35912178fbeb73ed8407c7569dff85f323d565203ca6cc998ae26442ff8829b8407eb661af501aa8940b2f8b50bb"; + version = "0.9.5"; + + }; + paths = [ src ]; + } + + rec { + name = "jackson-databind/com.fasterxml.jackson.core"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "jackson-databind"; + groupId = "com.fasterxml.jackson.core"; + sha512 = "ad8ea57cb08ffdacee5dcc33db7506378c501fcd9544adf89d6eaaf0e52c541483c74592022de73d9367ad28eb315ba1bff792ffc67e06820c5c5d12a1365aa0"; + version = "2.6.7.1"; + + }; + paths = [ src ]; + } + + rec { + name = "spec.alpha/org.clojure"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "spec.alpha"; + groupId = "org.clojure"; + sha512 = "ddfe4fa84622abd8ac56e2aa565a56e6bdc0bf330f377ff3e269ddc241bb9dbcac332c13502dfd4c09c2c08fe24d8d2e8cf3d04a1bc819ca5657b4e41feaa7c2"; + version = "0.3.218"; + + }; + paths = [ src ]; + } + + rec { + name = "tools.cli/org.clojure"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "tools.cli"; + groupId = "org.clojure"; + sha512 = "926325e682e63095ae543d064fdd40ce85513780e65ec7c7b257e348693ef3498c845d6b7d8d61e251eec7667589ddba1f8c5097f429ce0a1e3dcd26b5706d31"; + version = "0.3.5"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-resolver-transport-wagon/org.apache.maven.resolver"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-resolver-transport-wagon"; + groupId = "org.apache.maven.resolver"; + sha512 = "f445e5c7de0ed02566d2ecf2b540599e4b58256cff84df1824911709dfa95a91c826655c74f2be7b9c70d7225a98e7042ed489bfd497cf5a262269f7e3e922e1"; + version = "1.1.1"; + + }; + paths = [ src ]; + } + + rec { + name = "jcl-over-slf4j/org.slf4j"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "jcl-over-slf4j"; + groupId = "org.slf4j"; + sha512 = "0a703864b269de6f7bc98df0fa98aa943cc327a4ca2915899d460e4a071fcc3fbe70957eb91b740cc935d0960b3d98f30c54a0a4019d7ae8c6d50f51edb8d149"; + version = "1.7.25"; + + }; + paths = [ src ]; + } + + rec { + name = "jsch.agentproxy.jsch/com.jcraft"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "jsch.agentproxy.jsch"; + groupId = "com.jcraft"; + sha512 = "07e028fc7e47da2012116933d796ac75908e84eb5a42d8147aa11aa66c0c91ddd509628b19ad6603c7ce118a05e8985329fa0dc0dad7661d09ec5b3c76333ee0"; + version = "0.0.9"; + + }; + paths = [ src ]; + } + + rec { + name = "wagon-provider-api/org.apache.maven.wagon"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "wagon-provider-api"; + groupId = "org.apache.maven.wagon"; + sha512 = "4571002ad5bfc0442bb2eaf32ec42675dc0a179413230615475842bba12fb561159ffc0213127cf241088641a218627e84049b715b9e71ed83d960f4f09da985"; + version = "3.0.0"; + + }; + paths = [ src ]; + } + + rec { + name = "jsch.agentproxy.sshagent/com.jcraft"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "jsch.agentproxy.sshagent"; + groupId = "com.jcraft"; + sha512 = "0898f33a1eae03ab3b0d78ad26076756ec0eec456e185b7d5057e003b33e0cb1b2ca57b8c4cdca48eae544daf36adcabd170138e5950b85ab8b64c97c094ba9d"; + version = "0.0.9"; + + }; + paths = [ src ]; + } + + rec { + name = "ableton-link/overtone"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "ableton-link"; + groupId = "overtone"; + sha512 = "be16d7bc895acf13cae0c47ca80f39fbce97d8c5a03bd9f72438b15a06524f0a04eb813bf631bb11bd53e8a37128b960edf00dd15f3c3f5630dd87b2986b4ada"; + version = "1.0.0-beta1"; + + }; + paths = [ src ]; + } + + rec { + name = "jackson-dataformat-cbor/com.fasterxml.jackson.dataformat"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "jackson-dataformat-cbor"; + groupId = "com.fasterxml.jackson.dataformat"; + sha512 = "d71d8a4e290231fdf99a0e5783809e6184406d8330c3bcdf6cd4f5061249bd9f0b28c06eeb76164c3cca7d9e2f6e8801fcaefe4010a585b00f93c6b51b38cd0d"; + version = "2.6.7"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-resolver-transport-http/org.apache.maven.resolver"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-resolver-transport-http"; + groupId = "org.apache.maven.resolver"; + sha512 = "0dcfc242d10c9114ac176b68a1be49addf3fc50306cff5ac469ab5d72e595d0706d70055a3a6295e5a2bbe9c6f3d2d4e5db42af0059ac5de2fcbd540b1eff8da"; + version = "1.1.1"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-model-builder/org.apache.maven"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-model-builder"; + groupId = "org.apache.maven"; + sha512 = "1597b38914e4b6c46cead8c7859eb409503ce5852b33e0ad604767782623a26e8e8bf346ff9f26a6ac843529b5184265922d1682fedb0b6d3e737a45b9fa4b90"; + version = "3.5.2"; + + }; + paths = [ src ]; + } + + rec { + name = "JavaEWAH/com.googlecode.javaewah"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "JavaEWAH"; + groupId = "com.googlecode.javaewah"; + sha512 = "fea689d1e29761ce90c860ee3650c4167ae9e5ecaa316247bdafac5833bce48d2b3e04e633b426e3ab7ef3a5c9c7fd150ffa0c21afdcae9c945cb2bb85f8a82f"; + version = "1.1.6"; + + }; + paths = [ src ]; + } + + rec { + name = "plexus-utils/org.codehaus.plexus"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "plexus-utils"; + groupId = "org.codehaus.plexus"; + sha512 = "3805c57b7297459c5e2754d0fd56abd454eee08691974fb930ebb9b79a529fd874f16d40cec66e7fd90d4146c9d1fef45cdb59f9e359fce0c48ac77526fc320d"; + version = "3.1.0"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-resolver-transport-file/org.apache.maven.resolver"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-resolver-transport-file"; + groupId = "org.apache.maven.resolver"; + sha512 = "abb8e769c1a541c8d73876d41725b9438e91f6e17d06c52ee1822d5bead7575679ec7a3a76e1f93e09d0acfd902af1bf47d279ed9af94aef60c7e736ab82de76"; + version = "1.1.1"; + + }; + paths = [ src ]; + } + + rec { + name = "org.eclipse.sisu.plexus/org.eclipse.sisu"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "org.eclipse.sisu.plexus"; + groupId = "org.eclipse.sisu"; + sha512 = "893a98877e760be8a8020e929aec36c5bfcbcbc08c83527e65e152f782da748cc6df3fa8fe74936e5fe30886bf9aa3096204c99cdc5f6229e9e2626be313b1c7"; + version = "0.3.3"; + + }; + paths = [ src ]; + } + + rec { + name = "jsch.agentproxy.usocket-jna/com.jcraft"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "jsch.agentproxy.usocket-jna"; + groupId = "com.jcraft"; + sha512 = "3213e63895552aa33858ece929c84c140ea95d6c3835c88e150cd37f266fb69b48b9ff9921132c808d1909ad0e97dd497a28a34d051a0a8c06c18b5a0d5f2850"; + version = "0.0.9"; + + }; + paths = [ src ]; + } + + rec { + name = "commons-io/commons-io"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "commons-io"; + groupId = "commons-io"; + sha512 = "1f6bfc215da9ae661dbabba80a0f29101a2d5e49c7d0c6ed760d1cafea005b7f0ff177b3b741e75b8e59804b0280fa453a76940b97e52b800ec03042f1692b07"; + version = "2.5"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-settings-builder/org.apache.maven"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-settings-builder"; + groupId = "org.apache.maven"; + sha512 = "3ced76df9e083bd9e929c6acceed3be4481d94dee0ccb9a506c90277d3973e987b4d73e91c6c664480d886d8b58f9098c66fcbe9d86ec8bf175df1064e2848a6"; + version = "3.5.2"; + + }; + paths = [ src ]; + } + + rec { + name = "org.eclipse.jgit/org.eclipse.jgit"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "org.eclipse.jgit"; + groupId = "org.eclipse.jgit"; + sha512 = "19ca3301391a4d4a6ca9c8ad2c936040497ee79b7c1e59c768636cf5d89f27329f808f8daaa74771bdedb877d694d9ae44dc8f94a932f4054d0c471efccf69d9"; + version = "4.10.0.201712302008-r"; + + }; + paths = [ src ]; + } + + rec { + name = "jackson-core/com.fasterxml.jackson.core"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "jackson-core"; + groupId = "com.fasterxml.jackson.core"; + sha512 = "3ab12004ef7e03bd649bd9f3fc345ce02c4fdbcf24a785800f6545696bf9a929107451a3ebd6ad2b1087bfe54069216e762fce21dab953ac01145e853b25d9ef"; + version = "2.6.7"; + + }; + paths = [ src ]; + } + + rec { + name = "scsynth/overtone"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "scsynth"; + groupId = "overtone"; + sha512 = "77ab9ae030e7755cb8164cf1806e76c0ee3d78c792590649200cbd993539fa0fb8e263ba79d5bf96ba28a9414c65f93f3acdb1a452e5995da08c5601fd167772"; + version = "3.10.2"; + + }; + paths = [ src ]; + } + + rec { + name = "cdi-api/javax.enterprise"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "cdi-api"; + groupId = "javax.enterprise"; + sha512 = "3e326196a2cbf19375803ce37d743a9818c4fa2292914439e748060d6889c997fe33077f52e52d4dd61b60e7342aa31b446d7571a92ec864f44cead45ebd612b"; + version = "1.0"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-settings/org.apache.maven"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-settings"; + groupId = "org.apache.maven"; + sha512 = "39d7dec72f792a08fd188d5ab7ba9e19853bf19dc9a38dd1ccd1ee0d28cdc122152d2722ff2078e8de0200d5f10408fd60147a270d66fa956989ae2fdf113855"; + version = "3.5.2"; + + }; + paths = [ src ]; + } + + rec { + name = "httpcore/org.apache.httpcomponents"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "httpcore"; + groupId = "org.apache.httpcomponents"; + sha512 = "37e1c2a24c2512120061477e104950a923961c9cb1cc7d96a82ddba7f64a7cc2afe38334bc82389f24aa1d4eca69440317be07a3be400980d205f150f742d324"; + version = "4.4.8"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-core/org.apache.maven"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-core"; + groupId = "org.apache.maven"; + sha512 = "adedc901581ccc24355f793ac0515daef79bd90450607672ac47df48d312bd9501036e164d71abba19af98dad5c662e007a2ff990c0f5f63cb525d3e8d1bd67d"; + version = "3.5.2"; + + }; + paths = [ src ]; + } + + rec { + name = "plexus-cipher/org.sonatype.plexus"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "plexus-cipher"; + groupId = "org.sonatype.plexus"; + sha512 = "deb948be3a9f6a2fa74adca17e54b1074948267b3a35dd4000d92c559d0387650770ccee096ad8f01dd51c36caf63878dc0bcf57dfb1f2e3e1a9d51204096617"; + version = "1.4"; + + }; + paths = [ src ]; + } + + rec { + name = "clj-glob/clj-glob"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "clj-glob"; + groupId = "clj-glob"; + sha512 = "3e1325482953582127e01cbd89274e7d8c58fc937194377023f0c82df6353062c55a5780c3b7faadab47cce7e82167c0b7ded90d46b16cb8ac4139b327b0dfd0"; + version = "1.0.0"; + + }; + paths = [ src ]; + } + + rec { + name = "jsch.agentproxy.pageant/com.jcraft"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "jsch.agentproxy.pageant"; + groupId = "com.jcraft"; + sha512 = "d141c49675f7f16ea4eacbf8c426764aa28bfacc598f07b72fd10228565000954e6fad5334ffa5e20b7f4400f2dd5641aa39e99b8e8dceaf12c9dfa39930074c"; + version = "0.0.9"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-resolver-api/org.apache.maven.resolver"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-resolver-api"; + groupId = "org.apache.maven.resolver"; + sha512 = "d00cd4ec92bfafe88d9c4f4ce91e6c2d581d416a096743d396c1712a5788239cf2d55f910e1c0024034f7e0d8028ff602339b87c8fd3ad54f665a8b63d142e67"; + version = "1.1.1"; + + }; + paths = [ src ]; + } + + rec { + name = "ion-java/software.amazon.ion"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "ion-java"; + groupId = "software.amazon.ion"; + sha512 = "6821a3fe0aa03a9a7421fa19e2dafea3f8af8162aeb7ee8c50735e5b1345a4adfe97822b166073b94d9aea01dc944f5558732348a448efdf350e29e160a7c38e"; + version = "1.0.2"; + + }; + paths = [ src ]; + } + + rec { + name = "jackson-annotations/com.fasterxml.jackson.core"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "jackson-annotations"; + groupId = "com.fasterxml.jackson.core"; + sha512 = "f3d8e800ccdc56d805068d6644fa3d4316a933e49caedef0918925330906c9097664dcb8c4150f3726ce37bae6b5dd459aa2a2cafbf5cf85bc67cdcb0d21c081"; + version = "2.6.0"; + + }; + paths = [ src ]; + } + + rec { + name = "jsr250-api/javax.annotation"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "jsr250-api"; + groupId = "javax.annotation"; + sha512 = "8b5dd24460e42763f3645205be4b4f80691e217d36bee5fc5b5df6ebc8782ed0f641fb9e2fe918a2d0eede32556656f6b61fe65d2cbec5086e61ef3d91e4d871"; + version = "1.0"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-resolver-provider/org.apache.maven"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-resolver-provider"; + groupId = "org.apache.maven"; + sha512 = "78d62f1ff65269046ab99f7db1350ea0d72d1469bfc51b0b95784998178e6ba74b1715998e0f865de5a5347eb5d5523ce447edeb6546e66e05835a380e43d3e6"; + version = "3.5.2"; + + }; + paths = [ src ]; + } + + rec { + name = "jmdns/javax.jmdns"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "jmdns"; + groupId = "javax.jmdns"; + sha512 = "103d284f0ff60316b07e0559b7b33f2b484cd851671da47be1b89a0ac91e94d848bb8bc4acb8e744246bace1e4171c0e8b1c87f4ea4722b1f282b32101c07849"; + version = "3.4.1"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-shared-utils/org.apache.maven.shared"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-shared-utils"; + groupId = "org.apache.maven.shared"; + sha512 = "e6de41cf0f1e76684d2cdc06276efb5c95d83ef054792635477ca0e429dcb8c3b0d4c25a9e2e7e417363052e79348c15df232983013828df916d63ce5e9f528d"; + version = "3.1.0"; + + }; + paths = [ src ]; + } + + rec { + name = "tools.deps.alpha/org.clojure"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "tools.deps.alpha"; + groupId = "org.clojure"; + sha512 = "595dae3dca3f9f105ded121326ad379edc6ef4d7e3a7dfabee016918a2a50e9f690b97898fdc2e92e4845b186c7391a7a285865b0e1a817a2f3fa187ec138d16"; + version = "0.6.496"; + + }; + paths = [ src ]; + } + + rec { + name = "commons-logging/commons-logging"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "commons-logging"; + groupId = "commons-logging"; + sha512 = "e5d1fc8ec4544e1fa0f7c4aae8dbcca466c4987bc92fbbc430b054b10d646b745add4a754b1be9d50edd64330c798c53173a97289db57a966312e16f934e9d1f"; + version = "1.1.3"; + + }; + paths = [ src ]; + } + + rec { + name = "guava/com.google.guava"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "guava"; + groupId = "com.google.guava"; + sha512 = "d8736b5151df2dd052c09548a118af15a8b8b40999954cd093cfd301445accb8b7e9532b36bac8b2fab9234a24e2e05009a33d0a8e149e841ebddbcc733a8e4c"; + version = "20.0"; + + }; + paths = [ src ]; + } + + rec { + name = "data.xml/org.clojure"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "data.xml"; + groupId = "org.clojure"; + sha512 = "db6edb16b486c500eede7c20bdbf5b83e52579ce5c4f251868acaa7c5594267eda9f1ef775f58b333fd7d4f8506595e58b4dee89df2de3e78a2ded16f01006e3"; + version = "0.2.0-alpha5"; + + }; + paths = [ src ]; + } + + rec { + name = "jmespath-java/com.amazonaws"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "jmespath-java"; + groupId = "com.amazonaws"; + sha512 = "2ac2dcab282ff19803f7a36645f11c791b535472af3c1406f2e6bacfdbe6561fd59dba89887b7fabb500ac388dc53ede87ef59164e12f437fbeb19399dacefbf"; + version = "1.11.184"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-resolver-spi/org.apache.maven.resolver"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-resolver-spi"; + groupId = "org.apache.maven.resolver"; + sha512 = "bb58083c5ef2b6d3915acb368c80bd55ca6318925c606ad74e3e4ab2fc0066c7fa2480cefa34487c5349f1edff02131bbaa4c3a426f9a52d5a6a66a4a023d452"; + version = "1.1.1"; + + }; + paths = [ src ]; + } + + rec { + name = "aws-java-sdk-core/com.amazonaws"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "aws-java-sdk-core"; + groupId = "com.amazonaws"; + sha512 = "289e6faa22498280e6c1190a0784b70176ec8352cdd263284b4f3525cd40cd6a2e965427cdc386518067592839a50ac7d7edcfba9b0adbdd4d19a0d0acb068a7"; + version = "1.11.184"; + + }; + paths = [ src ]; + } + + rec { + name = "slf4j-nop/org.slf4j"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "slf4j-nop"; + groupId = "org.slf4j"; + sha512 = "89f8559c281f6bcea4eb193c49aa8c960a5fe6762dca0198a7bb04b9d8a846ac52231f77ec16b2e9c0b48d0f6011517b641b5b93279b24eef65ee22e2c1167f3"; + version = "1.6.2"; + + }; + paths = [ src ]; + } + + rec { + name = "plexus-classworlds/org.codehaus.plexus"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "plexus-classworlds"; + groupId = "org.codehaus.plexus"; + sha512 = "5bbbce8880a8513ba1314c202005de96fe263b48f45d5cd6a3a3577fdfe7ccd88c2b908093eec237e6624f5dbba664dfb8aa82939cc540bb6652c0f4eea7b333"; + version = "2.5.2"; + + }; + paths = [ src ]; + } + + rec { + name = "s3-wagon-private/s3-wagon-private"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "s3-wagon-private"; + groupId = "s3-wagon-private"; + sha512 = "bcff754a72e78cc90d18ff3732653111c4e33c218d61797b05991163104e54c1809480c233559c73762cc6a1b730c5d7880f87d081f7b6ddf567322c9bc99f60"; + version = "1.3.1"; + + }; + paths = [ src ]; + } + + rec { + name = "plexus-sec-dispatcher/org.sonatype.plexus"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "plexus-sec-dispatcher"; + groupId = "org.sonatype.plexus"; + sha512 = "5b947edcb05a1c17648ec9fe53dd2c66b4a86dd2b950d989255f6edd636fd5d50d18b8f31b3a1736dadd9cff6790a3d0355f2ed896c3eb7f72e009199fe9957d"; + version = "1.4"; + + }; + paths = [ src ]; + } + + rec { + name = "plexus-interpolation/org.codehaus.plexus"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "plexus-interpolation"; + groupId = "org.codehaus.plexus"; + sha512 = "d9183dc0920fb996901644903194883d1e1d1e8c4863f3c55bd6a9b14de996ee30651849435a92c8c55fc82be0e4524f1b2741957f9464434da292188ffcee70"; + version = "1.24"; + + }; + paths = [ src ]; + } + + rec { + name = "httpclient/org.apache.httpcomponents"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "httpclient"; + groupId = "org.apache.httpcomponents"; + sha512 = "7cc512de404e69cfad43d7bb80c441ca83710c1a8c6d410de1ff29f4313d85f2489a1f621c20171417e88cdb0ddfde5f92e62ffc213a04987683fb2e8411c032"; + version = "4.5.4"; + + }; + paths = [ src ]; + } + + rec { + name = "jna/net.java.dev.jna"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "jna"; + groupId = "net.java.dev.jna"; + sha512 = "d38d124f5d2c227da57b0473bb37709a4d9f6fbcf5b6da3a6e15e2a90e5c2980d9dc649cdaeecb08b376dead73267128c1972d9e25ecc243424b8f6e6f4e67b3"; + version = "4.4.0"; + + }; + paths = [ src ]; + } + + rec { + name = "guice/com.google.inject"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "guice"; + groupId = "com.google.inject"; + sha512 = "9af46efaacfa911f4f337785ef75df2013eecc64af3842d10df97f453b84d0e7990d3e981c27f315184390355744f4b8857eb87b5a45e24549251da4c4d387d9"; + version = "4.0"; + classifier = "no_aop"; + }; + paths = [ src ]; + } + + rec { + name = "jsch.agentproxy.connector-factory/com.jcraft"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "jsch.agentproxy.connector-factory"; + groupId = "com.jcraft"; + sha512 = "b4268c6d91899ffb82d5854eaef7c2bf7db3e1e223446d6ca10ae5d88174f944994e2d098582b6dd9ac0e45feacb9e52dd58ea9e41f4ff9b2241cbc5226fa567"; + version = "0.0.9"; + + }; + paths = [ src ]; + } + + rec { + name = "jna-platform/net.java.dev.jna"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "jna-platform"; + groupId = "net.java.dev.jna"; + sha512 = "8ab09d04fd7e86b505f917e0a2b11d2c2e9f3a3e923a9fb94ad7e0bf6715f1923e02d8f3927f9580ab9f39f9fa213176013c3bcd977c2d1ef6461e2610571455"; + version = "4.1.0"; + + }; + paths = [ src ]; + } + + rec { + name = "tools.gitlibs/org.clojure"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "tools.gitlibs"; + groupId = "org.clojure"; + sha512 = "384e682c0b98fa77ec2cf3672a3b33346af19eafeff42f7af3d55a32225f7e261e16842cccc3c1d9c14ecf4559973f595e791e3c3be7b1eee9e082b8d1f016a7"; + version = "0.2.64"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-resolver-connector-basic/org.apache.maven.resolver"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-resolver-connector-basic"; + groupId = "org.apache.maven.resolver"; + sha512 = "1919682a60881c7dbc21a4c7a419c95e9a6eca86077c6c887d5a9c3585cc2311389228f0493d22967447969f7d773726141930fbc9f3e1ed3e05b67878f26a56"; + version = "1.1.1"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-resolver-impl/org.apache.maven.resolver"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-resolver-impl"; + groupId = "org.apache.maven.resolver"; + sha512 = "3ffcac7ed4a05b2b58669ce05cc348acad627be3e0941ee28a9a665fea43a571d554005dd72ec51130083f792e31894880525df3cd6962d7c95885340abfb7da"; + version = "1.1.1"; + + }; + paths = [ src ]; + } + + rec { + name = "slf4j-api/org.slf4j"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "slf4j-api"; + groupId = "org.slf4j"; + sha512 = "5dd6271fd5b34579d8e66271bab75c89baca8b2ebeaa9966de391284bd08f2d720083c6e0e1edda106ecf8a04e9a32116de6873f0f88c19c049c0fe27e5d820b"; + version = "1.7.25"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-model/org.apache.maven"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-model"; + groupId = "org.apache.maven"; + sha512 = "11466c597a4dfd8de650f7e987ca441dcca05bed28de2f6842fcf9d3ba76e899a279fbd39dabfe4e545d5b1286d1d02a35cdc9a8337c08589abcca1e5f69690f"; + version = "3.5.2"; + + }; + paths = [ src ]; + } + + rec { + name = "org.eclipse.sisu.inject/org.eclipse.sisu"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "org.eclipse.sisu.inject"; + groupId = "org.eclipse.sisu"; + sha512 = "cfedc8e9bae80492f2231dcf407abfde59b09f99154f5b5a225bc47c767df8bff7b929f6928e4f722cbb65d3a25327b3dd4dfc1e9e755dbe9e53ac6fd389dfb8"; + version = "0.3.3"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-resolver-util/org.apache.maven.resolver"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-resolver-util"; + groupId = "org.apache.maven.resolver"; + sha512 = "91dcbb8184f06e64da35d40c7b96e854f7311b6232d74b4b6d3489a51e0c05ebbee44f59367ab118974cdb6c5b3747981a41869cc7372691b2c2e1d0daa2ffa3"; + version = "1.1.1"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-repository-metadata/org.apache.maven"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-repository-metadata"; + groupId = "org.apache.maven"; + sha512 = "711dfd8199a04758e986835d1bb286d964ef27cd55287ee5991716e4ce010a8adc83fde2490803273c56a1f5eabf89a428503be04d5aa5c20d0540ff1c7bd296"; + version = "3.5.2"; + + }; + paths = [ src ]; + } + + rec { + name = "data.priority-map/org.clojure"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "data.priority-map"; + groupId = "org.clojure"; + sha512 = "b5515ea48030db8aeb24ffea08087c25c08cc72cee6bd5d4c261226c9f1063c4fadd7e442c50c1804ac84a7ac68ba63a74a40183213ec9bc1ace1209d1d0da9a"; + version = "0.0.9"; + + }; + paths = [ src ]; + } + + rec { + name = "aopalliance/aopalliance"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "aopalliance"; + groupId = "aopalliance"; + sha512 = "3f44a932d8c00cfeee2eb057bcd7c301a2d029063e0a916e1e20b3aec4877d19d67a2fd8aaf58fa2d5a00133d1602128a7f50912ffb6cabc7b0fdc7fbda3f8a1"; + version = "1.0"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-builder-support/org.apache.maven"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-builder-support"; + groupId = "org.apache.maven"; + sha512 = "28140f33ecf3a8d3e1413c8c97059a7b8f938f28f7c6795b6213d9de8b88347c4c85754adb70c0f74d80a58610fc9d843d1f49ffcf24af435b00fe1d461d9de9"; + version = "3.5.2"; + + }; + paths = [ src ]; + } + + rec { + name = "jsch/com.jcraft"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "jsch"; + groupId = "com.jcraft"; + sha512 = "97ec6de64f4870ee3c84f883bd3664562bfd600ca9f3364966e7dbee7e4e8520647c03f9f81d6808e330052ca1333e37f497d6252cd26fe721a90f573cbe2036"; + version = "0.1.54"; + + }; + paths = [ src ]; + } + + rec { + name = "jsch.agentproxy.core/com.jcraft"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "jsch.agentproxy.core"; + groupId = "com.jcraft"; + sha512 = "b397effe92c9a93012ece3eb7660aacce3cef1c07d2b176cfcb7f7d8d735d22ca0c968e76fb36cb2a311566ee4b23982126671bff9baf11b4786606f2a6a0c81"; + version = "0.0.9"; + + }; + paths = [ src ]; + } + + rec { + name = "jsch.agentproxy.usocket-nc/com.jcraft"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "jsch.agentproxy.usocket-nc"; + groupId = "com.jcraft"; + sha512 = "b1c67975955bc2ef240e05ecb4c82335f40b038ee4483190e346f633ca1b78de9bfb848a5bee803971acf6b7282b2343461a12615257b2fcb01e7e2c349fc084"; + version = "0.0.9"; + + }; + paths = [ src ]; + } + + rec { + name = "commons-net/commons-net"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "commons-net"; + groupId = "commons-net"; + sha512 = "dba414cea9fb4b47dfe6d20c347bd91052185dd958996bfdd1e709f66b5fa7812ebb0dad80c47e72bcc0075b3b5526c705216efe771cac1cc53b2f7923124faf"; + version = "3.6"; + + }; + paths = [ src ]; + } + + rec { + name = "aws-java-sdk-kms/com.amazonaws"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "aws-java-sdk-kms"; + groupId = "com.amazonaws"; + sha512 = "d73f3186d3ce1bbe9cd4db7ebb06a23366decf2ff383ff161bb9ca921b3c2085e83d591f4338bfee26f20953194ad375b4bd20c8f95f86b2ac0cea7067cec856"; + version = "1.11.184"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-plugin-api/org.apache.maven"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-plugin-api"; + groupId = "org.apache.maven"; + sha512 = "1449f2b31dcdefe61a89f1ce782e58fa09ab7dd0ee16af64a1ac916004a10a8d7330f6cfe1e8a3d5bce18afcf42354862cff982b7b7be80a27430aa662df27f2"; + version = "3.5.2"; + + }; + paths = [ src ]; + } + + rec { + name = "maven-artifact/org.apache.maven"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "maven-artifact"; + groupId = "org.apache.maven"; + sha512 = "15dbb653d2e115514ce92558599cbe7bbad43132c79b152021c1e04c4e51c62a5fbf1eb87ff200a0472d1ca5c806be36d1c755a03e338de8a9a1277e43981431"; + version = "3.5.2"; + + }; + paths = [ src ]; + } + + rec { + name = "data.codec/org.clojure"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "data.codec"; + groupId = "org.clojure"; + sha512 = "c324b62a5f14b2f17e49f1b0fffa3f44d195cb5261e03c5e472ba4f2972135f4b06fd321c0887717c727f025fc1a0121283d16fbf923d7469856702614a288f3"; + version = "0.1.0"; + + }; + paths = [ src ]; + } + + rec { + name = "aws-java-sdk-s3/com.amazonaws"; + src = fetchMavenArtifact { + inherit repos; + artifactId = "aws-java-sdk-s3"; + groupId = "com.amazonaws"; + sha512 = "7b5f96f2e6f8b10006423149e035b776a5082dbc75c3a87d7985bd58fc969b918ddd6a83183a12f467602b5625dec0d63b7c0de8be9de87bbf16c0298b0dc5d5"; + version = "1.11.184"; + + }; + paths = [ src ]; + } + + ]; + } + \ No newline at end of file diff --git a/src/tunes/core.clj b/src/tunes/core.clj new file mode 100644 index 0000000..308c0ba --- /dev/null +++ b/src/tunes/core.clj @@ -0,0 +1,337 @@ +(ns tunes.core + (:require [overtone.core :as o :refer [connect-external-server]])) + +(defn -main [& args] + (println (str "called with: " args))) + +(defn initialize + ([] (initialize "127.0.0.1" 30300)) + ([port] (initialize "127.0.0.1" port)) + ([ip port] (do (connect-external-server ip port) + (require '[tunes.live :as live])))) + +(o/definst tone [freq 440] (o/sin-osc freq)) + +(o/definst beep [freq 440 duration 1] + (let [env (o/line 1 0 duration :action o/FREE)] + (* env (o/sin-osc freq)))) + +#_(o/demo (beep 256)) +#_(o/stop) + +(o/definst bell [freq 440 duration 5 + h0 1 h1 0.6 h2 0.4 h3 0.25 h4 0.2 h5 0.15] + (let [harmonic-series [ 1 2 3 4.15 5.3 6.6 ] + proportions [ h0 h1 h2 h3 h4 h5 ] + component (fn [harmonic proportion] + (* 1/2 + proportion + (o/env-gen (o/perc 0.01 (* proportion duration))) + (o/sin-osc (* harmonic freq))))] + (o/mix (map component harmonic-series proportions)))) + +#_(bell 256) +#_(beep 256) + + +#_(let [env (o/envelope [0 0.5 1 0.25 0] [1 1 1 1] :lin)] + (o/demo (o/sin-osc :freq (+ 220 (* 220 (o/env-gen env :action o/FREE)))))) + +#_(o/demo (* 0.25 (o/linen (o/impulse 0) 0.1 1 1.9 :action o/FREE) (o/sin-osc))) + +#_(o/demo (let [dur 1 + env (abs (o/sin-osc:kr (/ 1 dur)))] + (o/line:kr 0 1 dur :action o/FREE) + (* env (o/saw 220)))) + +(defn factors [n] + (let [sqrt (Math/sqrt n)] + (loop [d 2 + factors []] + (cond (> d sqrt) (conj factors d) + (= 0 (mod n d)) (recur (inc d) (conj factors d)) + :else (recur (inc d) factors))))) + +#_(o/demo (* (o/pan2 (o/sin-osc 240) + (o/sin-osc 220)) + (o/line 1 0 1 :action o/FREE))) + +#_(o/demo 10 + (o/pan2 (* (o/lf-noise1) + (+ 1 (o/env-gen (o/env-sine 1 1)))))) + +#_(o/demo (tone)) +#_(o/demo (beep 220)) +#_(o/stop) + +#_(o/demo (bell 220)) +#_(o/demo (* (o/lpf1))) + +#_(o/demo (bell 256 10.0)) +#_(o/demo (bell 256 1.0 8 4 2 1)) +#_(o/demo (bell 256 10.0)) +#_(o/demo (bell 256 10.0)) +#_(o/demo (bell 500 10.0 0.0)) +#_(o/demo (bell 400 10.0 0.0 0.0)) + +#_(o/demo (bell 400 10.0 0.0 0.0)) + +(defn midi->hz [midi] + (* 8.1757989156 + (java.lang.Math/pow 2 (/ midi 12)))) + +#_(bell (midi->hz 60)) + +(defn ding [midi] (bell (midi->hz midi) 3)) + +#_(o/demo (ding 55)) + +(defn note [timing pitch] { :time timing :pitch pitch }) +(defn where [k f notes] (->> notes (map #(update-in % [k] f)))) +(defn from [offset] (partial + offset)) + +#_(require '[tunes.sounds :as sounds]) + +(defn play-note [midi] + (let [sound (ding midi)] + (o/detect-silence sound :action o/FREE))) + +(defn play [notes] + (let [scheduled-notes (->> notes (where :time (from (o/now))))] + (doseq [{ms :time midi :pitch} scheduled-notes] + ;; original: + #_(o/at ms (sounds/string midi)) + (o/at ms (play-note midi)) + ;;(o/at ms (sounds/tb303 :note midi :release 0.5)) + ) + scheduled-notes)) + +(defn even-melody [pitches] + (let [times (reductions + (repeat 1000/3)) + notes (map note times pitches)] + (play notes))) + +#_(even-melody (range 70 81)) + +(defn sum-n [series n] (reduce + (take n series))) + +(defmacro defscale [names values] + `(do + ~@(map + (fn [name value] `(def ~name ~value)) + names + (eval values)))) + +(defn scale [intervals] + (fn [degree] + (if-not (neg? degree) + (sum-n (cycle intervals) degree) + ((comp - (scale (reverse intervals)) -) degree)))) + +(def C (from 60)) + +(defscale [sharp flat] [inc dec]) + +(def major (scale [2 2 1 2 2 2 1])) +(def minor (scale [2 1 2 2 1 2 2])) +(def blues (scale [3 2 1 1 3 2])) +(def pentatonic (scale [3 2 2 3 2])) +(def chromatic (scale [1])) + +(defscale [D E F G A B] + (map + (comp from C major) + (rest (range)))) + +#_(even-melody + (map (comp C sharp minor) + (concat (range 0 8) (reverse (range 0 7))))) + +(def row-row-your-boat + (let [pitches [0 0 0 1 2 + 2 1 2 3 4 + 7 7 7 4 4 4 2 2 2 0 0 0 + 4 3 2 1 0] + durations [1 1 2/3 1/3 1 + 2/3 1/3 2/3 1/3 2 + 1/3 1/3 1/3 1/3 1/3 1/3 1/3 1/3 1/3 1/3 1/3 1/3 + 2/3 1/3 2/3 1/3 2] + times (reductions + 0 durations)] + (map note times pitches))) + +(def ghost-of-john + (let [pitches [0 -1 0 -3 -2 -1 0 + 2 1 2 4 3 2 1 0 1 2 3 + 4 3 4 7 6 4 3 4 + 4 4 3 3 2 2 1 1 0 -1 0] + durations [1/4 1/4 1/4 1/4 1/4 1/4 1/2 + 1/4 1/4 1/4 1/8 1/8 1/4 1/4 1/8 1/8 1/8 1/8 + 1/4 1/4 1/4 1/8 1/8 1/4 1/4 1/2 + 1/8 1/8 1/8 1/8 1/8 1/8 1/8 1/8 1/4 1/4 1/2] + times (reductions + 0 durations)] + (map note times pitches))) + +(def ghost-of-john-2 + (let [pitches [0 -1 0 -3 -2 -3 -3 + 2 1 2 4 3 2 1 0 + 4 3 4 7 6 4 3 4 + 4 4 3 3 2 2 1 1 0 -1 0] + durations [1/4 1/4 1/4 1/4 1/4 1/4 1/2 + 1/4 1/4 1/4 1/8 1/8 1/4 1/4 1/2 + 1/4 1/4 1/4 1/8 1/8 1/4 1/4 1/2 + 1/8 1/8 1/8 1/8 1/8 1/8 1/8 1/8 1/4 1/4 1/2] + times (reductions + 0 durations)] + (map note times pitches))) + +#_(->> ghost-of-john-2 + (where :time (bpm 26)) + (where :pitch (comp F minor)) + (play)) + +#_(o/stop) + +(defn bpm [beats] (fn [beat] (/ (* beat 60 1000) beats))) + +#_(->> row-row-your-boat + (where :time (bpm 120)) + (where :pitch (comp C major)) + play) + +(defn run [[from & tos]] + (if-let [to (first tos)] + (let [up-or-down (if (<= from to) + (range from to) + (reverse (range (inc to) (inc from))))] + (concat up-or-down (run tos))) + [from])) + +#_(even-melody (map (comp C flat minor) + (run [0 4 -1 1 0]))) + +(defn accumulate [series] + (map (partial sum-n series) (range (count series)))) + +(def repeats (partial mapcat #(apply repeat %))) +(def runs (partial mapcat run)) + +(def melody + (let [call + [(repeats [[2 1/4] [1 1/2] [14 1/4] [1 3/2]]) + (runs [[0 -1 3 0] [4] [1 8]])] + + response + [(repeats [[10 1/4] [1 1/2] [2 1/4] [1 9/4]]) + (runs [[7 -1 0] [0 -3]])] + + development + [(repeats [[1 3/4] [12 1/4] [1 1/2] [1 1] [1 1/2] [12 1/4] [1 3]]) + (runs [[4] [4] [2 -3] [-1 -2] [0] [3 5] [1] [1] [1 2] [-1 1 -1] [5 0]])] + + [durations pitches] (map concat call response development) + + times (map (from 1/2) (accumulate durations))] + (map note times pitches))) + +(def bass + (let [triples (partial mapcat #(repeat 3 %))] + (->> (map note + (accumulate (repeats [[21 1] [13 1/4]])) + (concat (runs [[5 0] [6 0]]))) + (where :part (constantly :bass))))) + +#_(defn canon [f notes] (concat notes (f notes))) + +(defn canon [f notes] + (->> notes + f + (where :part (constantly :follower)) + (concat notes))) + +(defn simple [wait] + (fn [notes] (->> notes (where :time (from wait))))) + +(defn interval [interval] + (fn [notes] (->> notes (where :pitch (from interval))))) + +(def mirror (fn [notes] (->> notes (where :pitch -)))) +(def crab (fn [notes] (->> notes (where :time -)))) +(def table (comp mirror crab)) + +#_(->> row-row-your-boat + #_(canon (simple 4)) + (where :pitch (comp C blues)) + (where :time (bpm 120)) + play) + +#_(->> ghost-of-john + (canon (simple 2)) + #_(canon (simple 4)) + (where :pitch (comp F minor)) + (where :time (bpm 30)) + (play)) + +#_(let [tempo 25 + key (comp F minor)] + (play (concat + (->> ghost-of-john + (canon (simple 2)) + (canon (simple 8)) + (canon (comp (simple 2) mirror)) + (where :pitch key) + (where :time (bpm tempo))) + (->> ghost-of-john-2 + (canon (simple 4)) + (canon (interval -7)) + (canon (comp (simple 4) canone-alla-quarta)) + (where :pitch key) + (where :time (bpm tempo)))) + #_(->> ghost-of-john + (where :pitch key) + (where :time (comp (from 8) (bpm (* 2 tempo)))) + (play)))) + +#_(o/stop) + +#_(->> ghost-of-john-2 + (canon (simple 2)) + (canon canone-alla-quarta) + (canon (interval -7)) + (where :pitch (comp F minor)) + (canon (simple 8)) + (where :time (bpm 25)) + (play)) + +#_(->> ghost-of-john + (canon (comp mirror (interval -2))) + (where :pitch (comp C minor)) + (where :time (bpm 30)) + (play)) + +#_(o/stop) + +(defn canone-alla-quarta [notes] + (canon (comp (interval -3) mirror (simple 3)) + notes)) + +#_(->> melody + (where :pitch (comp C major)) + (where :time (bpm 120)) + play) + +#_(->> melody + canone-alla-quarta + (concat bass) + (where :pitch (comp C sharp minor)) + (where :time (bpm 60)) + play) + +#_(o/stop) + +#_(o/definst small-hat [ffreq 200 rq 0.5 + attack 0 release 0.025 amp 0.3 + pan 0] + (let [snd (o/white-noise) + snd (o/hpf snd ffreq) + snd (o/rhpf snd (* ffreq 2) rq) + snd (* snd (o/env-gen (o/perc attack release 1 -10) :action o/FREE))] + (* 2 snd amp))) diff --git a/src/tunes/live.clj b/src/tunes/live.clj new file mode 100644 index 0000000..486fc15 --- /dev/null +++ b/src/tunes/live.clj @@ -0,0 +1,4 @@ +(ns tunes.live + (:use overtone.core) + (:require [overtone.inst.drum :as drum] + [tunes.track :as track])) diff --git a/src/tunes/sounds.clj b/src/tunes/sounds.clj new file mode 100644 index 0000000..480f422 --- /dev/null +++ b/src/tunes/sounds.clj @@ -0,0 +1,504 @@ +(ns tunes.sounds + (:use overtone.core) + (:require [overtone.core :as o])) + +(defn add-overtone [tones n] + (conj tones (* (first tones) n))) + +(comment + + (require '[overtone.inst.drum :as drum]) + + (demo (pan2 (mix (map (fn [freq amp] + (* amp (square freq))) + (map (fn [i] (* 110 (Math/pow 2 i))) (range 5)) + (reverse (range 0 1 0.2)))))) + + (demo (drum/kick :env-ratio 8.0 :amp-decay 0.5)) + + (demo (pan2 (sin-osc (* (env-gen (envelope [3 1] [0.02] :exp)) 120)))) + + (demo (pan2 + (* (sin-osc (* (env-gen (envelope [3 1] [0.02] :exp)) 50) + (* 0.5 Math/PI)) + (env-gen (perc 0.005 0.5) :action FREE)))) + + (demo (pan2 (mix [(* 0.5 (saw 220)) (sin-osc 220)]))) + + (demo 20 (pan2 (mix [(pink-noise) (brown-noise)]))) + + (demo (drum/dub-kick)) + + (stop) + + (demo (pan2 (* (-> (brown-noise) + (lpf 440)) + (env-gen (env-perc))))) + + (demo (klank)) + + (demo (pan2 (bpf (white-noise) 180 20))) + (demo (pan2 (white-noise))) + + (demo (pan2 (+ (gray-noise) (white-noise)))) + (demo (pan2 (lpf (mix [(pink-noise) (brown-noise)]) 180))) + (demo 3 + (pan2 (-> (brown-noise) + (lpf 120) + (rhpf 80)))) + + (demo (pan2 (t-ball (brown-noise)))) + (demo (pan2 (lpf (white-noise) :freq 220))) + ) + +#_(o/stop) + + + +;; translated from: https://github.com/supercollider-quarks/SynthDefPool/blob/master/pool/apad_mh.scd +(definst simple-flute [freq 880 + amp 0.5 + attack 0.4 + decay 0.5 + sustain 0.8 + release 1 + gate 1 + out 0] + (let [env (env-gen (adsr attack decay sustain release) gate :action FREE) + mod1 (lin-lin:kr (sin-osc:kr 6) -1 1 (* freq 0.99) (* freq 1.01)) + mod2 (lin-lin:kr (lf-noise2:kr 1) -1 1 0.2 1) + mod3 (lin-lin:kr (sin-osc:kr (ranged-rand 4 6)) -1 1 0.5 1) + sig (distort (* env (sin-osc [freq mod1]))) + sig (* amp sig mod2 mod3)] + sig)) + +(demo (simple-flute 660)) + +(stop) + +;;modified version of: https://github.com/supercollider-quarks/SynthDefPool/blob/master/pool/cs80lead_mh.scd +(definst cs80lead + [freq 880 + amp 0.5 + att 0.75 + decay 0.5 + sus 0.8 + rel 1.0 + fatt 0.75 + fdecay 0.5 + fsus 0.8 + frel 1.0 + cutoff 200 + dtune 0.002 + vibrate 4 + vibdepth 0.015 + gate 1 + ratio 1 + cbus 1 + freq-lag 0.1] + (let [freq (lag freq freq-lag) + cuttoff (in:kr cbus) + env (env-gen (adsr att decay sus rel) gate :action FREE) + fenv (env-gen (adsr fatt fdecay fsus frel 2) gate) + + vib (+ 1 (lin-lin:kr (sin-osc:kr vibrate) -1 1 (- vibdepth) vibdepth)) + + freq (* freq vib) + sig (mix (* env amp (saw [freq (* freq (+ dtune 1))])))] + sig)) + +(definst supersaw [freq 440 amp 1] + (let [input (lf-saw freq) + shift1 (lf-saw 4) + shift2 (lf-saw 7) + shift3 (lf-saw 5) + shift4 (lf-saw 2) + comp1 (> input shift1) + comp2 (> input shift2) + comp3 (> input shift3) + comp4 (> input shift4) + output (+ (- input comp1) (- input comp2) (- input comp3) (- input comp4)) + output (- output input) + output (leak-dc:ar (* output 0.25))] + (* amp output))) + +(definst ticker + [freq 880] + (* (env-gen (perc 0.001 0.01) :action FREE) + (sin-osc freq))) + +(definst ping + [note {:default 72 :min 0 :max 120 :step 1} + attack {:default 0.02 :min 0.001 :max 1 :step 0.001} + decay {:default 0.3 :min 0.001 :max 1 :step 0.001}] + (let [snd (sin-osc (midicps note)) + env (env-gen (perc attack decay) :action FREE)] + (* 0.8 env snd))) + +(definst tb303 + [note {:default 60 :min 0 :max 120 :step 1} + wave {:default 1 :min 0 :max 2 :step 1} + r {:default 0.8 :min 0.01 :max 0.99 :step 0.01} + attack {:default 0.01 :min 0.001 :max 4 :step 0.001} + decay {:default 0.1 :min 0.001 :max 4 :step 0.001} + sustain {:default 0.6 :min 0.001 :max 0.99 :step 0.001} + release {:default 0.01 :min 0.001 :max 4 :step 0.001} + cutoff {:default 100 :min 1 :max 20000 :step 1} + env-amount {:default 0.01 :min 0.001 :max 4 :step 0.001} + amp {:default 0.5 :min 0 :max 1 :step 0.01}] + (let [freq (midicps note) + freqs [freq (* 1.01 freq)] + vol-env (env-gen (adsr attack decay sustain release) + (line:kr 1 0 (+ attack decay release)) + :action FREE) + fil-env (env-gen (perc)) + fil-cutoff (+ cutoff (* env-amount fil-env)) + waves (* vol-env + [(saw freqs) + (pulse freqs 0.5) + (lf-tri freqs)]) + selector (select wave waves) + filt (rlpf selector fil-cutoff r)] + (* amp filt))) + +(definst mooger + "Choose 0, 1, or 2 for saw, sin, or pulse" + [note {:default 60 :min 0 :max 127 :step 1} + amp {:default 0.3 :min 0 :max 1 :step 0.01} + osc1 {:default 0 :min 0 :max 2 :step 1} + osc2 {:default 1 :min 0 :max 2 :step 1} + osc1-level {:default 0.5 :min 0 :max 1 :step 0.01} + osc2-level {:default 0 :min 0 :max 1 :step 0.01} + cutoff {:default 500 :min 0 :max 20000 :step 1} + attack {:default 0.0001 :min 0.0001 :max 5 :step 0.001} + decay {:default 0.3 :min 0.0001 :max 5 :step 0.001} + sustain {:default 0.99 :min 0.0001 :max 1 :step 0.001} + release {:default 0.0001 :min 0.0001 :max 6 :step 0.001} + fattack {:default 0.0001 :min 0.0001 :max 6 :step 0.001} + fdecay {:default 0.3 :min 0.0001 :max 6 :step 0.001} + fsustain {:default 0.999 :min 0.0001 :max 1 :step 0.001} + frelease {:default 0.0001 :min 0.0001 :max 6 :step 0.001} + gate 1] + (let [freq (midicps note) + osc-bank-1 [(saw freq) (sin-osc freq) (pulse freq)] + osc-bank-2 [(saw freq) (sin-osc freq) (pulse freq)] + amp-env (env-gen (adsr attack decay sustain release) gate :action FREE) + f-env (env-gen (adsr fattack fdecay fsustain frelease) gate) + s1 (* osc1-level (select osc1 osc-bank-1)) + s2 (* osc2-level (select osc2 osc-bank-2)) + filt (moog-ff (+ s1 s2) (* cutoff f-env) 3)] + (* amp filt))) + +(definst rise-fall-pad + [freq 440 t 4 amt 0.3 amp 0.8] + (let [abs-fn (partial map abs) + f-env (env-gen (perc t t) 1 1 0 1 FREE) + src (saw [freq (* freq 1.01)]) + signal (rlpf (* 0.3 src) + (+ (* 0.6 freq) (* f-env 2 freq)) 0.2) + k (/ (* 2 amt) (- 1 amt)) + distort (/ (* (+ 1 k) signal) (+ 1 (* k (abs-fn signal)))) + gate (pulse (* 2 (+ 1 (sin-osc:kr 0.05)))) + compressor (compander distort gate 0.01 1 0.5 0.01 0.01) + dampener (+ 1 (* 0.5 (sin-osc:kr 0.5))) + reverb (free-verb compressor 0.5 0.5 dampener) + echo (comb-n reverb 0.4 0.3 0.5)] + (* amp echo))) + +(definst pad + [note 60 t 10 amt 0.3 amp 0.1 a 0.4 d 0.5 s 0.8 r 2] + (let [freq (midicps note) + lfo (+ 2 (* 0.01 (sin-osc:kr 5 (rand 1.5)))) + src (apply + (saw [freq (* freq lfo)])) + env (env-gen (adsr a d s r) (sin-osc:kr 0.2)) + f-env (x-line:kr 0.001 4 t) + src (* env src) + signal (rlpf src (+ (* 0.3 freq) (* f-env 2 freq)) 0.5) + k (/ (* 4 amt) (- 1 amt)) + dist (clip2 (/ (* (+ 1 k) signal) (+ 1 (* k (abs signal)))) + 0.03) + snd (* amp dist (line:kr 1 0 t))] + src)) + +(definst overpad + [note 60 amp 0.7 attack 0.001 release 2] + (let [freq (midicps note) + env (env-gen (perc attack release) :action FREE) + f-env (+ freq (* 3 freq (env-gen (perc 0.012 (- release 0.1))))) + bfreq (/ freq 2) + sig (apply + + (concat (* 0.7 (sin-osc [bfreq (* 0.99 bfreq)])) + (lpf (saw [freq (* freq 1.01)]) f-env))) + audio (* amp env sig)] + audio)) + +;; BROKEN! +#_(definst buzz + [pitch 40 cutoff 300 dur 200] + (let [lpf-lev (* (+ 1 (lf-noise1:kr 10)) 400) + a (lpf (saw (midicps pitch)) lpf-lev) + b (sin-osc (midicps (- pitch 12))) + env (env-gen 1 1 0 1 2 (perc 0.01 (/ dur 1000)))] + (* env (+ a b)))) + +(definst bass + [freq 120 t 0.6 amp 0.5] + (let [env (env-gen (perc 0.08 t) :action FREE) + src (saw [freq (* 0.98 freq) (* 2.015 freq)]) + src (clip2 (* 1.3 src) 0.8) + sub (sin-osc (/ freq 2)) + filt (resonz (rlpf src (* 4.4 freq) 0.09) (* 2.0 freq) 2.9)] + (* env amp (fold:ar (distort (* 1.3 (+ filt sub))) 0.08)))) + +(definst daf-bass [freq 440 gate 1 amp 1 out-bus 0] + (let [harm [1 1.01 2 2.02 3.5 4.01 5.501] + harm (concat harm (map #(* 2 %) harm)) + snd (* 2 (distort (sum (sin-osc (* freq harm))))) + snd (+ snd (repeat 2 (sum (sin-osc (/ freq [1 2]))))) + env (env-gen (adsr 0.001 0.2 0.9 0.25) gate amp :action FREE)] + (* snd env))) + +(definst grunge-bass + [note 48 amp 0.5 dur 0.1 a 0.01 d 0.01 s 0.4 r 0.01] + (let [freq (midicps note) + env (env-gen (adsr a d s r) (line:kr 1 0 (+ a d dur r 0.1)) + :action FREE) + src (saw [freq (* 0.98 freq) (* 2.015 freq)]) + src (clip2 (* 1.3 src) 0.9) + sub (sin-osc (/ freq 2)) + filt (resonz (rlpf src (* 8.4 freq) 0.29) (* 2.0 freq) 2.9) + meat (ring4 filt sub) + sliced (rlpf meat (* 2 freq) 0.1) + bounced (free-verb sliced 0.8 0.9 0.2)] + (* env bounced))) + +(definst vintage-bass + [note 40 velocity 80 t 0.6 amp 1 gate 1] + (let [freq (midicps note) + sub-freq (midicps (- note 12)) + velocity (/ velocity 127.0) + sawz1 (* 0.275 (saw [freq (* 1.01 freq)])) + sawz2 (* 0.75 (saw [(- freq 2) (+ 1 freq)])) + sqz (* 0.3 (pulse [sub-freq (- sub-freq 1)])) + mixed (* 5 (+ sawz1 sawz2 sqz)) + env (env-gen (adsr 0.1 3.3 0.4 0.8) gate :action FREE) + filt (* env (moog-ff mixed (* velocity env (+ freq 200)) 2.2))] + (* amp filt))) + +(definst ks1 + [note {:default 60 :min 10 :max 120 :step 1} + amp {:default 0.8 :min 0.01 :max 0.99 :step 0.01} + dur {:default 2 :min 0.1 :max 4 :step 0.1} + decay {:default 30 :min 1 :max 50 :step 1} + coef {:default 0.3 :min 0.01 :max 2 :step 0.01}] + (let [freq (midicps note) + noize (* 0.8 (white-noise)) + dly (/ 1.0 freq) + plk (pluck noize 1 (/ 1.0 freq) dly + decay + coef) + dist (distort plk) + filt (rlpf dist (* 12 freq) 0.6) + clp (clip2 filt 0.8) + reverb (free-verb clp 0.4 0.8 0.2)] + (* amp (env-gen (perc 0.0001 dur) :action FREE) reverb))) + +(definst ks1-demo + [note 60 amp 0.8 gate 1] + (let [freq (midicps note) + noize (* 0.8 (white-noise)) + dly (/ 1.0 freq) + plk (pluck noize gate (/ 1.0 freq) dly + (mouse-x 0.1 50) + (mouse-y 0.0001 0.9999)) + dist (distort plk) + filt (rlpf dist (* 12 freq) 0.6) + reverb (free-verb filt 0.4 0.8 0.2)] + (* amp (env-gen (perc 0.0001 2) :action FREE) reverb))) + +;; Huh? +#_(definst ks-stringer + [freq 440 rate 6] + (let [noize (* 0.8 (white-noise)) + trig (dust rate) + coef (mouse-x -0.999 0.999) + delay (/ 1.0 (* (mouse-y 0.001 0.999) freq)) + plk (pluck noize trig (/ 1.0 freq) delay 10 coef) + filt (rlpf plk (* 12 freq) 0.6)] + (* 0.8 filt))) + +(definst fm-mouse-demo + [note 60 amp 0.2 gate 0] + (let [freq (midicps note) + osc-a (* (sin-osc (mouse-x 20 3000)) + 0.3) + osc-b (* amp (sin-osc (* (mouse-y 3000 0) osc-a)))] + osc-a)) + +;; Don't get this +#_(definst harmonic-swimming + [amp 0.5] + (let [freq 100 + partials 20 + z-init 0 + offset (line:kr 0 -0.02 60) + snd (loop [z z-init + i 0] + (if (= partials i) + z + (let [f (clip:kr (mul-add + (lf-noise1:kr [(+ 6 (rand 4)) + (+ 6 (rand 4))]) + 0.2 offset)) + src (f-sin-osc (* freq (inc i))) + newz (mul-add src f z)] + (recur newz (inc i)))))] + (out 10 (pan2 (* amp snd))))) + + +(definst whoahaha + [freq 440 dur 5 osc 100 mul 1000] + (let [freqs [freq (* freq 1.0068) (* freq 1.0159)] + sound (resonz (saw (map #(+ % (* (sin-osc osc) mul)) freqs)) + (x-line 10000 10 25) + (line 1 0.05 25)) + sound (apply + sound)] + (* (lf-saw:kr (line:kr 13 17 3)) (line:kr 1 0 dur FREE) sound))) + +(definst bubbles + [bass-freq 80] + (let [bub (+ bass-freq (* 3 (lf-saw:kr [8 7.23]))) + glis (+ bub (* 24 (lf-saw:kr 0.4 0))) + freq (midicps glis) + src (* 0.04 (sin-osc freq)) + zout (comb-n src :decay-time 4)] + zout)) + + (definst string [note 60 amp 1.0 dur 0.5 decay 30 coef 0.3 gate 1] + (let [freq (midicps note) + noize (* 0.8 (white-noise)) + dly (/ 1.0 freq) + plk (pluck noize gate dly dly decay coef) + dist (distort plk) + filt (rlpf dist (* 12 freq) 0.6) + clp (clip2 filt 0.8) + reverb (free-verb clp 0.4 0.8 0.2)] + (* amp (env-gen (perc 0.0001 dur) :action 0) reverb))) + +(definst bowed + [note 60 velocity 80 gate 1 amp 1 + bow-offset 0 bow-slope 0.5 bow-position 0.75 vib-freq 6.127 vib-gain 0.2] + (let [freq (midicps note) + velocity (/ velocity 127) + beta-ratio (+ 0.027236 (* 0.2 bow-position)) + base-delay (reciprocal freq) + [fb1 fb2] (local-in 2) + vibrato (* (sin-osc vib-freq) vib-gain) + neck-delay (+ (* base-delay (- 1 beta-ratio)) (* base-delay vibrato)) + neck (delay-l fb1 0.05 neck-delay) + nut-refl (neg neck) + bridge (delay-l fb2 0.025 (* base-delay beta-ratio)) + string-filt (one-pole (* bridge 0.95) 0.55) + bridge-refl (neg string-filt) + adsr (* amp (env-gen (adsr 0.02 3.005 1.0 0.01) gate :action FREE)) + string-vel (+ bridge-refl nut-refl) + vel-diff (- adsr string-vel) + slope (- 5.0 (* 4 bow-slope)) + bow-table (clip:ar (pow (abs (+ (* (+ vel-diff bow-offset) slope) 0.75 )) -4) 0 1) + new-vel (* vel-diff bow-table)] + (local-out (+ [bridge-refl nut-refl] new-vel)) + (resonz (* bridge 0.5) 500 0.85))) + +(comment + (demo (ks1 40)) + + (doseq [i (range 10)] + (demo (at (+ (now) (* i 333)) (ks1 (+ 50 (* i 2)))))) + + (stop)) + +(comment + + (defonce tri-bus (audio-bus)) + (defonce sin-bus (audio-bus)) + + (defsynth tri-synth [out-bus 0 freq 5] + (out:kr out-bus (lf-tri:kr freq))) + + (defsynth sin-synth [out-bus 0 freq 5] + (out:kr out-bus (sin-osc:kr freq))) + + (defonce main-g (group "get-on-the-bus main")) + (defonce early-g (group "early birds" :head main-g)) + (defonce later-g (group "latecomers" :after early-g)) + + (def tri-synth-inst (tri-synth [:tail early-g] tri-bus))) + + ;; (def snare drum/snare) + ;; (def kick drum/kick) + ;; (def close-hihat drum/closed-hat) + ;; (def open-hihat drum/open-hat) + +(comment + + (defn subdivide + "subdivide two time intervals by 4, and return the time interval + at position. this is a cheap hack to schedule 16th notes without + defining the whole pattern with the metronome firing every 16th note." + [a b position] + (+ a (* position (/ (- b a) 4) ))) + + (defn drums [nome] + (let [beat (nome)] + ; hi-hat pattern + (at (nome beat) (close-hihat)) + (at (nome (+ 1 beat)) (open-hihat)) + (at (nome (+ 2 beat)) (close-hihat)) + (at (nome (+ 3 beat)) (close-hihat)) + (at (nome (+ 4 beat)) (close-hihat)) + (at (nome (+ 5 beat)) (open-hihat)) + (at (nome (+ 6 beat)) (close-hihat)) + (at (nome (+ 7 beat)) (close-hihat)) + + ; snare pattern + (at (nome (+ 2 beat)) (snare)) + (at (subdivide (nome (+ 2 beat)) (nome (+ 4 beat)) 3) (snare)) + (at (subdivide (nome (+ 4 beat)) (nome (+ 6 beat)) 1) (snare)) + (at (nome (+ 6 beat)) (snare)) + (at (subdivide (nome (+ 6 beat)) (nome (+ 8 beat)) 3) (snare)) + + ; kick drum pattern + (at (nome beat) (kick)) + (at (nome (+ 5 beat)) (kick)) + (at (nome (+ 7 beat)) (kick)) + (apply-by (nome (+ 8 beat)) drums nome []))) + + (demo (drums (metronome 180))) + + (defn bass [nome] + (let [beat (nome)] + (at (nome beat) (string 51)) + (at (subdivide (nome beat) (nome (+ 2 beat)) 1) (string 51)) + (at (subdivide (nome beat) (nome (+ 2 beat)) 3) (string 51)) + (at (subdivide (nome (+ beat 1)) (nome (+ 3 beat)) 1) (string 51)) + (at (subdivide (nome (+ beat 1)) (nome (+ 3 beat)) 3) (string 51)) + (at (nome (+ 4 beat)) (string 51)) + (at (subdivide (nome (+ 4 beat)) (nome (+ 6 beat)) 1) (string 49)) + (at (nome (+ 5 beat)) (string 46)) + (at (nome (+ 6 beat)) (string 51)) + (at (subdivide (nome (+ 6 beat)) (nome (+ 8 beat)) 1) (string 49)) + (at (nome (+ 7 beat)) (string 46)) + (at (nome (+ 8 beat)) (string 51)) + (at (nome (+ 12 beat)) (string 51)) + (at (subdivide (nome (+ 12 beat)) (nome (+ 14 beat)) 1) (string 51)) + (apply-by (nome (+ 16 beat)) bass nome []))) + + (defn section [nome] + (drums nome) + (bass nome)) + + (def met (metronome (* 100 2))) + + (demo 5 (section met)) + + (stop)) diff --git a/src/tunes/track.clj b/src/tunes/track.clj new file mode 100644 index 0000000..758297f --- /dev/null +++ b/src/tunes/track.clj @@ -0,0 +1,73 @@ +(ns tunes.track + (:require [overtone.core :as o])) + +(defrecord Track [metronome players playing?]) + +(defn- beat->bar-beat [m b] + (let [bpb (o/metro-bpb m)] + (mod b bpb))) + +(defn- tick-track + ([track] (tick-track track ((:metronome track)))) + ([track beat] + (let [m (:metronome track)] + (when (-> track :playing? deref) + (send (:players track) + (fn [players metronome beat] + (let [bar-beat (beat->bar-beat m beat)] + (doseq [[name player] players] + (try + (player metronome bar-beat) + (catch Exception e (println (str "error in player " name ": " e)))))) + players) + m beat) + (o/apply-at (m (inc beat)) #'tick-track [track (inc beat)]))))) + +(defn make-track [bpm] + (Track. (o/metronome bpm) (agent {}) (atom false))) + +(defn- partial-keyword [f & tail-args] + (fn [& args] (apply f (concat args tail-args)))) + +(defn add-player [track name player] + (send (:players track) conj {name player}) + name) + +(defn rm-player [track name] + (send (:players track) dissoc name) + name) + +(defn ls-players [track] + (-> track :players deref keys)) + +(defn- always [val] (fn [& _] val)) + +(defn start [track] + (swap! (:playing? track) (always true)) + (tick-track track) + track) + +(defn stop [track] + (swap! (:playing? track) (always false)) + track) + +(defn clear [track] + (send (:players track) (always {}))) + +(defn print-thru [o] (println o) o) + +(defn on-beat [track ugen & + {:keys [name on-beat offset] + :or {name (keyword (gensym)) + on-beat (always true) + offset (always 0)}}] + (let [offset-fn (if (fn? offset) offset (fn [tick-len] (* offset tick-len)))] + (add-player track + name + (fn [metronome beat-num] + (when (on-beat beat-num) + (o/at (+ (metronome beat-num) (offset-fn (o/metro-tick metronome))) + (ugen))))))) + +(defn nth-beat [n] + (fn [beat] (= n beat)))