- Notifications
You must be signed in to change notification settings - Fork3
This ain't Sonic Pi, but it works on the browser:https://negasonic.onrender.com/
License
merongivian/negasonic
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Ruby DSL for music live coding in the browser, you can play with it in theonline 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
You can use plain normal or midi notes
# playing a single noteplay42# multiple notesplay'E3',42# produces the same result as the aboveplay'E3'play42# Scales and chords (same as Sonic-pi)play(scale:c,:major)play(chord:d,:minor)
Under the hood we use a 'fixed' time for calculating notes durations, adding more notes orplay
statements will make durationsshorter. This happens because eachplay
happens inside acycle
. Acycle
's duration is around 3 seconds
# doing thisplay'E3'play42# is the same as thiscycledoplay'E3'play42end
If you want to play notes at the same time then use multiple cycles
cycledoplay'E3'endcycledoplay42end
Withwith_instrument
you can add a synthesizer and connect it with effects. Every instrument needsto have a name (for performance reasons)
# The order of the effects will affect the final soundwith_instrument(:drums,synth::membrane,fx:[:bit_crusher,:distortion])do# each instrument has its own cycle by defaultplay30play64end# multiple cycles can be used here as wellwith_instrument(:lead,synth::am,fx::freeverb,volume:3)docycledoplay(scale:c,:major)endcycledoplay(scale:c,:pelog)endend
It is possible to modify the default values for effects, you can do this trough thefx
block. Optionsfor each effect are detailed in theEffects section.
drum_effects=fxdobit_crusherbits:3distortionvalue:1.3endwith_instrument(:drums,synth::membrane,fx:drum_effects)do4.timesdoplay30play64endend
: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
:membrane
Use it as drums:simple
:am
:fm
:duo
:mono
:metal
:pluck
:poly
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 |
- Using
every
is pretty unstable at the moment, even more if you use it in combination withexpand
- 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™)
Bug reports and pull requests are welcome on GitHub athttps://github.com/merongivian/negasonic.
The gem is available as open source under the terms of theMIT License.
About
This ain't Sonic Pi, but it works on the browser:https://negasonic.onrender.com/