I made my first song? last night :D

Hi everyone! Not sure what category this goes in but I havent introduced myself yet. I made my first song chunk last night and Im pleased as punch. Im surprised and stoked it actually sounds good considering I`ve tried and failed a couple of times to learn to play instruments. This is like a dream come true. I pasted what I made below. Any critiques gladly received. Some of it (mainly how to get the “trumpet” sound settings) I got from chat gpt, but the notes and ideas are all mine. anyone have any music theory book recommendations that will help me learn to make trippy stuff?

`i = 1
trumpet_settings = {attack: 0.1, sustain: 0.3, release: 0.5, amp: 1.5}
sleep_duration = 0.25

Nested loops

live_loop :nested_loops do
2.times do
2.times do
play 55
sleep 0.5
play 53
sleep 0.5
2.times do
play 55
sleep 1
play 60
sleep 0.5
play 62
end
end
end
end

Do loop

live_loop :do_loop do
2.times do
play 55
sleep 0.5
play 53
sleep 0.25
play 50
end
end

Delayed gradient chunk

played_once = false # Flag to ensure the loop plays only once

live_loop :delayed_chunk do
if played_once
stop # Stop the loop permanently if it has already played
end

sync :start_signal # Wait for the start signal
sleep 2 # Delay by 2 beats

First sequence: Blade synth with trumpet settings

1.times do
use_synth :blade
play :e4, trumpet_settings
sleep 0.5
play :c4, trumpet_settings
sleep 0.25
play :c2
sleep 1
end

Gradient effect: Evolving pitches and distortion

1.times do
sleep 1 # Delay before gradient effect starts
with_fx :distortion, distort: 0.7 do
2.times do
play :c4
sleep 0.5
play :c3
end
end
end

Second part with nested distortion effects

4.times do
x = tick + 1
amp_value = Math.log(x)
sleep 1
with_fx :octaver do
1.times do
play :c2
sleep 0.5
play :c4
sleep 0.5
play :c3
3.times do
play :c3, amp: amp_value
sleep sleep_duration0.9
play :c2, amp: amp_value
sleep sleep_duration
0.9
play :c4, amp: amp_value
end
end
end
end

played_once = true # Set the flag to true after the loop runs
end

Signal loop to trigger the delayed chunk

live_loop :trigger do
cue :start_signal # Send the start signal
sleep 8 # Repeat every 8 beats
end
`

Hi there, @Musilliterate I’d love to try out your song but the code has been messed around by Discourse. I think you need three backticks before and after your code so we can actually see the code rather than Discourse’s interpretation of it.

Thanks. My apologies. let me see if I can get it right.

i = 1
trumpet_settings = {attack: 0.1, sustain: 0.3, release: 0.5, amp: 1.5}
sleep_duration = 0.25
# Nested loops
live_loop :nested_loops do
  2.times do
    2.times do
      play 55
      sleep 0.5
      play 53
      sleep 0.5
      2.times do
        play 55
        sleep 1
        play 60
        sleep 0.5
        play 62
      end
    end
  end
end

# Do loop
live_loop :do_loop do
  2.times do
    play 55
    sleep 0.5
    play 53
    sleep 0.25
    play 50
  end
end

# Delayed gradient chunk
played_once = false  # Flag to ensure the loop plays only once

live_loop :delayed_chunk do
  if played_once
    stop  # Stop the loop permanently if it has already played
  end
  
  sync :start_signal  # Wait for the start signal
  sleep 2  # Delay by 2 beats
  
  # First sequence: Blade synth with trumpet settings
  1.times do
    use_synth :blade
    play :e4, trumpet_settings
    sleep 0.5
    play :c4, trumpet_settings
    sleep 0.25
    play :c2
    sleep 1
  end
  
  # Gradient effect: Evolving pitches and distortion
  1.times do
    sleep 1  # Delay before gradient effect starts
    with_fx :distortion, distort: 0.7 do
      2.times do
        play :c4
        sleep 0.5
        play :c3
      end
    end
  end
  
  # Second part with nested distortion effects
  4.times do
    x = tick + 1
    amp_value = Math.log(x)
    sleep 1
    with_fx :octaver do
      1.times do
        play :c2
        sleep 0.5
        play :c4
        sleep 0.5
        play :c3
        3.times do
          play :c3, amp: amp_value
          sleep sleep_duration*0.9
          play :c2, amp: amp_value
          sleep sleep_duration*0.9
          play :c4, amp: amp_value
        end
      end
    end
  end
  
  played_once = true  # Set the flag to true after the loop runs
end

# Signal loop to trigger the delayed chunk
live_loop :trigger do
  cue :start_signal  # Send the start signal
  sleep 8  # Repeat every 8 beats
end
1 Like

Hey @Musilliterate. That’s great! As a beginner it’s far beyond what I’m capable of (yet). There’s a lot I can learn from your script. :grinning:

Hi
have a look at the following 2 documents:
Help/Tutorial/8.3 Scales
Help/Lang/play_pattern_timed

:wink:

Great work btw
PD_Pi

1 Like

Sorry, @brendanmac but where are these docs?

In Sonic Pi, ensure

View/Show Buttons

is ticked, then go top right “Help”

The built-in documentation is in the bottom left pane

PD-Pi

1 Like

There are also a bunch of great tutorials on youtube.
You’re on the right path, keep going!

1 Like

Thank you! I hope we both make really cool stuff!

1 Like