Coder Social home page Coder Social logo

sonic-pi-net / sonic-pi Goto Github PK

View Code? Open in Web Editor NEW
10.5K 296.0 904.0 367.84 MB

Code. Music. Live.

Home Page: https://sonic-pi.net

License: Other

HTML 10.64% Clojure 3.03% JavaScript 0.19% CSS 0.39% C 3.47% C++ 66.10% Ruby 12.81% Shell 0.28% Scheme 0.01% Batchfile 0.06% LilyPond 0.01% Erlang 0.72% SuperCollider 0.81% CMake 0.37% XSLT 0.02% Python 0.14% Objective-C++ 0.01% QMake 0.17% Elixir 0.77%
livecoding music education schools synthesis synthesizer instrument live-coding art audio

sonic-pi's Introduction

                                       ╘
                                ─       ╛▒╛
                                 ▐╫       ▄█├
                          ─╟╛      █▄      ╪▓▀
                ╓┤┤┤┤┤┤┤┤┤  ╩▌      ██      ▀▓▌
                 ▐▒   ╬▒     ╟▓╘    ─▓█      ▓▓├
                 ▒╫   ▒╪      ▓█     ▓▓─     ▓▓▄
                ╒▒─  │▒       ▓█     ▓▓     ─▓▓─
                ╬▒   ▄▒ ╒    ╪▓═    ╬▓╬     ▌▓▄
                ╥╒   ╦╥     ╕█╒    ╙▓▐     ▄▓╫
                           ▐╩     ▒▒      ▀▀
                                ╒╪      ▐▄

             _____             __        ____  __
            / ___/____  ____  /_/____   / __ \/_/
            \__ \/ __ \/ __ \/ / ___/  / /_/ / /
           ___/ / /_/ / / / / / /__   / ____/ /
          /____/\____/_/ /_/_/\___/  /_/   /_/

Code. Music. Live.

Sonic Pi is a new kind of musical instrument. Instead of strumming strings or whacking things with sticks - you write code - live.

Sonic Pi has been designed with the aim to find a harmonious balance between three core principles:

  • Simple enough for the 10 year old within you
  • Joyful enough for you to lose yourself through play
  • Powerful enough for your own expressions

Sonic Pi is a complete open source programming environment originally designed to explore and teach programming concepts within schools through the process of creating new sounds.

In addition to being an engaging education resource it has evolved into an extremely powerful and performance-ready live coding instrument suitable for professional artists and DJs.

Whilst Education is a core focus it now sits at the intersection between three core domains:

  • Art - providing the means to express yourself and ask new questions of music and notation
  • Technology - exploring questions related to liveness, time and concurrency in programming languages
  • Education - demonstrating that open play rather than rigid structures increases motivation and engagement in the classroom

Again, finding a balance working to the best benefits of all these domains is the objective.

Contributors

Sonic Pi has been developed with support from many individuals and organisations. Please see the CONTRIBUTORS.md file for a more complete list.

Translations

Sonic Pi's application and built in tutorial have been translated into several languages thanks to the awesome work of several volunteer translators:

Status Language Application Tutorial
Translation Status of Sonic Pi: da Danish 🔴
Translation Status of Sonic Pi: nl Dutch
Translation Status of Sonic Pi: fi Finnish 🔴
Translation Status of Sonic Pi: fr French
Translation Status of Sonic Pi: de German
Translation Status of Sonic Pi: hu Hungarian 🔴
Translation Status of Sonic Pi: is Icelandic 🔴
Translation Status of Sonic Pi: it Italian
Translation Status of Sonic Pi: ja Japanese
Translation Status of Sonic Pi: nb Norwegian Bokmål
Translation Status of Sonic Pi: pl Polish
Translation Status of Sonic Pi: pt Portuguese 🔴
Translation Status of Sonic Pi: ro Romanian
Translation Status of Sonic Pi: ru Russian
Translation Status of Sonic Pi: zh_Hans Simplified Chinese 🔴
Translation Status of Sonic Pi: es Spanish
Translation Status of Sonic Pi: si sinhalese 🔴
Translation Status of Sonic Pi: tr_TR Turkish 🔴

Would you like to contribute a translation too? If so, please take a look at our translation docs to get started.

Information for developers

Sonic Pi is under active development, and welcomes new contributors:

Weblate
Travis CI

sonic-pi's People

Contributors

cindydal avatar cmaughan avatar contesselina avatar emlyn avatar ethancrawford avatar factoid avatar federico-pepe avatar georgiaolympia avatar hopbit avatar hzulla avatar josephwilk avatar jweather avatar kn1kn1 avatar lilyinstarlight avatar llloret avatar maurofigueira avatar mk270 avatar mpatrascu avatar mrtheyann avatar nicoder avatar paubarrina avatar rbnpi avatar richcarl avatar samaaron avatar sunderb avatar thraex41 avatar trebmuh avatar verbgio avatar weblate avatar xavriley 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

sonic-pi's Issues

Add ability for play lists

To play a sequence sonic-pi -f filename1,finename2, filename3...etc
The same could be done with a command to play all populated workspaces one after the other.

Qt GUI not installing on OSX

I'm aware you're only supporting the Pi for now, but if you get the chance to look at this...

[21:41:14] xavierriley:sonic-pi git:(master*) $ app/gui/qt/bootstrap-qt
++ dirname app/gui/qt/bootstrap-qt
+ cd app/gui/qt
+ cp -f ruby_help.tmpl ruby_help.h
+ ../../server/bin/qt-doc.rb -o ruby_help.h
+ qmake -o Makefile application.pro
+ set +x
clang++ -c -pipe -O2 -arch x86_64 -Wall -W -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Cellar/qt/4.8.6/mkspecs/unsupported/macx-clang -I. -I/usr/local/Cellar/qt/4.8.6/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.6/include -I. -F/usr/local/Cellar/qt/4.8.6/lib -o mainwindow.o mainwindow.cpp
mainwindow.cpp:47:10: fatal error: 'Qsci/qsciapis.h' file not found
#include <Qsci/qsciapis.h>
         ^
