# How to actually code a complete song?

**URL:** <https://forum.toplap.org/t/how-to-actually-code-a-complete-song/691>\
**Category:** Foxdot\
**Created:** [20 July 2019 02:53 UTC](https://forum.toplap.org/t/how-to-actually-code-a-complete-song/691 "2019-07-20T02:53:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![svenstaro](https://forum.toplap.org/user_avatar/forum.toplap.org/svenstaro/32/385_2.png) [@svenstaro](https://forum.toplap.org/u/svenstaro)\
**Post date:** [20 July 2019 02:53 UTC](https://forum.toplap.org/t/how-to-actually-code-a-complete-song/691/1 "2019-07-20T02:53:41Z")

</div>

Hi, I’m super new to this. So basically I have no idea how to code an entire song. I’ve only seen people changing the code as they go but essentially I’d just like to code up a song and be able to record it as often as I like without making changes during recording it. Is this possible with FoxDot? If not, what are my alternatives?

---

<div class="post-metadata">

**Author:** ![ryan](https://forum.toplap.org/letter_avatar_proxy/v4/letter/r/a8b319/32.png) [@ryan](https://forum.toplap.org/u/ryan)\
**Post date:** [20 July 2019 07:46 UTC](https://forum.toplap.org/t/how-to-actually-code-a-complete-song/691/2 "2019-07-20T07:46:54Z")

</div>

You can absolutely do this. In the SuperCollider window, type `s.record` and press Ctrl+Enter to start recording (it will tell you in the post window about where the file is stored) then `s.stopRecording` when you are finished. SuperCollider is doing all of the audio stuff so recording needs to be executed in there.

That being said, live coding is really about being _live_ and making coding part of performance. I’d definitely recommend you try out making changes as you go and ask “what happens if I do this?” and seeing what you can come up with on the spot - it’s a lot of fun! Don’t feel like you have to, of course, everyone approaches it from a different angle. Let me know if you need any help with anything else!

---

<div class="post-metadata">

**Author:** ![svenstaro](https://forum.toplap.org/user_avatar/forum.toplap.org/svenstaro/32/385_2.png) [@svenstaro](https://forum.toplap.org/u/svenstaro)\
**Post date:** [20 July 2019 13:46 UTC](https://forum.toplap.org/t/how-to-actually-code-a-complete-song/691/3 "2019-07-20T13:46:32Z")

</div>

I definitely want to code the part that I’m working on live and repeatedly hear that but I want to also be able to compose different bits of music that I coded earlier. Think something like [this](https://www.musicianonamission.com/wp-content/uploads/2016/06/Screen-Shot-2018-10-25-at-11.35.07-AM.png) but in code. I don’t care so much about the live aspect and giving a performance but more about creating whole songs declaratively and reproducibly.

---

<div class="post-metadata">

**Author:** ![ryan](https://forum.toplap.org/letter_avatar_proxy/v4/letter/r/a8b319/32.png) [@ryan](https://forum.toplap.org/u/ryan)\
**Post date:** [21 July 2019 08:38 UTC](https://forum.toplap.org/t/how-to-actually-code-a-complete-song/691/4 "2019-07-21T08:38:28Z")

</div>

Go for it - looking forward to hearing some of the finished products!

---

<div class="post-metadata">

**Author:** ![svenstaro](https://forum.toplap.org/user_avatar/forum.toplap.org/svenstaro/32/385_2.png) [@svenstaro](https://forum.toplap.org/u/svenstaro)\
**Post date:** [21 July 2019 13:49 UTC](https://forum.toplap.org/t/how-to-actually-code-a-complete-song/691/5 "2019-07-21T13:49:25Z")

</div>

What I stated above was really more of a question than a statement of action. Basically I need to know how to even approach something like I outlined above using foxdot. Is there some kind of guide or a cookbook for that?

Generally speaking, how do people code up complete songs as opposed to recording a live performance? I’m really new to this whole music coding thing so I’d appreciate some guidance.

---

<div class="post-metadata">

**Author:** ![ryan](https://forum.toplap.org/letter_avatar_proxy/v4/letter/r/a8b319/32.png) [@ryan](https://forum.toplap.org/u/ryan)\
**Post date:** [22 July 2019 07:52 UTC](https://forum.toplap.org/t/how-to-actually-code-a-complete-song/691/6 "2019-07-22T07:52:22Z")

</div>

Oh I see! Well you can treat each FoxDot player object line as a track in a DAW i.e. drum kit, percussion, bass, synth melody etc and set the `amplify` keyword to a [TimeVar](https://foxdot.org/documentation/timevar-basics/) that has values of 1 and 0 to switch it “on” and “off”, if that makes sense.

I have a repo of mini FoxDot jams written in 10 lines of code or less that might be of interest to you to check out:

> **[Qirky/ten-lines-or-less](https://github.com/Qirky/ten-lines-or-less)**
>
> FoxDot mini jams in 10 lines of code (or less). Contribute to Qirky/ten-lines-or-less development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![Drumaliens](https://forum.toplap.org/user_avatar/forum.toplap.org/drumaliens/32/113_2.png) [@Drumaliens](https://forum.toplap.org/u/Drumaliens)\
**Post date:** [27 July 2019 11:22 UTC](https://forum.toplap.org/t/how-to-actually-code-a-complete-song/691/7 "2019-07-27T11:22:41Z")

</div>

I have been thinking about this as well … I know that it sort of bucks the trend of the live-coding but I wanted to be able to have some control over what I am doing so that I can modify and improve and repeat any ideas.

I have only just started looking into it but I think FoxDot gives you the tools to allow you to do this. Some thoughts

Have a look at the temporal recursion section in the documentation  
[https://foxdot.org/temporal-recursion/](https://foxdot.org/temporal-recursion/)  
Note: you will need to replace \>\> with \>\> to get it to play something

Also worth looking at the Groups demo example within the FoxDot, at the bottom it show how to chain two groups together using two functions to build up a repeated verse chorus refrain. You can also add in the use the var command to setup some elements within the above examples and then modify them on the fly using the update property, again have a look in the Vars demo examples in the FoxDot

Good luck

---

<div class="post-metadata">

**Author:** ![ryan](https://forum.toplap.org/letter_avatar_proxy/v4/letter/r/a8b319/32.png) [@ryan](https://forum.toplap.org/u/ryan)\
**Post date:** [29 July 2019 08:16 UTC](https://forum.toplap.org/t/how-to-actually-code-a-complete-song/691/8 "2019-07-29T08:16:18Z")

</div>

Weirdly the syntax formatting on the website doesn’t allow both \> and \< symbols to be in the same code box so I’ve updated the code examples so they don’t have HTML in them now! The temporal recursion aspect definitely gives you some higher-order control over your music so you can have sections, e.g. verse / chorus and is worth looking at for larger arrangements. In future I’m going to add a “send-note” method to SynthDefs so that you can do something like:

```python
def func(n=0):
    if n % 4 == 0:
        pluck.note(4, sus=2, pan=-1)
    elif n % 4 == 2:
        pads.note(2, sus=4, pan=1)

```

So you can create individual note-on events instead of using Players if you wish
