How would you go about creating a song as if you were writing it Verse, Chorus, Verse Bridge, Chorus, End without repeating yourself? Would it be cue or thread using variables? I’m trying to understand this is a bit better. Thanks so much for any tips given.
Here’s a topic that might provide some inspiration:
Thanks for that! Seems like it might be conditional but more so focused on switch/case/when
No problem. There’s probably several ways to do it - it’s as much about personal preference really
I’d likely store patterns in lists and then play them from the lists, selecting the lists based on the selection
That worked! Thanks @Loopiloop
Since I tend to like using live_loop, what I do is put if-else-statements within the live_loop and then have them react to a variable I set at the top of my code.
The variable may be something like:
song_section = 0 (For intro)
song_section = 1 (For verse)
song_section = 2 (For chorus)
I can then simply change that variable to whatever song section I’m wanting to change to, then execute the code so all the live_loops update to the new song section.
So if you prefer live_loops over a linear structure, that’s a way you could try doing it.
Looking forward to seeing the finished thing
I have a small code sample here that helps with parts and structure, it might help you.
Oh nice, I didn’t know you could set bar length like that. I was just halving the BPM all the time haha.
Hi Doffu! I’m new to sonic pi and also trying to figure out how to structure my first tune. Do you have a sample code I could look at to better understand your structure?
If you look at the links in posts #2 and #7, you can see that one technique involves storing data in variables. To make up a minimal example, consider a snippet of code like
A = [ (chord :ab3, :major), (chord :f3, :minor), (chord :db3, :major), (chord :eb3, '7') ] B = [ (chord :eb3, '6'), (chord :c3, :major), (chord :bb2, :minor), (chord :eb3, :major)] CHORDS = A live_loop :chord_player do CHORDS.each do |c| play_chord c sleep 4 end end
If you start it playing then you can change to
CHORDS = B without interrupting anything. For a song composed of sections, you can imagine storing chords, melodies, even entire functions that way, as well as including conditional code in your loop.
I like @nlb’s method of capturing your musical sequences inside function definitions, and then arranging those function calls so they trigger your sequences in the order you want them to play… Simple and to the point!
So thanks to them !
Well, thanks to all of you then! Because that was exactly what I was looking for! ^^