1 error generated.
make: *** [mainwindow.o] Error 1

I installed qt with brew install qt --developer and brew linkapps

Any ideas on why I'm getting the above error?

Sonic Pi v2.0 silently fails and refuses to play without restart

I know this is a vague issue report but I wanted to raise it before a release gets put out. I was looking at coding some "chiptune" and tried implementing the mario theme based on the NES's original sound chip (4 synths - 2 x pulse, 1 x triangle, 1 x noise). When I'm working on the following code, the QT app (SonicPi v2.0 RC 11 on OSX) stops working when I hit play and refuses to make any more sound until I restart the app. I've not had a chance to debug further yet but I will see if I can replicate using the web interface and get some details from the server. Steps to reproduce: play and stop the following code several times and wait until it no longer works:

# Mario theme transcribed from the MML notation here: http://www.mmlshare.com/tracks/view/403
use_bpm 100

in_thread(name: :pulse_A) do
  use_synth :pulse_s
  use_synth_defaults release: 0.2, mod_rate: 5

  play_pattern_timed([:e5,:e5,nil,:e5,nil,:c5,:e5,nil,
                      :g5,nil,nil,nil,nil,nil,nil,nil], [0.25])

  2.times {
    play_pattern_timed([:c5,nil,nil,:g4,nil,nil,:e4,nil,
                        nil,:a4,nil,:b4,nil,:Bb4,:a4,nil], [0.25])
    play_pattern_timed([:g4,:e5,:g5], [1/3.0]) # minim triplets
    play_pattern_timed([:a5,nil,:f5,:g5,
                        nil,:e5,nil,:c5,
                        :d5,:b4,nil,nil], [0.25]) }
  2.times {
    play_pattern_timed([nil,nil,:g5,:fs5,:f5,:ds5,nil,:e5,
                        nil,:gs4,:a4,:c5,nil,:a4,:c5,:d5,
                        nil,nil,:g5,:fs5,:f5,:ds5,nil,:e5,
                        nil,:c6,nil,:c6,:c6,nil,nil,nil,
                        nil,nil,:g5,:fs5,:f5,:ds5,nil,:e5,
                        nil,:gs4,:a4,:c5,nil,:a4,:c5,:d5,
                        nil,nil,:ds5,nil,nil,:d5,nil,nil,
                        :c5,nil,nil,nil,nil,nil,nil,nil], [0.25])}

  play_pattern_timed([:c5,:c5,nil,:c5,nil,:c5,:d5,nil,
                      :e5,:c5,nil,:a4,:g4,nil,nil,nil,
                      :c5,:c5,nil,:c5,nil,:c5,:d5,:e5,
                      nil,nil,nil,nil,nil,nil,nil,nil,
                      :c5,:c5,nil,:c5,nil,:c5,:d5,nil,
                      :e5,:c5,nil,:a4,:g4,nil,nil,nil,
                      :e5,:e5,nil,:e5,nil,:c5,:e5,nil,
                      :g5,nil,nil,nil,nil,nil,nil,nil], [0.25])

  2.times {
    play_pattern_timed([:c5,nil,nil,:g4,nil,nil,:e4,nil,
                        nil,:a4,nil,:b4,nil,:Bb4,:a4,nil], [0.25])
    play_pattern_timed([:g4,:e5,:g5], [1/3.0]) # minim triplets
    play_pattern_timed([:a5,nil,:f5,:g5,
                        nil,:e5,nil,:c5,
                        :d5,:b4,nil,nil], [0.25]) }

  2.times {
    play_pattern_timed([:e5,:c5,nil,:g4,nil,nil,:gs4,nil,
                        :a4,:f5,nil,:f5,:a4,nil,nil,nil], [0.25])
    play_pattern_timed([:b4,:a5,:a5,
                        :a5,:g5,:f5], [1/3.0]) # minim triplets
    play_pattern_timed([:e5,:c5,nil,:a4,:g4,nil,nil,nil], [0.25])
    play_pattern_timed([:e5,:c5,nil,:g4,nil,nil,:gs4,nil,
                        :a4,:f5,nil,:f5,:a4,nil,nil,nil,
                        :b4,:f5,nil,:f5], [0.25])
    play_pattern_timed([:f5,:e5,:d5], [1/3.0]) # minim triplets
    play_pattern_timed([:g4,:e4,nil,:e4,:c4,nil,nil,nil], [0.25]) }

  play_pattern_timed([:c5,:c5,nil,:c5,nil,:c5,:d5,nil,
                    :e5,:c5,nil,:a4,:g4,nil,nil,nil,
                    :c5,:c5,nil,:c5,nil,:c5,:d5,:e5,
                    nil,nil,nil,nil,nil,nil,nil,nil,
                    :c5,:c5,nil,:c5,nil,:c5,:d5,nil,
                    :e5,:c5,nil,:a4,:g4,nil,nil,nil,
                    :e5,:e5,nil,:e5,nil,:c5,:e5,nil,
                    :g5,nil,nil,nil,nil,nil,nil,nil], [0.25])

  play_pattern_timed([:e5,:c5,nil,:g4,nil,nil,:gs4,nil,
                      :a4,:f5,nil,:f5,:a4,nil,nil,nil], [0.25])
  play_pattern_timed([:b4,:a5,:a5,
                      :a5,:g5,:f5], [1/3.0]) # minim triplets
  play_pattern_timed([:e5,:c5,nil,:a4,:g4,nil,nil,nil], [0.25])
  play_pattern_timed([:e5,:c5,nil,:g4,nil,nil,:gs4,nil,
                      :a4,:f5,nil,:f5,:a4,nil,nil,nil,
                      :b4,:f5,nil,:f5], [0.25])
  play_pattern_timed([:f5,:e5,:d5], [1/3.0]) # minim triplets
  play_pattern_timed([:g4,:e4,nil,:e4,:c4,nil,nil,nil], [0.25])
end

in_thread(name: :pulse_B) do
  use_synth :pulse_s
  use_synth_defaults release: 0.2, mod_rate: 5

  play_pattern_timed([:fs4,:fs4,nil,:fs4,nil,:fs4,:fs4,nil,
                      :b4,nil,nil,nil,:g4,nil,nil,nil], [0.25])

  # B L [e w4 c w4 <g w4 >c w d w c+ c w c6 g6 b6 >c w <a b w a w e f d w4]2
  # B [w4 >e d+ d <b w >c w <e f g w c e f w4 >e d+ d <b w >c w f w f f w4 w w4 e d+ d <b w >c w <e f g w c e f w4 g+ w4 f w4 e w4 w w2]2
  # B g+ g+ w g+ w g+ a+ w g e w e c w4 w g+ g+ w g+ w g+ a+ g w2 w2 g+ g+ w g+ w g+ a+ w g e w e c w4 w f+ f+ w f+ w f+ f+ w b w w4 g w w4
  2.times {
    play_pattern_timed([:e4,nil,nil,:c4,nil,nil,:g3,nil,
                        nil,:c4,nil,:d4,nil,:Db4,:c4,nil], [0.25])
    play_pattern_timed([:c4,:g4,:b4], [1/3.0])
    play_pattern_timed([:c5,nil,:a4,:b4,
                        nil,:a4,nil,:e4,
                        :f4,:d4,nil,nil], [0.25])
  }
  2.times {
    play_pattern_timed([nil,nil,:e5,:ds5,:d5,:b4,nil,:c5,
                        nil,:e4,:f4,:g4,nil,:c4,:e4,:f4,
                        nil,nil,:e5,:ds5,:d5,:b4,nil,:c5,
                        nil,:f5,nil,:f5,:f5,nil,nil,nil,
                        nil,nil,:e5,:ds5,:d5,:b4,nil,:c5,
                        nil,:e4,:f4,:g4,nil,:c4,:e4,:f4,
                        nil,nil,:gs4,nil,nil,:f4,nil,nil,
                        :e4,nil,nil,nil,nil,nil,nil,nil], [0.25])}

  play_pattern_timed([:gs4,:gs4,nil,:gs4,nil,:gs4,:as4,nil,
                      :g4,:e4,nil,:e4,:c4,nil,nil,nil,
                      :gs4,:gs4,nil,:gs4,nil,:gs4,:as4,:g4,
                      nil,nil,nil,nil,nil,nil,nil,nil,
                      :gs4,:gs4,nil,:gs4,nil,:gs4,:as4,nil,
                      :g4,:e4,nil,:e4,:c4,nil,nil,nil,
                      :fs4,:fs4,nil,:fs4,nil,:fs4,:fs4,nil,
                      :b4,nil,nil,nil,:g4,nil,nil,nil], [0.25])

  2.times {
    play_pattern_timed([:e4,nil,nil,:c4,nil,nil,:g3,nil,
                        nil,:c4,nil,:d4,nil,:Db4,:c4,nil], [0.25])
    play_pattern_timed([:c4,:g4,:b4], [1/3.0])
    play_pattern_timed([:c5,nil,:a4,:b4,
                        nil,:a4,nil,:e4,
                        :f4,:d4,nil,nil], [0.25])
  }

  2.times {
    play_pattern_timed([:c5,:a4,nil,:e4,nil,nil,:e4,nil,
                        :f4,:c5,nil,:c5,:f4,nil,nil,nil], [0.25])
    play_pattern_timed([:g4,:f5,:f5,
                        :f5,:e5,:d5], [1/3.0]) # minim triplets
    play_pattern_timed([:c5,:a4,nil,:f4,:e4,nil,nil,nil], [0.25])
    play_pattern_timed([:c5,:a4,nil,:e4,nil,nil,:e4,nil,
                        :f4,:c5,nil,:c5,:f4,nil,nil,nil,
                        :g4,:d5,nil,:d5], [0.25])
    play_pattern_timed([:d5,:c5,:b4], [1/3.0]) # minim triplets
    play_pattern_timed([:c5,nil,nil,nil,nil,nil,nil,nil], [0.25]) }

  play_pattern_timed([:gs4,:gs4,nil,:gs4,nil,:gs4,:as4,nil,
                      :g4,:e4,nil,:e4,:c4,nil,nil,nil,
                      :gs4,:gs4,nil,:gs4,nil,:gs4,:as4,:g4,
                      nil,nil,nil,nil,nil,nil,nil,nil,
                      :gs4,:gs4,nil,:gs4,nil,:gs4,:as4,nil,
                      :g4,:e4,nil,:e4,:c4,nil,nil,nil,
                      :fs4,:fs4,nil,:fs4,nil,:fs4,:fs4,nil,
                      :b4,nil,nil,nil,:g4,nil,nil,nil], [0.25])

  play_pattern_timed([:c5,:a4,nil,:e4,nil,nil,:e4,nil,
                      :f4,:c5,nil,:c5,:f4,nil,nil,nil], [0.25])
  play_pattern_timed([:g4,:f5,:f5,
                      :f5,:e5,:d5], [1/3.0]) # minim triplets
  play_pattern_timed([:c5,:a4,nil,:f4,:e4,nil,nil,nil], [0.25])
  play_pattern_timed([:c5,:a4,nil,:e4,nil,nil,:e4,nil,
                      :f4,:c5,nil,:c5,:f4,nil,nil,nil,
                      :g4,:d5,nil,:d5], [0.25])
  play_pattern_timed([:d5,:c5,:b4], [1/3.0]) # minim triplets
  play_pattern_timed([:c5,nil,nil,nil,nil,nil,nil,nil], [0.25]) 
end

# C d d r d r d d r >g r w4 <g r w4
# C L [g w4 e w4 c w4 f w g w f+ f w @q4 e6 >c6 e6 @q1 f w d e w c w <a b g w4]2
# C [c w4 g w4 >c w <f w4 >c c w <f w c w4 e w4 g >c w >g w g g w <<g w c w4 g w4 >c w <f w4 >c c w <f w c w g+ w4 a+ w4 >c w4 <g g w c w]2
# C [<g+ w4 >d+ w4 g+ w g w4 c w4 <g w]3 >d d r d r d d r >g r w4 <g r w4
# C [g w4 e w4 c w4 f w g w f+ f w @q4 e6 >c6 e6 @q1 f w d e w c w <a b g w4]2

in_thread(name: :triangle_C) do
  use_synth :tri_s

  # intro
  play_pattern_timed([:D4,:D4,nil,:D4,nil,:D4,:D4,nil,
                      :G3,nil,nil,nil,:G4,nil,nil,nil], [0.25])

  2.times {
    play_pattern_timed([:G4,nil,nil,:E4,nil,nil,:C4,nil,
                        nil,:F4,nil,:G4,nil,:Gb4,:F4,nil], [0.25])
    play_pattern_timed([:E4,:C4,:E4], [1/3.0])
    play_pattern_timed([:F4,nil,:D4,:E4,
                        nil,:C4,nil,:A3,
                        :B3,:G3,nil,nil], [0.25])
  }

  2.times {
    play_pattern_timed([:C3,nil,nil,:G3,nil,nil,:C3,nil,
                        :F3,nil,nil,:C3,:C3,nil,:F3,nil,
                        :C3,nil,nil,:E3,nil,nil,:G3,:C3,
                        nil,:G2,nil,:G2,:G2,nil,:G4,nil,
                        :C3,nil,nil,:G3,nil,nil,:C3,nil,
                        :F3,nil,nil,:C3,:C3,nil,:F3,nil,
                        :C3,nil,:Ab3,nil,nil,:Bb3,nil,nil,
                        :C3,nil,nil,:G2,:G2,nil,:C3,nil], [0.25])
  }

  3.times {
    play_pattern_timed([:gs4,nil,nil,:ds4,nil,nil,:gs4,nil,
                        :g4,nil,nil,:c4,nil,nil,:g4,nil], [0.25])
  }
  play_pattern_timed([:D4,:D4,nil,:D4,nil,:D4,:D4,nil,
                      :G3,nil,nil,nil,:G4,nil,nil,nil], [0.25])

  2.times {
    play_pattern_timed([:G4,nil,nil,:E4,nil,nil,:C4,nil,
                        nil,:F4,nil,:G4,nil,:Gb4,:F4,nil], [0.25])
    play_pattern_timed([:E4,:C4,:E4], [1/3.0])
    play_pattern_timed([:F4,nil,:D4,:E4,
                        nil,:C4,nil,:A3,
                        :B3,:G3,nil,nil], [0.25])
  }

  # C [c w4 f+ g w >c w <f w f w >c c <f w d w4 f g w b w g w g w >c c <g w
  #    c w4 f+ g w >c w <f w f w >c c <f w
  #    g w4 g @q4 g6 a6 b6 @q1 >c w <g w c w4 w]2
  2.times {
    play_pattern_timed([:C3,nil,nil,:fs3,:g3,nil,:C3,nil,
                        :F3,nil,:F3,nil,:C3,:C3,:F3,nil,
                        :D3,nil,nil,:F3,:G3,nil,:B3,nil,
                        :G3,nil,:G3,nil,:C3,:C3,:G3,nil,
                        :C3,nil,nil,:fs3,:g3,nil,:C3,nil,
                        :F3,nil,:F3,nil,:C3,:C3,:F3,nil,
                        :G3,nil,nil,:G3], [0.25])
    play_pattern_timed([:G3,:A3,:B3], [1/3.0]) # minim triplets
    play_pattern_timed([:C4,nil,:G3,nil,:C4,nil,nil,nil], [0.25])
  }

  3.times {
    play_pattern_timed([:gs4,nil,nil,:ds4,nil,nil,:gs4,nil,
                        :g4,nil,nil,:c4,nil,nil,:g4,nil], [0.25])
  }
  play_pattern_timed([:D4,:D4,nil,:D4,nil,:D4,:D4,nil,
                      :G3,nil,nil,nil,:G4,nil,nil,nil], [0.25])

  1.times {
    play_pattern_timed([:C3,nil,nil,:fs3,:g3,nil,:C3,nil,
                        :F3,nil,:F3,nil,:C3,:C3,:F3,nil,
                        :D3,nil,nil,:F3,:G3,nil,:B3,nil,
                        :G3,nil,:G3,nil,:C3,:C3,:G3,nil,
                        :C3,nil,nil,:fs3,:g3,nil,:C3,nil,
                        :F3,nil,:F3,nil,:C3,:C3,:F3,nil,
                        :G3,nil,nil,:G3], [0.25])
    play_pattern_timed([:G3,:A3,:B3], [1/3.0]) # minim triplets
    play_pattern_timed([:C4,nil,:G3,nil,:C4,nil,nil,nil], [0.25])
  }
end

