Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

This ain't Sonic Pi, but it works on the browser:https://negasonic.onrender.com/

License

NotificationsYou must be signed in to change notification settings

merongivian/negasonic

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

Usage

Playing Notes

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)

Cycle

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

Custom Instruments

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

Custom Effects

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

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

EffectsOptions
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

  • Usingevery 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 doing100.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 athttps://github.com/merongivian/negasonic.

License

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

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp