Two wishes to Sonic Pi in Atom

Hi all

  1. I wish to be able to choose to disable the “run code” popup in Atom, so the visuals look more clean. I’m using sb-atom-sonic-pi
  2. I wish that the ll+TAB would work in Atom since I use it so much.
  3. Are there a similar shourtcut for “with_fx” in Sonic Pi or Atom?

Kind regards
Relaxnow

Late night practice session with Sonic Pi and images in Hydra

# 220519 2330 Late night practice session with Sonic Pi and images in Hydra
# My performance https://youtu.be/KxnoLALQTy8


# --- MIXER --- 0 STOP 1 PLAY ------#
#                 A  B  C  D
piano     = 1   # 1  1  1  0
bass      = 1   # 1  1  1  2           # bassriff 1-2 (2 needs more work)
synth_top = 1   # 0  0  1  0  _-^-_
drums     = 1   # 0  1  1  1
# ----------------------------------#


live_loop :time, delay: 0.01 do
  sleep 1
end


with_fx :reverb, room: 0.8 do

  live_loop :piano1, sync: :time do
    stop if piano <1

    case piano
    when 1
      synth :piano, note: :c2, vel: rrand(0.01,0.3), release: rrand(0.2,1), pan: -0.7 if spread(1,7).tick()
      synth :piano, note: :c4, vel: rrand(0.01,0.3), release: rrand(0.1,1), pan: 0.7 if spread(2,7).tick()
      synth :piano, note: :ds4, vel: rrand(0.01,0.3), release: rrand(0.1,1), pan: 0 if spread(3,7).tick()
      synth :piano, note: :g4, vel: rrand(0.01,0.3), release: rrand(0.1,1), pan: 0 if spread(4,7).tick() and one_in(4)
      sleep 0.25

    when 2
      #break(5,7)

      #synth :piano, play_chord [:c2, :c4], vel: rrand(0.01,0.3), release: rrand(0.2,1), pan: -0.7 if spread(5,7).tick()


      #synth :piano, note: :c4, vel: rrand(0.01,0.3), release: rrand(0.1,1), pan: 0.7 if spread(5,7).tick()
      synth :piano, note: :ds4, vel: rrand(0.01,0.3), release: rrand(0.1,1), pan: 0 if spread(5,7).tick()
      synth :piano, note: :g4, vel: rrand(0.01,0.3), release: rrand(0.1,1), pan: 0 if spread(2,7).tick() #and one_in(4)
      sleep 0.25

    end

  end

  live_loop :bass1, sync: :time do
    stop if bass <1
    case bass
    when 1
      notes= (knit :g2, 12, :gs2, 12, :f2, 6, :f1, 6, :g2, 12)
      synth :saw, cutoff: range(70,120,step: 1).reflect.tick(:r), note: notes.tick, release: 0.25 if spread(3,7).tick(:b)
    when 2
      notes= (knit :ds1, 12, :g1, 6, :g1, 6, :gs1, 6)  # needs more work
      notes= (knit :g1, 12, nil, 12+6)  # needs more work
      synth :saw, cutoff: range(70,120,step: 1).reflect.tick(:r), note: notes.tick(), release: 0.25, amp: 2 if spread(5,7).tick(:b)
    end
    sleep 0.25
  end

  live_loop :synthmelody1, sync: :time do
    stop if synth_top <1
    a = range(0.0,0.7,step: 0.02).reflect.tick(:a1)
    notes= (knit :g5, 64, :c5, 64)
    # :dsaw :tri
    synth :dsaw, cutoff: range(70,120,step: 1).reflect.tick(:r), note: notes.tick(:n1), release: 0.1,  amp: a
    sleep 0.25
  end

  live_loop :drums, sync: :time do
    stop if drums <1
    a = range(0.1,0.5,step: 0.02).reflect.tick(:a2)

    sample :bd_haus, cutoff: 80, amp: 2
    # OSC on kick
    sleep 0.5
    sample :bd_haus, cutoff: 80, amp: 2 if one_in(2)
    sleep 0.5
    synth :gnoise, note: :c3, amp: a, res: rrand(0.1,0.9), release: 0.25
    # OSC on snare
    sleep 1
  end