in_thread(name: :noise_D) do
  use_synth :fm
  use_synth_defaults divisor: 1.6666, attack: 0.0, depth: 1500, sustain: 0.05, release: 0.0

  define :drum_pattern_a do
    play :a, sustain: 0.1
    sleep 0.5
    play :a
    sleep 0.25
    play :a, sustain: 0.1
    sleep 0.5
    play :a
    sleep 0.25
    play :a, sustain: 0.1
    sleep 0.5
    play :a, sustain: 0.1
    sleep 0.75
    play :a, sustain: 0.1
    sleep 0.5
    play :a
    sleep 0.25
    play :a
    sleep 0.25
    play :a
    sleep 0.25
  end

  define :drum_pattern_b do
    # D L [@v1 b w d6 d12 @v2 d w @v1 d6 d12 ]24
    play :b
    sleep 0.5
    play :a6
    sleep 0.25
    play :a7
    sleep 0.25
    play :a, sustain: 0.1
    sleep 0.5
    play :a6
    sleep 0.25
    play :a7
    sleep 0.25
  end

  define :drum_pattern_c do
    # D [@v1 d w4 d @v2 d w @v1 d w]16
    play :a
    sleep 0.75
    play :a
    sleep 0.25
    play :a, sustain: 0.1
    sleep 0.5
    play :a
    sleep 0.5
  end

  with_fx :level, amp: 0.6 do
    1.times  { drum_pattern_a }
    24.times { drum_pattern_b }
    4.times  { drum_pattern_a }
    8.times  { drum_pattern_b }
    16.times { drum_pattern_c }
    4.times  { drum_pattern_a }
    8.times  { drum_pattern_b }
  end
end

Using sonic pi remotely

When using sonic-pi remotely I observed that the play_pad command will not work with the mouse at the remote X-terminal. Outside class rooms headless Pis are quite common, you know.

Second: when "playing" or "stopping" a script I can actually see the color change in the editor beeing painted line by line instead of a rectangle. I can not guess how deep this inefficiency is burried in the Ruby-GUI framework that you use. But could be easy to fix. Or is this a desired effect?

sonic pi v2 not playing

Hi,
I had Sonic-pi v1 making sound and then installed v2 and when i boot it i get no sound and sometimes it hangs 'waiting for server...'

it would be great to working with v2!
thanks,
david

Usage of QProcess

The c++ compiler spits out some warnings. In mainwindow.cpp you should pass "this" representing the main window to QProcess instead of the uninitialized QParent* that you use.

taking input from a 'data file'

Brilliant tool - good work!

Scenario:
I want to process a data file (time stamped stream of numbers) grabbed (perhaps) via http or an IP socket and have sonic_pi 'audiolise' it. The streams represent a number of different entities (e.g. households) observed over time - typically every second. There will be n observations per second where n = the number of entities observed.

Feature needed:
Issue #20 would do this if I pre-processed the data into a play file but I have real time data which I'd like sonic_pi to play out on the fly. Also the data files are too big for a rpi to hold (typically several Gb) - so the play files would be too (?). Hence suggestion to play a minimally buffered stream out in real (or faster/slower) time. The feature may also require some maths/text manipulation features - e.g. to split lines and strings etc.

many thanks
Ben

importing samples

Is it possible that additional samples can be added to the existing Sonic Pi structure, I have tried this in a small way by placing them in the samples directory in etc, whilst this is effective it does not get listed in the help tabs, so constant vigilance is required when referencing sample names used.

If there is a means to import samples not directly supported by Sonic pi could someone please enlighten me as to how? I do think I would like or prefer to be able to reference these samples from a different directory than the ones Sonic Pi uses both to keep separate and so I manage into categories and not have to maintain an open file manager that lists only the sample file names.

CPU usage

sonic-pi, the synth and jackd create between 10% and 40% of cpu usage even when no script runs.

in_thread, Can't keep up

Hi,

I am trying the in_thread function from the second last example from Magpi issue 23.
It was running fine at first, but after some time the tune is out of sync and there's a message "Can't keep up..." on the output log

Does anybody have any idea what causes it?
Thanks.

Sonic 2 play_pattern & play_pattern_timed

The addition of play parameters such as attack or release results in only the first note of the pattern being played repeatedly.

play_pattern [60, 62, 64, 65, 62, 64, 60], attack : 0.7

will play 60 seven times.

Compilation fails on commit b707c8f82

commit b707c8f
Author: Sam Aaron [email protected]
Date: Tue Jun 24 08:28:28 2014 +0100

./bootstrap-qt
++ dirname ./bootstrap-qt

  • cd .
  • cp -f ruby_help.tmpl ruby_help.h
  • ../../server/bin/qt-doc.rb -o ruby_help.h
    /usr/lib/ruby/1.9.1/fileutils.rb:247:in mkdir': No such file or directory - /home/derek/sonic-pi/app/server/app/gui/qt/help (Errno::ENOENT) from /usr/lib/ruby/1.9.1/fileutils.rb:247:infu_mkdir'
    from /usr/lib/ruby/1.9.1/fileutils.rb:176:in block in mkdir' from /usr/lib/ruby/1.9.1/fileutils.rb:175:ineach'
    from /usr/lib/ruby/1.9.1/fileutils.rb:175:in mkdir' from ../../server/bin/qt-doc.rb:30:in'

I have notice at least one file missing in /apps/gui/qt directory help_file.qrc but replacing this does not correct compilation error. Also the path has concatenated both app/server/bin & app/gui/qt/help so of course cannot find file or directory. Sorry do not know how to fix else i would give it a try.

current_tempo not working?

with tempo 200
play_pattern [60,64,67,72]
with_tempo current_tempo * 2
play_pattern [60,64,67,72]

doesn't work, although example in the API cheat sheet

changing to with_tempo current_tempo * 400 does something but not what expected

Sonic Pi 2 freezes on Title Screen

