I created a nice base line using Fizz Buzz


use_bpm 244
use_synth :tech_saws

live_loop :base do
  drum = [:drum_bass_hard, :drum_cymbal_closed, :drum_cymbal_open , :drum_cymbal_closed]
  sample drum.tick, amp: 0.6
  sleep 1
end

live_loop :FizzBuzz do
  i = 1
  
  32.times do
    sync :base
    play :A2
    play :C3 if factor?(i,3)
    play :E3 if factor?(i,5)
    play :A3 if factor?(i,15)
    i = i+1
  end
   
  32.times do
    sync :base
    play :D3
    play :Fs3 if factor?(i,3)
    play :A3 if factor?(i,5)
    play :D4 if factor?(i,15)
    i = i+1
  end
  
  32.times do
    sync :base
    play :Fs3
    play :A3 if factor?(i,3)
    play :Cs3 if factor?(i,5)
    play :Fs4 if factor?(i,15)
    i = i+1
  end
end
4 Likes

hi @Ontaru

to help people to copy / paste your code, you need to put your code between backticks
https://commonmark.org/help/tutorial/09-code.html
Thanks !

1 Like

Hey Hey Ontaru. Welcome to in_thread :tada:

The backticks that nlb refers to are these: `
A line before and after your code that both contain just three backticks like this ``` will tell the forum the wrapped text is a code block, and it will be given nice coloured highlighting and indenting - plus as nlb also mentions, a handy button to copy the code into your clipboard :slight_smile:
You can also do inline code snippets by wrapping code with single backticks before and after, on the same line.

(Also, nice use of FizzBuzz too! always great to see common algorithms used elsewhere in computing applied to sound in interesting ways :smile:)

thanks to both of you, its my first post so I didnt know

no problems :slight_smile: keep coding and creating music with sonic pi !

Brilliant. I have organized so many Coding Dojos and Unit Test trainings where I use this Kata. Sounds awesome :slight_smile: