Code Monkey home page Code Monkey logo

negasonic's Introduction

Negasonic

Ruby DSL for music live coding in the browser, you can play with it in the online editor

DISCLAIMER: This is pretty alpha, so use with care if you plan to use it for real performances... Otherwise have fun!

Chat is available in gitter: nega-sonic/Lobby if you have any questions/suggestions

Usage

Playing Notes

You can use plain normal or midi notes

# playing a single note
play 42

# multiple notes
play 'E3', 42

# produces the same result as the above
play 'E3'
play 42

# Scales and chords (same as Sonic-pi)
play (scale :c, :major)
play (chord :d, :minor)

Cycle

Under the hood we use a 'fixed' time for calculating notes durations, adding more notes or play statements will make durations shorter. This happens because each play happens inside a cycle. A cycle's duration is around 3 seconds

# doing this
play 'E3'
play 42

# is the same as this
cycle do
  play 'E3'
  play 42
end

If you want to play notes at the same time then use multiple cycles

cycle do
  play 'E3'
end

cycle do
  play 42
end

Custom Instruments

With with_instrument you can add a synthesizer and connect it with effects. Every instrument needs to have a name (for performance reasons)

# The order of the effects will affect the final sound
with_instrument(:drums, synth: :membrane, fx: [:bit_crusher, :distortion]) do
  # each instrument has its own cycle by default
  play 30
  play 64
end

# multiple cycles can be used here as well
with_instrument(:lead, synth: :am, fx: :freeverb, volume: 3) do
  cycle do
    play (scale :c, :major)
  end

  cycle do
    play (scale :c, :pelog)
  end
end

Custom Effects

It is possible to modify the default values for effects, you can do this trough the fx block. Options for each effect are detailed in the Effects section.

drum_effects = fx do
  bit_crusher bits: 3
  distortion value: 1.3
end

with_instrument(:drums, synth: :membrane, fx: drum_effects) do
  4.times do
    play 30
    play 64
  end
end

Cycle options

  • :expand for a longer duration. Integer value
  • :every plays every 'nth'. For example this: cycle(every: 3) will play every third cycle. Integer value
  • :sustain reduce/augment the duration of notes. Float value between 0 and 1
  • :probability play or miss a note randomly. Float value between 0 and 1
  • :humanize boolean value

Synths

  • :membrane Use it as drums
  • :simple
  • :am
  • :fm
  • :duo
  • :mono
  • :metal
  • :pluck
  • :poly

Effects

Effects Options
vibrato :frequency, :depth
distortion :value
chorus :frequency, :delay_time, :depth
tremolo :frequency, :depth
feedback_delay :delay_time, :feedback
freeverb :room_size, :dampening
jc_reverb :room_size
phaser :frequency, :octaves, :base_frequency
ping_pong_delay :delay_time, :feedback
auto_wah :base_frequency, :octave, :sensitivity, :q
bit_crusher :bits
chebyshev :order
pitch_shift :pitch

Examples

Issues

  • Using every is pretty unstable at the moment, even more if you use it in combination with expand
  • Adding too much notes on a cycle causes the page to crash ( like doing 100.times do { play 30, 50, 60 } )
  • Page crashes also when you have a lot of cycles and you hit the 'play' button to fast (fixing this soonβ„’)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/merongivian/negasonic.

License

The gem is available as open source under the terms of the MIT License.

negasonic's People

Contributors

merongivian 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  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  avatar  avatar  avatar

negasonic's Issues

Wow. Still available?

Hi, this is ,,, stunning πŸ‘

How ?!
I've been looking for something like this for a while, is there any information available that you followed to develop?
Is it possible to clone and run this locally?

Very impressive, just found from your comment on a forum (and with wayback:)

Kudos!

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.