Just downloaded and run Sonic Pi 2.0 following instructions on website. The first issue was a missing lib file: libqscintilla2 which I downloaded separately using version 2-8. Now the title screen loads but just hangs on it.

I am running bog standard Raspian via Noobs and have updated and upgraded it today.

Any ideas, things to try?

Missing image files

I have been trying the latest development version by building inside app/gui/qt and have found that it complains about the missing files: new.png, copy.png, cut.png, paste,png and open.png. Are these files still required or have they been accidentally left in the Makefile? When I create files with these names it builds and runs but the images I created don't seem to appear anywhere.

Sample duration raises an Error with a negative rate

sample :loop_amen, rate: -1
sleep sample_duration(:loop_amen, rate: -1)

raises the following

Error: Timing Exception: thread got too far behind time
/Applications/SonicPi.app/app/server/sonicpi/spider.rb:336:in `eval'
(eval):3:in `block in __spider_eval'
/Applications/SonicPi.app/app/server/sonicpi/spider.rb:336:in `eval'
/Applications/SonicPi.app/app/server/sonicpi/spider.rb:336:in `block in __spider_eval'

which is not really surprising.

Is it worth calling .abs on rate or is this an occasion where it should raise an error?

play_pads not stopping

I noticed today whilst playing with Sonic Pi that the pads don't stop when you hit the stop button.

I used:

play_pad "woah", 56
control_pad "note", 57

They play correctly and mouse movement affects the sound as it should do and the stop button does stop the mouse movement affecting the sound but not the sound itself. It continues until you exit the sonic pi application.

freeze on startup

It looks like the server depends on native code, and 32bit x86 isn't supported?

mk270@cornford ~/Src/sonic-pi/app/server/bin> ./sonic-pi-server.rb
/home/mk270/Src/sonic-pi/app/server/vendor/rugged/lib/rugged.rb:8:in require_relative': cannot load such file -- /home/mk270/Src/sonic-pi/app/server/rb-native/i686-linux/1.9.3/rugged (LoadError) from /home/mk270/Src/sonic-pi/app/server/vendor/rugged/lib/rugged.rb:8:inrescue in <top (required)>'
from /home/mk270/Src/sonic-pi/app/server/vendor/rugged/lib/rugged.rb:1:in <top (required)>' from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require' from /home/mk270/Src/sonic-pi/app/server/sonicpi/gitsave.rb:14:in<top (required)>'
from /home/mk270/Src/sonic-pi/app/server/sonicpi/spider.rb:25:in require_relative' from /home/mk270/Src/sonic-pi/app/server/sonicpi/spider.rb:25:in<top (required)>'
from ./sonic-pi-server.rb:20:in require_relative' from ./sonic-pi-server.rb:20:in

'
mk270@cornford ~/Src/sonic-pi/app/server/bin> less sonic-pi-server.rb
mk270@cornford ~/Src/sonic-pi/app/server/bin> less /home/mk270/Src/sonic-pi/app/server/rb-native/i686-linux/1.9.3/rugged
/home/mk270/Src/sonic-pi/app/server/rb-native/i686-linux/1.9.3/rugged: No such file or directory
mk270@cornford ~/Src/sonic-pi/app/server/bin> less /home/mk270/Src/sonic-pi/app/server/rb-native/
arm-linux-eabihf/ universal.x86_64-darwin13/ x86_64-darwin13.1.0/

Auto stop after about 4 minutes

I wrote a script that looped indefinitely, and after about 4 minutes it seemed to auto stop. I didn't time it exactly as I was surprised the first time it happened, but it seemed repeatable.

something like:

in_thread do
loop do
play 65
sleep 0.5
end
end

If using the package for live music production, this could be a tad embarassing if it stopped too soon ;-)

refusing to start

