MIT License

项目介绍

merongivian/negasonic 是一个托管在 GitHub 上的开源项目,主要使用 Ruby 编写,采用 MIT License 许可证,目前获得 89 个 Star、3 次 Fork。

仓库全名
merongivian/negasonic
开源许可证
MIT License
Star 数
89
Fork 数
3
未关闭 Issue
2

README 摘要

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 Cycle Under the hood we use a 'fixed' time for calculating…

完整内容见 GitHub 原始 README 或本页 。

常见问题

negasonic 用什么语言开发?

主要使用 Ruby 编写,采用 MIT License 许可证,目前有 89 个 Star。

negasonic 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 negasonic 的源码?

可以直接克隆仓库:git clone https://github.com/merongivian/negasonic.git;安装与运行步骤见仓库 README。

negasonic 最近还在维护吗?

仓库最近一次更新为 2025年8月11日,当前有 2 个未关闭 Issue;Star 数为 89,可作为社区活跃度的参考。

关于

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

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
184
价值分
63
活跃状态
活跃

语言占比

Ruby
Shell

贡献者

README

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.

评论

暂无评论