end  # end reverb

Hydra visuals - code with images

1 Like

Hey there @Relaxnow,

thanks for sharing your session - hopefully it inspires and empowers others to follow your footsteps :slight_smile:

With respect to Atom, this isn’t something we officially support, so for Atom-specific features, I can only recommend you bring those up with the maintainer of sb-atom-sonic-pi.

With respect to with_fx, with the official GUI, you can type with_fx and hit space and it will give you an autocomplete list of FX to use that you can work with. Again, if you’re focussing on using an exeternal editor such as Atom, then you need to ask the respective maintainer for features.

Have fun and please do keep on sharing your work with us here!

1 Like

Ty :slight_smile: and ty for an inspiring live coding environment.

Add 1+2)
I’ll try to contact the maintainer of the Atom plugin.

Add 3)
Idea: wf+TAB to insert

“with_fx do (with cursor placement after fx ready to press space to choose effect)
end”

Like the ll+TAB do with
“live_loop do
end”

Are there a place where I can see all the code snippets for Sonic Pi?

Ty = thank you

i translate for the oldest :slight_smile:

Cheers

1 Like

Hi @Relaxnow :slight_smile:
I’m the maintainer of sb-atom-sonic-pi. I’m glad that you’re finding it useful!

The list of all the snippets in the package can be found on the GitHub repo: sb-atom-sonic-pi/sonic-pi.cson at main · SunderB/sb-atom-sonic-pi · GitHub. I like the ideas for the short snippets for with_fx and live_loop, so I’ll look at adding those (maybe alng with some others) when I get the chance.

About the pop-ups, I could add an option to disable them. To be honest it wasn’t something I’d thought about as I actually haven’t used Sonic Pi for live coding much, but I see why this would be nice for performances. I’m currently busy with my studies so I’ll look into adding those when I have more spare time.

If you have any more suggestions, please feel free to open a discussion or issue on the GitHub repo :slight_smile:

3 Likes

Hey @SunderB! Apologies, I should have known you were the maintainer of sb-atom-sonic-pi :slight_smile: Hi!

1 Like

Hi @SunderB
Thank you for sb-atom-sonic-pi.
I find it so cool that we can use Sonic Pi in Atom and use Hydra as visuals.
It’s a really nice setup.
I’m super busy with exams aswell so no rush.
Kind regards
Relaxnow

1 Like

Hi @SunderB and @Relaxnow! Coming in late here, sorry. Might be worth noting that Sonic Pi already has a built-in expansion for a with_fx block: fx [tab]. Unfortunately it doesn’t work when it’s typed at the beginning of a line—it autocompletes to fx_names instead—but if you type a space, then fx, then press [tab], it should expand correctly.

There are also snippets for specific FX, which I always forget about. They’re defined here: sonic-pi/etc/snippets at dev · sonic-pi-net/sonic-pi · GitHub

2 Likes

I’ve updated the package to add the snippets and notification option. :slight_smile: However, I can’t seem to publish it to atom.io at the moment due to technical issues.

In the meantime, if you want you can install it via the terminal using the following command:

apm install SunderB/sb-atom-sonic-pi

This by-passes the package registry and installs the latest dev version from the GitHub repo.

1 Like

Hi @SunderB

Add 1)
I have installed the update and in settings of the package I can choose which UI notification level to use. It works great. Thanks.

Add 2)
I’m not sure how to get ll+TAB to work in Atom. I can see the snippets in the settings of the package.

@Relaxnow I’m glad the notifications option is useful :slight_smile:
For the snippets, check that the source language is set to Sonic Pi instead of Ruby. You can change this in the bottom bar:
image

1 Like

Thank you.
Just what I needed to learn.
I looking forward to playing with this.
:smiley: