{"id":13503644,"url":"https://github.com/merongivian/negasonic","last_synced_at":"2025-03-29T18:31:24.534Z","repository":{"id":56885257,"uuid":"134021625","full_name":"merongivian/negasonic","owner":"merongivian","description":"This ain't Sonic Pi, but it works on the browser: https://negasonic.onrender.com/","archived":false,"fork":false,"pushed_at":"2024-05-18T11:00:29.000Z","size":82,"stargazers_count":90,"open_issues_count":2,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-03T12:38:43.263Z","etag":null,"topics":["livecoding","opal","sonic-pi","tonejs","web-audio"],"latest_commit_sha":null,"homepage":"https://negasonic.onrender.com/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/merongivian.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-19T02:13:29.000Z","updated_at":"2024-11-08T04:34:31.000Z","dependencies_parsed_at":"2024-05-18T12:20:32.121Z","dependency_job_id":"41a63e79-c869-4e39-82b5-3b6d02369af3","html_url":"https://github.com/merongivian/negasonic","commit_stats":{"total_commits":81,"total_committers":1,"mean_commits":81.0,"dds":0.0,"last_synced_commit":"4ab600b87b9cc3c45fccb6b39e47c4935a1e83d3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merongivian%2Fnegasonic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merongivian%2Fnegasonic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merongivian%2Fnegasonic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merongivian%2Fnegasonic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/merongivian","download_url":"https://codeload.github.com/merongivian/negasonic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246227010,"owners_count":20743870,"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":["livecoding","opal","sonic-pi","tonejs","web-audio"],"created_at":"2024-07-31T23:00:42.271Z","updated_at":"2025-03-29T18:31:24.233Z","avatar_url":"https://github.com/merongivian.png","language":"Ruby","funding_links":[],"categories":["Uncategorized","Languages"],"sub_categories":["Uncategorized"],"readme":"# Negasonic\n\nRuby DSL for music live coding in the browser, you can play with it in the [online editor](http://negasonic.onrender.com/)\n\n**DISCLAIMER:** This is pretty alpha, so use with care if you plan to use it for real performances... Otherwise have fun!\n\nChat is available in gitter: [nega-sonic/Lobby](https://gitter.im/nega-sonic/Lobby) if you have any questions/suggestions\n\n## Usage\n\n### Playing Notes\n\nYou can use plain normal or midi notes\n\n``` ruby\n# playing a single note\nplay 42\n\n# multiple notes\nplay 'E3', 42\n\n# produces the same result as the above\nplay 'E3'\nplay 42\n\n# Scales and chords (same as Sonic-pi)\nplay (scale :c, :major)\nplay (chord :d, :minor)\n```\n\n### Cycle\n\nUnder the hood we use a 'fixed' time for calculating notes durations, adding more notes or `play` statements will make durations\nshorter. This happens because each `play` happens inside a `cycle`. A `cycle`'s duration is around 3 seconds\n\n```ruby\n# doing this\nplay 'E3'\nplay 42\n\n# is the same as this\ncycle do\n  play 'E3'\n  play 42\nend\n```\n\nIf you want to play notes at the same time then use multiple cycles\n\n```ruby\ncycle do\n  play 'E3'\nend\n\ncycle do\n  play 42\nend\n```\n\n### Custom Instruments\n\nWith `with_instrument` you can add a synthesizer and connect it with effects. Every instrument needs\nto have a name (for performance reasons)\n\n```ruby\n\n# The order of the effects will affect the final sound\nwith_instrument(:drums, synth: :membrane, fx: [:bit_crusher, :distortion]) do\n  # each instrument has its own cycle by default\n  play 30\n  play 64\nend\n\n# multiple cycles can be used here as well\nwith_instrument(:lead, synth: :am, fx: :freeverb, volume: 3) do\n  cycle do\n    play (scale :c, :major)\n  end\n\n  cycle do\n    play (scale :c, :pelog)\n  end\nend\n```\n\n### Custom Effects\n\nIt is possible to modify the default values for effects, you can do this trough the `fx` block. Options\nfor each effect are detailed in the [Effects section](https://github.com/merongivian/negasonic/tree/new-dsl#effects).\n\n```ruby\ndrum_effects = fx do\n  bit_crusher bits: 3\n  distortion value: 1.3\nend\n\nwith_instrument(:drums, synth: :membrane, fx: drum_effects) do\n  4.times do\n    play 30\n    play 64\n  end\nend\n```\n\n### Cycle options\n\n- `:expand` for a longer duration. Integer value\n- `:every` plays every 'nth'. For example this: `cycle(every: 3)` will play every third cycle. Integer value\n- `:sustain` reduce/augment the duration of notes. Float value between 0 and 1\n- `:probability` play or miss a note randomly. Float value between 0 and 1\n- `:humanize` boolean value\n\n### Synths\n\n- `:membrane` Use it as drums\n- `:simple`\n- `:am`\n- `:fm`\n- `:duo`\n- `:mono`\n- `:metal`\n- `:pluck`\n- `:poly`\n\n### Effects\n\n| Effects         | Options                                            |\n| --------------- | -------------------------------------------------- |\n| vibrato         | `:frequency`, `:depth`                             |\n| distortion      | `:value`                                           |\n| chorus          | `:frequency`, `:delay_time`, `:depth`              |\n| tremolo         | `:frequency`, `:depth`                             |\n| feedback_delay  | `:delay_time`, `:feedback`                         |\n| freeverb        | `:room_size`, `:dampening`                         |\n| jc_reverb       | `:room_size`                                       |\n| phaser          | `:frequency`, `:octaves`, `:base_frequency`        |\n| ping_pong_delay | `:delay_time`, `:feedback`                         |\n| auto_wah        | `:base_frequency`, `:octave`, `:sensitivity`, `:q` |\n| bit_crusher     | `:bits`                                            |\n| chebyshev       | `:order`                                           |\n| pitch_shift     | `:pitch`                                           |\n\n## Examples\n\n- [random drums](https://negasonic.onrender.com/?code:with_instrument(%3Adrums%2C%20synth%3A%20%3Amembrane%2C%20fx%3A%20%5B%3Adistortion%2C%20%3Afreeverb%5D)%20do%0A%20%20cycle%20do%0A%20%20%20%202.times%20do%0A%20%20%20%20%20%20play%2030%0A%20%20%20%20%20%20play%2030%0A%20%20%20%20%20%20play%200%0A%20%20%20%20%20%20play%2040%0A%20%20%20%20end%0A%20%20end%0A%20%20%0A%20%20cycle%20do%0A%20%20%20%202.times%20do%0A%20%20%20%20%20%20play%200%0A%20%20%20%20%20%20play%2070%0A%20%20%20%20end%0A%20%20end%0A%20%20%0A%20%20cycle%20do%0A%20%20%20%202.times%20do%0A%20%20%20%20%20%20play%2060%0A%20%20%20%20%20%20play%200%0A%20%20%20%20end%0A%20%20end%0A%20%20%0A%20%20cycle(every%3A%202)%20do%0A%20%20%20%208.times%20do%0A%20%20%20%20%20%20play%2075%0A%20%20%20%20%20%20play%200%0A%20%20%20%20end%0A%20%20end%0A%20%20%0A%20%20cycle(every%3A%208%2C%20probability%3A%200.4)%20do%0A%20%20%20%2016.times%20do%0A%20%20%20%20%20%20play%2075%0A%20%20%20%20%20%20play%200%0A%20%20%20%20%20%20play%2065%0A%20%20%20%20%20%20play%200%0A%20%20%20%20%20%20play%2070%0A%20%20%20%20end%0A%20%20end%0A%20%20%0A%20%20cycle(every%3A%202%2C%20probability%3A%200.6%2C%20expand%3A%202)%20do%0A%20%20%20%208.times%20do%0A%20%20%20%20%20%20play%2030%0A%20%20%20%20%20%20play%200%0A%20%20%20%20%20%20play%2040%0A%20%20%20%20%20%20play%200%0A%20%20%20%20%20%20play%2050%0A%20%20%20%20end%0A%20%20end%0Aend%0A%0Awith_instrument(%3Abass%2C%20synth%3A%20%3Aduo%2C%20fx%3A%20%5B%3Avibrato%2C%20%3Afeedback_delay%2C%20%3Ajc_reverb%5D)%20do%0A%20%20cycle(expand%3A%204)%20do%0A%20%20%20%20play%20(scale%20%3Agb%2C%20%3Apelog).last(4)%0A%20%20end%0A%20%20%0A%20%20cycle(expand%3A%2016)%20do%0A%20%20%20%20play%20(scale%20%3Agb%2C%20%3Apelog).first(4)%0A%20%20end%0Aend)\n- [arabian space](https://negasonic.onrender.com/?code:scale_type%20%3D%20%3Adorian%0A%0Awith_instrument(%3Abass%2C%20synth%3A%20%3Afm%2C%20fx%3A%20%3Afreeverb%2C%20volume%3A%20-8)%20do%0A%20%20play%20scale(%3Ac%2C%20scale_type).reverse%0Aend%0A%0Awith_instrument(%3Amiddle%2C%20synth%3A%20%3Aduo%2C%20volume%3A%201)%20do%0A%20%202.times%20do%0A%20%20%20%20play%20scale(%3Ac3%2C%20scale_type)%0A%20%20end%0Aend%0A%0Awith_instrument(%3Alead%2C%20synth%3A%20%3Aam%2C%20fx%3A%20%5B%3Avibrato%2C%20%3Afeedback_delay%2C%20%3Afreeverb%5D)%20do%0A%20%204.times%20do%0A%20%20%20%20play%20scale(%3Ac4%2C%20scale_type)%0A%20%20end%0A%20%20%0A%20%202.times%20do%0A%20%20%20%20play%20scale(%3Ac5%2C%20scale_type)%0A%20%20end%0A%20%20%0A%20%20cycle(probability%3A%200.3%2C%20humanize%3A%20true)%20do%0A%20%20%20%207.times%20do%0A%20%20%20%20%20%20play%20scale(%3Ac6%2C%20scale_type).shuffle%0A%20%20%20%20end%0A%20%20end%0Aend%0A%0Awith_instrument(%3Adrums%2C%20synth%3A%20%3Amembrane%2C%20fx%3A%20%5B%3Abit_crusher%2C%20%3Adistortion%5D)%20do%0A%20%20play%2030%0A%20%20play%2062%0A%20%20play%2030%0A%20%20play%2062%0A%20%20%0A%20%20cycle%20do%0A%20%20%20%20play%2035%0A%20%20%20%20play%2065%0A%20%20%20%20%0A%20%20%20%202.times%20do%0A%20%20%20%20%20%20play%2035%2C%2065%0A%20%20%20%20end%0A%20%20end%0Aend)\n- [supernintendo gangsta](https://negasonic.onrender.com/?code:with_instrument(%3Adrums%2C%20synth%3A%20%3Amembrane%2C%20fx%3A%20%3Adistortion)%20do%0A%20%202.times%20do%0A%20%20%20%20play%2030%0A%20%20%20%20play%2062%0A%20%20end%0A%20%20%0A%20%20cycle(humanize%3A%20true)%20do%0A%20%20%20%204.times%20do%0A%20%20%20%20%20%20play%20115%0A%20%20%20%20%20%20play%2020%2C%2010%0A%20%20%20%20end%0A%20%20end%0A%20%20%0A%20%20cycle%20do%0A%20%20%20%202.times%20do%0A%20%20%20%20%20%20play%2094%0A%20%20%20%20%20%20play%2084%2C%2074%0A%20%20%20%20end%0A%20%20end%0Aend%0A%0Anote%20%3D%20%3Ac%0Ascale_type%20%3D%20%3Apelog%0A%0Awith_instrument(%3Abass%2C%20synth%3A%20%3Aduo%2C%20fx%3A%20%3Afreeverb)%20do%0A%20%20play%20scale(%22%23%7Bnote%7D2%22%2C%20scale_type).reverse%0Aend%0A%0Awith_instrument(%3Amid%2C%20synth%3A%20%3Afm%2C%20fx%3A%20%3Adistortion%2C%20volume%3A%20-11)%20do%0A%20%202.times%20do%0A%20%20%20%20play%20scale(%22%23%7Bnote%7D4%22%2C%20scale_type)%0A%20%20end%0Aend%0A%0Awith_instrument(%3Alead%2C%20synth%3A%20%3Aam%2C%20fx%3A%20%5B%3Avibrato%2C%20%3Afeedback_delay%2C%20%3Afreeverb%5D%2C%20volume%3A%20-3)%20do%0A%20%202.times%20do%0A%20%20%20%20play%20scale(%22%23%7Bnote%7D6%22%2C%20scale_type).shuffle%0A%20%20end%0A%20%20%0A%20%202.times%20do%0A%20%20%20%20play%20scale(%22%23%7Bnote%7D5%22%2C%20scale_type).shuffle%0A%20%20end%0A%20%20%0A%20%202.times%20do%0A%20%20%20%20play%20scale(%22%23%7Bnote%7D7%22%2C%20scale_type).shuffle%0A%20%20end%0A%20%20%0A%20%20cycle(probability%3A%200.3%2C%20humanize%3A%20true)%20do%0A%20%20%20%20play%20scale(%22%23%7Bnote%7D8%22%2C%20scale_type).shuffle%0A%20%20end%0Aend)\n- [dancing in china](https://negasonic.onrender.com/?code:with_instrument(%3Adrums%2C%20synth%3A%20%3Amembrane%2C%20fx%3A%20%5B%3Abit_crusher%2C%20%3Adistortion%2C%20%3Afreeverb%5D%2C%20volume%3A%2010)%20do%0A%20%20cycle()%20do%0A%20%20%20%206.times%20do%0A%20%20%20%20%20%20play%2030%0A%20%20%20%20%20%20play%2062%0A%20%20%20%20end%0A%20%20end%0A%20%20%0A%20%20cycle%20do%0A%20%20%20%203.times%20do%0A%20%20%20%20%20%20play%2030%0A%20%20%20%20%20%20play%2062%0A%20%20%20%20end%0A%20%20end%0A%20%20%0A%20%20cycle%20do%0A%20%20%20%204.times%20do%0A%20%20%20%20%20%20play%2072%0A%20%20%20%20%20%20play%2062%0A%20%20%20%20end%0A%20%20end%0Aend%0A%0Awith_instrument(%3Amid%2C%20synth%3A%20%3Afm%2C%20fx%3A%20%5B%3Adistortion%2C%20%3Avibrato%2C%20%3Afeedback_delay%2C%20%3Afreeverb%5D%2C%20volume%3A%20-4)%20do%0A%20%20scale_type%20%3D%20%3Aritusen%0A%20%20%0A%20%20play%20(scale(%3Af%2C%20scale_type)%20*%203)%0A%20%20%0A%20%20cycle(humanize%3A%20true%2C%20probability%3A%200.2)%20do%0A%20%20%20%20play%20scale(%3Af6%2C%20scale_type).shuffle%0A%20%20end%0Aend)\n\n## Issues\n\n- Using `every` is pretty unstable at the moment, even more if you use it in combination with `expand`\n- Adding too much notes on a cycle causes the page to crash ( like doing `100.times do { play 30, 50, 60 }` )\n- Page crashes also when you have a lot of cycles and you hit the 'play' button to fast (fixing this soon™)\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/merongivian/negasonic.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerongivian%2Fnegasonic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmerongivian%2Fnegasonic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerongivian%2Fnegasonic/lists"}