Coding the 12 Days of Christmas in Python

Sdílet
Vložit
  • čas přidán 18. 12. 2023
  • In which we code up the 12 days of Christmas for the purposes of seasonal cheer. And then we go a little nuts with it.
  • Věda a technologie

Komentáře • 20

  • @DaveLeCompte
    @DaveLeCompte Před 5 měsíci +60

    And now, we can generate 365 days of Christmas in one huge MIDI file, suitable for playing at the malls year-round. ;)

    • @liuskking_alt
      @liuskking_alt Před 5 měsíci +1

      more like 365 or 366 generic days and all of the festivals and holidays

    • @archietheproto7706
      @archietheproto7706 Před 5 měsíci

      It'll just be playing the same tone 365 times 😂

  • @cameron6464
    @cameron6464 Před 5 měsíci +5

    You scratch the desire my brain holds for unfiltered static noise.

  • @SimpleDIYElectroMusicProjects
    @SimpleDIYElectroMusicProjects Před 5 měsíci +19

    Love it. Fantastic stuff.
    Of course technically, there are two flavours of the generic phrases too... seven and eleven have an extra note to play :)
    And for authenticity the "five gold rings" has to get slower and louder each iteration, whilst the remaining verses always accelerate at a greater rate to compensate!? Apart from the final phrase of course which has to slow down at such a rate as to hint at the final sense of relief felt from reaching the end!
    Kevin

    • @danielrhouck
      @danielrhouck Před 5 měsíci +1

      The nth day phrase should also change for 7 and 11.
      And the way I’ve always heard it, the acceleration is deliberate but then the whole last day is normal speed, not just the final phrases.

  • @GilbertBotham
    @GilbertBotham Před 5 měsíci +7

    Just found your channel. Thank you for this, I never even realized the 2-4th day change after 5 golden rings! Could you do the muppet version for next year??

  • @pleabargain
    @pleabargain Před 5 měsíci

    Fascinating! Thank you for making the connection between programming, math and music so clear. I'll check your channel for studies on circles of fifth and chord progressions.

  • @anon746912
    @anon746912 Před 5 měsíci +1

    I love it too. Was just thinking the other day about how to make a program to automate the writing of the lyrics

  • @danielrhouck
    @danielrhouck Před 5 měsíci +6

    1:15 I don’t think that’s true. The melodies for the phone-using (depending on version) birds, French birds, and AtLA reptilebirds are always different because they don’t fit the generic nouns-a-verbing form.

    • @danielrhouck
      @danielrhouck Před 5 měsíci +4

      Oh, also, someone (Knuth) wrote a thing on computational complexity of songs. 12 Days of Christmas is quadratic, 99 Bottles of Beer on the Wall is linear, etc.

  • @Edited_Comment
    @Edited_Comment Před 5 měsíci

    You're gonna blow up man

  • @VanVlearMusic
    @VanVlearMusic Před 5 měsíci

    Awesome

  • @Jadeschannel255
    @Jadeschannel255 Před 5 měsíci +1

    Cool

  • @javiernunez7255
    @javiernunez7255 Před 5 měsíci

    XD the code at the thumbnail is like: repeat 12 times a Christmas Day

  • @donaldhobson8873
    @donaldhobson8873 Před 5 měsíci

    def f(x):
    return [(i,1.) if i>0 else (-i,.5) for i in x]
    Use the fact that almost all of the notes have length 0.5 or 1, and the pitches are positive.
    Need a +[(65,3)] in a couple of places.

  • @alexreinking
    @alexreinking Před 5 měsíci

    I think you would find the idea of Kolmogorov complexity fascinating... it's a measurement of information complexity equal to the size of the smallest Turing machine (shortest program) that produces exactly that information.
    This video shows an upper bound on the Kolmogorov complexity of this song.

    • @marcevanstein
      @marcevanstein  Před 5 měsíci +2

      Thank you for identifying that term for me! That is exactly what I was doing.

    • @alexreinking
      @alexreinking Před 5 měsíci +1

      @@marcevanstein Happy to help! I just discovered your channel today and, as a CS researcher and amateur musician, am really enjoying your videos!

  • @thedoomkiller3178
    @thedoomkiller3178 Před 4 měsíci

    But does the turtle gave to you pizza with pepperoni ?