sonic-pi-net / sonic-pi Goto Github PK
View Code? Open in Web Editor NEWCode. Music. Live.
Home Page: https://sonic-pi.net
License: Other
Code. Music. Live.
Home Page: https://sonic-pi.net
License: Other
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.
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 ;-)
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.
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?
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:in
rescue 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:in
require'
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
The ability to optionally specify a global with-synth command
At present each in-thread requires it's own with-synth command as well as one for the main thread
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:in
block (2 levels) in __spider_eval'
(eval):10:in block (2 levels) in __spider_eval' (eval):10:in
loop'
(eval):10:in block in __spider_eval' /home/pi/sonic-pi/app/server/sonicpi/spider.rb:336:in
eval'
/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?
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
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?
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.....]
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.
use some constants
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.
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
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
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:in
block in oscโ
from :10:in synchronizeโ 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:in clear_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:in initializeโ 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:in initializeโ 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 `โ
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
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?
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.
look at the possibility of keyboard entry for notes (there is a script "standalone" that looks as if you have done some work on this already :)
better saving/loading of workspace. At present cut and paste. You can save workspace but not defined how to reload it, or a different saved workspace.
commit b707c8f
Author: Sam Aaron [email protected]
Date: Tue Jun 24 08:28:28 2014 +0100
./bootstrap-qt
++ dirname ./bootstrap-qt
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:in
fu_mkdir'block in mkdir' from /usr/lib/ruby/1.9.1/fileutils.rb:175:in
each'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.
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.
Sonic-Pi has a print command (eg print n or print "hello" ) that can be used to output text or variables. It would be of more use if you included a command to suppress the normal text output, otherwise it scrolls off the screen too quickly to be of use.
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
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
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?
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).
now submitted separately
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.
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
The possibility of function key inputs for commands e.g. one key press to enter play_pattern_timed
/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:in block in oscโ from :10:in
synchronizeโ
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:in
clear_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:in
initializeโ
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:in
initializeโ
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.
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
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
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.
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?
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
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
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.
possibly looking at a first time/second time bar construct for repeats. At present you have to write it out in full if the endings are different
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.
sonic-pi, the synth and jackd create between 10% and 40% of cpu usage even when no script runs.
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
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
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
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?
a defined way to put in rests in timed sequences. I have used note value 0, although this is a defined midi note, but too low to render..is this ok or is there a better way?
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.