It's kind of funny you don't mention using it on Rapsberry Pi considering that's the computer it was written for. I use it on my old $5 Pi Zero I dedicated to it and it does everything I need.
What is the difference between look and tick?, I get that look doesn't increment the value of the array but it kinda does when it's in the live_loop...so I don't really get it
look returns the current value of tick, so the reason it seems to increment the value in a live loop is that if you have a tick, it is constantly incrementing each time through the loop. The main reason I use look is when I have a ring for play and sleep. if you don't use look for the second ring and instead use tick, you will wind up skipping every other value in the rings instead of iterating through each value. You can read more about it here: sonic-pi.net/tutorial.html#section-9-4 you can also check the entry about look in the built in documentation. Hope that helps
If you wanted to play them one at a time, it would make more sense to put all of the code in a single loop. The benefit of using multiple live loops is that it allows you to have multiple pieces of code running concurrently.
Great tuto, thanks a lot. Silly question, is there a way to do : sample :bd_haus if a[i] == 1 or 3 sleep 0.25 or the only way is to make two lines like that : sample :bd_haus if a[i] == 1 sample :bd_haus if a[i] == 3 sleep 0.25
Hello! You can do it in one line of code like this: sample :bd_haus if a[i] == 1 or a[i] == 3 Full example: a = [1, 0, 1, 0, 3, 3, 0, 0] live_loop :a do 8.times do |i| sample :bd_haus if a[i] == 1 or a[i] == 3 sleep 0.25 end end Hope that helps. Thanks for watching.
@@MrBombMusic Aaaaaaand it's me again XD I tried to mess arround with this sequencer style code with synth instead of sample and when the loop is replayed, I have a "parasite" note who comes with the first note of the loop. The way I solved it is to put a rest during a ridiculous short time and on the journal, instead of à 128 I've got a rest, do you think it's normal ? (feel free to take your time to answer of course) Here is my code : use_bpm 80 a = [1, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 0, 0, 2, 0, 5, 0, 4, 0, 3, 0, 2, 0, 3, 0, 4, 0, 2, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 0, 0, 2, 0, 5, 0, 4, 0, 3, 0, 2, 0, 3, 0, 4, 0, 6, 0, 4, 0, 8, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 0, 0, 2, 0, 5, 0, 4, 0, 3, 0, 2, 0, 3, 0, 4, 0, 2, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 0, 0, 2, 0, 5, 0, 4, 0, 3, 0, 2, 0, 3, 0, 4, 0, 6, 0, 4, 0] define :intro do play c4 sleep define :maintheme do 128.times do |i| play :c4 if a[i] == 1 play :g4 if a[i] == 2 play :a4 if a[i] == 3 play :b4 if a[i] == 4 play :c5 if a[i] == 5 play :d5 if a[i] == 6 play :d4 if a[i] == 7 play :e4 if a[i] == 8 sleep 0.25 end sleep 0.00001 ##Told you it's ridiculous end
Spread is super cool. It's an instant provider of euclidean rhythms (that's the algorithm used to spread them). You can rotate them to shift the beat. You can also use it to calculate odds (e.g, to get a chance of 3 out of 7, just say if spread(3,7).pick). Love these videos!
You could also use the .each option to iterate through the outer array. That way, if you added more patterns to the data, you wouldn't have to change the code: outerarray.each do |pattern| pattern.each do |beat| sample kick if beat == 1 sample snare if beat == 2 end #each beat end #each pattern Easy peasy.
Here you go: editor.p5js.org/mrbombmusic/sketches/brXO5Aa4 I also made a step by step tutorial on how to do this project on Instructables.com: www.instructables.com/Paper-Doorbell-W-P5js-Makey-Makey/
hey, i like music but I'm more into coding than music production, I'm sure you've heard this a lot but your videos have been an absolute god send for me, I just wanted to say thanks for doing what you do :) I'm still at the start of my journey with learning sonic pi but I wouldn't have even been able to even get started without your tutorials
Hi there, I'm someone who has dipped into your very informative and practical videos in the past. Thanks. The other day I saw this video (ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-pio85Lr3pHw.html ) and thought I would attempt to make the music side happen purely with Sonic Pi. I've been finding it a struggle as it implies reverse engineering the timings and then trying to map it onto what Sonic Pi is capable of. I would be honoured if you can give your valuable opinion on it. I'm wondering if this is something best approached using the Jscript + OSC toolset? (Something I haven't even tried yet)
Hello! Thanks for watching. It seems like there are two things you need to implement here: 1.) Each individual column has two notes that gradually shift out of phase with each other. This could be done with two separate loops in which one loop sleeps for a slightly longer duration. # metronome loop for all other loops to sync with live_loop :metro do sleep 1 end a = 1 notePhase = 0.005 live_loop :a, sync: :metro do play 60 sleep a end live_loop :aPhase, sync: :metro do play 60 sleep a + notePhase end 2.) The multiple columns which also shift out of phase, with each column moving slightly slower than the one before it. This could also be done with loops in which you have a variable representing the phase shift time and then multiply that amount incrementally for each loop. live_loop :metro do sleep 1 end a = 1 totalPhase = 0.01 live_loop :a, sync: :metro do play 60 sleep a end live_loop :b, sync: :metro do play 64 sleep a + totalPhase end live_loop :c, sync: :metro do play 67 sleep a + totalPhase*2 end live_loop :d, sync: :metro do play 72 sleep a + totalPhase*3 end and so on.... To get the full affect, you would need an accompanying phase loop to go with each loop that represents a different column which would look like this: live_loop :metro do sleep 1 end a = 1 notePhase = 0.005 totalPhase = 0.01 live_loop :a, sync: :metro do play 60 sleep a end live_loop :aPhase, sync: :metro do play 60 sleep a + notePhase end live_loop :b, sync: :metro do play 64 sleep a + totalPhase end live_loop :bPhase, sync: :metro do play 64 sleep a + totalPhase + notePhase end live_loop :c, sync: :metro do play 67 sleep a + totalPhase*2 end live_loop :cPhase, sync: :metro do play 67 sleep a + (totalPhase*2) + notePhase end live_loop :d, sync: :metro do play 72 sleep a + totalPhase*3 end live_loop :dPhase, sync: :metro do play 72 sleep a + (totalPhase*3) + notePhase end You may have to experiment with the values to get the right timing but the variables should make it easier to do this no matter how many loops you use. There is probably a more concise and elegant way to write this but this seems to get the effect you are looking for. Hope this helps!
@@MrBombMusic thanks for that - I always try to make things too complicated! I got in a mess using loops of threads or threads of loops :) I will try that approach. It has prompted me to step into the world of p5js which will also prove to be interesting avenue to explore. Thanks so much. Cheers.
I've scoured the internet for ages, trying to find advice on receiving OSC in Hydra (from Sonic Pi in my case), have found nothing. Anyone able to help?
Check out this link: github.com/ojack/hydra-osc I was able to get it to work for both sending OSC from Sonic Pi into Hydra and from Hydra to Sonic Pi, although to do that you need to change the client side port to 4560 (The Sonic Pi Incoming OSC port). Doesn't look like this Github has been maintained much over the last two years, but it does work. Good luck!
can you help me plz ,i typed exact the same but keep getting errors : a = [ 1,0,0,0,2,0,0,0,1,0,0,0,2,0,0,0] live_loop :drums do 16.times do |i| sample :bd_haus if a(i) ==1 sample :sn_zome if a(i) ==2 sleep 0.25 end end the error I get is :runtime error :[buffer 0 line 6 (((which is sample :bd_haus )) -thread death +-- live _loop_ drums undefined method a no method error did you mean at .that's the error I keep getting. what is it I'm doing wrong?
The issue is that you are using parentheses instead of square brackets in these lines of code: sample :bd_haus if a(i) ==1 sample :sn_zome if a(i) ==2 It should be: sample :bd_haus if a[i] ==1 sample :sn_zome if a[i] ==2 a is a variable which stores an array, so when you use the counter i to iterate through all the indices in that array, you need to be using square brackets for a[i] to evaluate as one of the values in the array. That should work
Hey, huge thanks for your efforts - incredibly enjoy watching your Sonic Pi tutorials and learn how to code. While all my life crunching excel / ppt with finance related stuff and it makes much more sense to me vs other attempts to approach coding One small q - are aware of similar platforms to do data analysis / visualisation tools with same syntax and commands as those from Sonic Pi?
Thank you for your kind words! Sonic Pi is built on top of the Ruby programming language, so if you are looking for something with a similar syntax, it would also have to be based onRuby. I am not sure what types of data viz /analysis tools are available in Ruby, but I would have to imagine they exist. I am a big fan of p5.js for doing data viz. It uses Javascript so not the same syntax as Sonic Pi, but has a pretty low barrier to entry with the ability to do some pretty advanced things. Hope that is helpful for you.
Excellent explanation, I ran into exactly the same challenge myself, without a solution - you clearly have a strong programming background. I. have watched all your vids, and use them in my own teaching.
Thank you for sharing your code. Is there a way for the sketch to print out other midi events from which ever key, knob or pad that is changed; so that you can find out what channel each is using?
Hey brother how are you, this is such helpfull stuff. Im working on a django project right now, do you know by change how to integrate this graph, with the live cursor feature into an html page? Thank you!
I get the remote control. I just don't understand why it just can't be written in the Arduino IDE like a piezo buzzer and make the tone in the synthesizer. Instead of using the using the piezo buzzer. If we wanted a song to play automated while making led lights and servo movements in the microcontroller. There is a lot on Arduino going to the synthesizer but none of it is just writing the music with an embedded system through the Arduino to a synthesizer. I would like to know if we can do these things in separate synthesizers and still have the Arduino involved why is the Movi Audume still a thing. No one has thought to make a voice chatbot with a Sonic Pi or even the Supercollider. Still have the system capable of making music.
to consolidate your code just make an array for each sound and you can still use i to sort through it in the same loop.... only reason youd want to seperate into different loop is if you need to change the beat or something... @ 16:15