I start using the command ./sonic-pi/bin/sonic-pi
The front panel opens (Version 2.0 in rh bottom corner

however the lxterminal has the message
QGtkStyle was unable to detect the current GTK+ theme
starting OSC Serverruby /home/pi/sonic-pi ...... some stuff..... /start-server.rb
listening on port 4558

it then just waits .....I guess I may have done something wrong

Connection Refused

Hi,

Whenever I booted up sonic-Pi and tried to play a sound, it always said:

/opt/sonic-pi/app/scripts/vendor/osc-ruby/lib/osc-ruby/client.rb:10:in `send’: Connection

refused – send(2) (Errno::ECONNREFUSED)
from /opt/sonic-pi/app/scripts/vendor/osc-ruby/lib/osc-ruby/client.rb:10:in send’ from /opt/sonic-pi/app/gui/../../app/scripts/run-code.rb:180:inblock in osc’
from :10:in synchronize’ from /opt/sonic-pi/app/gui/../../app/scripts/run-code.rb:178:inosc’
from /opt/sonic-pi/app/gui/../../app/scripts/run-code.rb:149:in clear_scsynth’ from /opt/sonic-pi/app/gui/../../app/scripts/run-code.rb:132:inreset_scsynth!’
from /opt/sonic-pi/app/gui/../../app/scripts/run-code.rb:41:in initialize’ from /opt/sonic-pi/app/gui/../../app/scripts/run-code.rb:225:innew’
from /opt/sonic-pi/app/gui/../../app/scripts/run-code.rb:225:in initialize’ from /opt/sonic-pi/app/gui/../../app/scripts/run-code.rb:320:innew’
from /opt/sonic-pi/app/gui/../../app/scripts/run-code.rb:320:in `’

However, yesterday, it suddenly started working, but now it doesn't again!
I'll be at the Junction workshop in Cambridge today, so maybe we could have a quick talk about it then?

I love this idea, and really want ot use it!

Thanks,
Finnian

"Error: Timing Exception: thread got too far behind time" [RC10]

Running your final demo from CamRJam.

define :foo do
use_synth :dsaw
sample :drum_heavy_kick, rate: rrand(0.4, 2)
play chord(:a3, :minor).choose, cutoff: rrand(50,100), release: 0.2, attack: 0
sleep 0.125
end

loop{foo}

Output window initally reports:
[Run 1, Time 1.75]
|- Timing warning: running slightly behind...
|- sample :drum_heavy_kick, {rate: 1.235}
+- synth :dsaw, {cutoff: 70.7331, release: 0.2, attack: 0, note: 57}

Followed by:
[Run 1, Time 2.875]
|- Timing error: can't keep up...
|- sample :drum_heavy_kick, {rate: 0.7366}
+- synth :dsaw, {cutoff: 56.4463, release: 0.2, attack: 0, note: 60}

Diagnostic window contains:

Error: Timing Exception: thread got too far behind time
/home/pi/sonic-pi/app/server/sonicpi/spider.rb:336:in eval' (eval):7:inblock (2 levels) in __spider_eval'
(eval):10:in block (2 levels) in __spider_eval' (eval):10:inloop'
(eval):10:in block in __spider_eval' /home/pi/sonic-pi/app/server/sonicpi/spider.rb:336:ineval'
/home/pi/sonic-pi/app/server/sonicpi/spider.rb:336:in `block in __spider_eval'

As previously discussed, this is on a 'headless' RPi running Jan'14 Raspbian accessed via ssh from a Win PC running PuTTy as the ssh client and XMing as the Xwindows server.

Maybe it is simply asking too much of the RPi to run SonicPi and drive the ssh-encrypted network stack for Xwindows at the same time?

If SonicPi can't usefully be used in this mode perhaps a note somewhere to that effect would save dissappointment/frustration?

Multiple users

Looking through the code, from what I can see, there is no check to see if the workspaces exist. They are of course automatically added when it is installed, but what about when there is more than 1 user using the single SD card. It means when I launch sonic pi on a Raspberry Pi set up with the multiuser system I have been working on ( https://github.com/gbaman/RaspberryPi-LTSP ), Sonic Pi is one of the few applications that does not correctly work. I get a pile of errors complaining about how workspaces don't exist.

Perhaps it should check on start if the files exist, if they don't, running
https://github.com/samaaron/sonic-pi/blob/95b954f97c48f9bbe524bc07e00020dd90dba09e/app/scripts/ensure-workspaces.rb

Shouldn't cause any issues for normal users and would fix a lot with multiuser setups

Add modified play_pattern_timed command

Add modified play_patter_timed command

In order to code music with notes of a given duration the most obvious command is play_pattern_timed.
However to get the notes playing throughout their duration you need to use the "attack" paremter as well
e.g. play_pattern_timed [60,64,67],[0.25],"attack",0.25
This is fine if all the notes have the same duration. However if the durations are different, then this format
does not have sufficient flexibility as there is only one value for the attack.
What is needed is a command like
play_pattern_timed_attack [60,64,67],[0.25,0.5,0.25],[0.25,0.5,0.25] with three lists, one for the
note pitch, one for the duration and one for the attack value. Often you will want the attack value
and duration to be the same, in which case a command like
play_pattern_timed_autoattack [60,64,67],[0.25,0.5,0.25] could be used where the attack value is automatically put equal to the duration.The separate lists are useful where you want to get staccato notes e.g.
play_pattern_timed_attack [60,64,67],[0.25,0.5,0.25],[0.1,0.15,0.1] for example

Workspace temporary file uses same name for all users

Workspace TMP-File uses same name for all users. This leads to surprising messages about file access rights at startup when trying another user. I guess the user's name should be part of the name or the file should be created in the user's home directory anyway.

Add ability to play from command line

the ability to play a piece from the command line eg sonic_pi -f filename This could also possibly render the sound better if the gui wasn't running

Data directory - Wish list

Sonic-Pi is brilliant I love it, and whilst I can save any file I like simply using copy and paste, it does require the inclusion of additional resources. What I would like to see included is a working directory selection in the preferences section.

It is not a big deal for me to save the files in predetermined locations but this is on my wish list for improvements. I know we can use the save file feature which selects the in order of preference of the Desktop, but a selectable defined working directory would allow a structured approach to saving files created.

Add variable font size in Sonic-PI

The large font is good to start with, but once you get long lines or add comments it can get annoying and make it more difficult to read a program,without pasting it to a separate editor. Add the option to set a smaller font size.

Allow play to handle arrays of symbols

In RC9 at least, the following plays a hearty C major

play [60, 64, 67]

whereas the next results in an error

play [:C4, :E4, :G4]

# returns
#Error: undefined method `+' for :C4:Symbol
#/Applications/SonicPi.app/app/server/sonicpi/spider.rb:336:in `eval'
#/Applications/SonicPi.app/app/server/sonicpi/mods/sound.rb:526:in `map'
#/Applications/SonicPi.app/app/server/sonicpi/mods/sound.rb:526:in `play_chord'
#/Applications/SonicPi.app/app/server/sonicpi/mods/sound.rb:408:in `play'
#(eval):3:in `block in __spider_eval'
#/Applications/SonicPi.app/app/server/sonicpi/spider.rb:336:in `eval'
#/Applications/SonicPi.app/app/server/sonicpi/spider.rb:336:in `block in __spider_eval'

You end up having to do this:

play [note(:C4), note(:E4), note(:G4)]

Can we coerce any symbols to run note() behind the scenes?

developer path hardcoded

commit 1b0ba87 seems to have introduced this file reference into app/server/sonicpi/scsynthnative.rb

mUGensPluginPath: "/Users/sam/scratch/meta-ex/target/native/macosx/x86_64/",

This stops anyone else from starting the app

Add tempo command to work with timed notes

The with_tempo command is a good idea but it doesn't apply to timed durations
It would be nice to have a tempo multiplier command to apply to timed sequences. Otherwise ALL times have to be recoded which is too time consuming

Allow play to take a Float as Hertz

This is more of a feature request.

play 60 # midi note
play :C4 # musical symbol

I'm proposing that Floats be interpreted as Hertz when passed to play

play 261.62 # middle C

I can see this being useful if teachers want to get into demonstrating scientific concepts (harmonic series etc.) as well as opening up more flexibility with additive synthesis etc. I can't quite get my head around where this would have to happen in the code, but if you can start me off I'll put together a PR.

Note lengths vs BPM

Hi, been doing some work with CA. I was trying to code up something a bit more "melodic" or "harmonic" as opposed to something rhythmic like a drum beat or random sequence. I couldn't find any obvious way of setting note lengths, so for example a melodic pattern that consists of a number of quarter-notes followed by a half-note at the end, actually gets played as the last note as a quarter note with a quarter note rest.

This is not as noticeable with the pretty_bell as it has short sustain, but if one was to try a piano (is there a synth name for a piano, would like to use one please!), to get something melodic that is musically accurate, you'd need to be able to have some control over note lengths (or in MIDI terms, set the note-on and note-off time independently somehow).

RUBY: Connection refused – send(2) (Errno::ECONNREFUSED)

/opt/sonic-pi/app/scripts/vendor/osc-ruby/lib/osc-ruby/client.rb:10:in send’: Connection refused – send(2) (Errno::ECONNREFUSED) from /opt/sonic-pi/app/scripts/vendor/osc-ruby/lib/osc-ruby/client.rb:10:insend’
from /opt/sonic-pi/app/gui/../../app/scripts/run-code.rb:180:in block in osc’ from :10:insynchronize’
from /opt/sonic-pi/app/gui/../../app/scripts/run-code.rb:178:in osc’ from /opt/sonic-pi/app/gui/../../app/scripts/run-code.rb:149:inclear_scsynth’
from /opt/sonic-pi/app/gui/../../app/scripts/run-code.rb:132:in reset_scsynth!’ from /opt/sonic-pi/app/gui/../../app/scripts/run-code.rb:41:ininitialize’
from /opt/sonic-pi/app/gui/../../app/scripts/run-code.rb:225:in new’ from /opt/sonic-pi/app/gui/../../app/scripts/run-code.rb:225:ininitialize’
from /opt/sonic-pi/app/gui/../../app/scripts/run-code.rb:320:in new’ from /opt/sonic-pi/app/gui/../../app/scripts/run-code.rb:320:in

Hi, I’ve just (15/06/2014) created a brand new NOOBS image. I’ve sudo apt-get updated and sudo apt-get upgraded and then sudo apt-get installed sonic-pi. It seems to be pretty much the same error Jim Manley was getting in October 2013. Did anyone discover a fix? Thanks.

Add facility to select sound output

At present sonic-pi is hard wired to use the built in audio 3.5mm jack. Add the facility to select the sound output required. Could be via a config file

Improve chord commands

a command to specify a chord of a given duration more succinctly than using
play_chord [60,64,67],"attack",0.5
sleep 0.5
maybe even something to allow sequences of chords like the play_pattern commands
play_chord [(c1n1,c1n2,c1n3),(c2n1,c2n2,c3n3)....][c1duration,c2duration,c3duration.....]

Sonic Pi 2 (RC3) freezing on startup

I am getting the same issue as #61 when using Raspi LTSP with R3. Raspi-LTSP does not do anything weirdly different other than use multiple users? Sonic Pi 1 is installed as is jackd and I have ran updates. Does it need some super new kernel or something? Am currently running 3.10.11+rpi5 (2014-03-17) and most recent GPU firmware.
The Kernel on Raspi-LTSP depend on the Raspbian Kernels found in the apt repository for Raspbian (apt-get install linux-image-rpi-rpfv) and am already running most recent version.

Not sure what else it could be?

Any ideas
photo-13

Thread sync/drift

Hi, been doing some work with CA, I noticed that if I start 3 threads running at default BPM, after a few bars they get a bit out of sync. I wasn't sure whether you had built in thread synchronisation into your core code, or whether it was up to the user to do their own sync between threads. Either are ok of course, but I wasn't sure if you were expecting users to realise that they need thread synchronisation and then read about how to do it as part of the learning experience, or whether you had provision for it to happen automatically in your code so readers could just code multiple tracks out of the box.

Code below as an example, excuse my crap ruby code I'm not really a ruby programmer: I have a separate thread showing the bar and beat number so I can keep track of everything on the screen, the thread that starts playing after 3 bars on my Raspberry Pi is already out of sync. If I remove this bar counting, it does still get out of sync eventually so I think even if there was a startup latency in the threads, there still appears to be some drift over time.

C=60
D=62
E=64
F=65
G=67
A=69
B=71
octave=12
major = [0,2,4,5,7,9,11,12]
pentatonic = [1,3,6,8,10]
d=1.0

bar=0
beat=0
in_thread do
loop do
sleep d
beat=(beat+1)%4
if beat==0
bar = bar + 1
print "**** "
print bar
print "\n"
end
end
end

by the time this thread reaches it's target bar

time has drifted enough to be noticeable

in_thread do
note=C+12
loop do
if bar>3
play note
end
sleep d/2
end
end

in_thread do
with_synth "beep"
note=C
loop do
play note+pentatonic[rand(5)]
sleep d/2
end
end

in_thread do
note=C-octave*2
with_synth "beep"
loop do
play note
sleep d
play note
sleep d
play note
sleep d/2
play note
sleep d/2
play note
sleep d
end
end

in_thread do
with_synth "saw_beep"
loop do
note = C+pentatonic[rand(5)]
play note-(octave)
sleep d
end
end

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.