Making Music with Haskell From Scratch

Поділитися
Вставка
  • Опубліковано 16 лип 2024
  • Source Code: github.com/tsoding/haskell-music
    Note Frequency Math: pages.mtu.edu/~suits/NoteFreq...
    Chapters:
    0:00 Producing First Sounds
    19:03 Frequency in Hertz
    28:06 Semitones
    34:10 Attack-Release
    43:32 Tempo
    46:06 Making Music
  • Наука та технологія

КОМЕНТАРІ • 226

  • @Tsoding
    @Tsoding  4 роки тому +57

    As was discussed on the premiere in the chat, minutephysics has a video explaining 2^1/12 in the Semitones -> Hz formula: ua-cam.com/video/1Hqm0dYKUx4/v-deo.html
    Thanks Jagholin for bringing it up! Now I understand that black box! :)

  • @lividphysics1237
    @lividphysics1237 4 роки тому +284

    Who needs Ableton when you have Haskell?

    • @webgpu
      @webgpu 4 роки тому

      don't know if this video's author got the acid criticism in your sarcastic comment

    • @felixlipski3956
      @felixlipski3956 4 роки тому

      imbecils!

    • @DanDart
      @DanDart 3 роки тому +2

      No one has ever needed ableton when rosegarden exists!

    • @robertbradley3320
      @robertbradley3320 3 роки тому +7

      @@webgpu Depends on how cynical you are on a scale from this video's author to you.

    • @Capewearer
      @Capewearer 7 місяців тому +1

      @@DanDart also LMMS with Ardour.

  • @dbzlinkinpark99
    @dbzlinkinpark99 4 роки тому +84

    46:51 he almost let his plan slip with that laugh when he heard it and wondered probably if you can already recognize it, the mad lad is a coding Meme Legend

  • @dbzlinkinpark99
    @dbzlinkinpark99 4 роки тому +115

    “hey what song is that?”
    “It’s Darude Sandstorm “

  • @joriskbos1115
    @joriskbos1115 3 роки тому +51

    "I will make semitones floats, because I don't feel like converting ints to floats." Time for some microtonal music :)

  • @abhi111094
    @abhi111094 4 роки тому +157

    Tsoding inspired me to start a channel myself, where I am explaining Haskell algorithms, he is indeed an epic haskeller.

    • @anuraghooda8439
      @anuraghooda8439 4 роки тому +6

      Cool, there should be more content for haskellers. You have got yourself a new subscriber.

    • @abhi111094
      @abhi111094 4 роки тому

      It's the truth and advertisement both

    • @Bratjuuc
      @Bratjuuc 4 роки тому

      Subscribed just in case you upload something new to me.

    • @ricardorodriguez4180
      @ricardorodriguez4180 3 роки тому

      Subbed, thanks

  • @gonzalochristobal
    @gonzalochristobal 4 роки тому +68

    omg this is the best youtube recommendation of the month for me

  • @ebonilha
    @ebonilha 4 роки тому +26

    That attack-decay-sustain-release thing could be implemented very elegantly with simplexes or splines. As they form interesting algebras, I think Haskell would have very nice representations of that.

  • @tthermic
    @tthermic 4 роки тому +9

    i had to learn haskell for school so thats why i guess this is in my recommended. man this language is so over my head, watching this brought back bad memories of spending 5 hours to write 5 lines of code lol.

  • @Bloodfox610
    @Bloodfox610 4 роки тому +33

    The text at the bottom of the screen is my favorite.

    • @ewowoi
      @ewowoi 4 роки тому +1

      i3wm ?

    • @itsblack2321
      @itsblack2321 4 роки тому

      @@ewowoi Yeah it looks like default i3status or py3status

    • @AndersJackson
      @AndersJackson 4 роки тому

      @@itsblack2321 Probably using XMonad and its staus bar, or I will not be happy. :-)

  • @thepuzzlemaker2159
    @thepuzzlemaker2159 4 роки тому +6

    Attack, decay, sustain, and release are used as they can help to emulate sounds of many instruments more accurately and pleasantly.
    For example, some instruments have a very strong “front” or attack, that decays quickly, whereas others have a weak attack but sustain for a bit then decay.

  • @mrshurukan
    @mrshurukan 4 роки тому +6

    Never really saw Haskell before, but the way you explain it...
    My God, I think I'm into Haskell now
    You've done a great job! It was entertaining and to some extend even useful to a person who never touched that language before
    Kudos from a fellow programmer and a musician

  • @ih1d
    @ih1d 3 роки тому +6

    You, sir, are an excellent explainer. Really, not many youtuber programmers have your ability to explain, let alone the knowledge of Haskell. Again, excellent content.

  • @dfurmans
    @dfurmans 4 роки тому +4

    Wicked! Love your sessions ! Keep rockin!

  • @johnnyphoney5669
    @johnnyphoney5669 4 роки тому +7

    This is my favorite video of yours now! I like how you come from the absolute simplicity to the details.

  • @Neroordie
    @Neroordie 4 роки тому +3

    It's been a while since I viewed a programming video but this one was really fun to watch, thank you!

  • @anuraghooda8439
    @anuraghooda8439 4 роки тому +1

    Very fun and educative. Really liked this video. Keep making amazing and cool stuff.

  • @DeineOmaStinkt2
    @DeineOmaStinkt2 3 роки тому

    Thank you a lot for this cool tutorial. It was so fun following around and even I just started programming in Haskell I could learn a lot about Haskell AND music :D Keep on going!

  • @KamiKagutsuchi
    @KamiKagutsuchi 4 роки тому +6

    I love how you can't help but laugh when you're putting together the song at the end

  • @fernandogurgel
    @fernandogurgel 3 роки тому +5

    "Music is the most advanced form of mathematics" - GPT-3.
    Now everything makes sense.

  •  4 роки тому +1

    I found myself enjoying this as a child, wicked man, you are awesome!!!

  • @JackSchpeck
    @JackSchpeck 4 роки тому +9

    This was really entertaining video. I coded along and it was fun. You just got yourself another subscriber, sir :D

  • @ninoman123
    @ninoman123 4 роки тому +10

    That was great. As a musician and programmer I really learned a lot about both things! Subbed!

  • @DanielPetri
    @DanielPetri 4 роки тому +12

    Wow amazing content! Keep it up. Deserves way more views

  • @RuRu-vm6yw
    @RuRu-vm6yw 3 роки тому +1

    Not so much activity anymore, was enjoying haskell content. We need more of that!

  • @arturshum7612
    @arturshum7612 3 роки тому

    i've gotten myself into this weird situation where i'd put on your videos as i go to bed and now hearing your voice is the only thing that effectively knocks me out

  • @HeatCrawler
    @HeatCrawler 4 роки тому +6

    That was amaizing! ❤️

  • @ekkoflok
    @ekkoflok 3 роки тому +4

    Thanks a lot for this video! It's really educational to see a master at work! I wish there were some similar stuff with common lisp or scheme hacking!

  • @boriscreativespace
    @boriscreativespace 4 роки тому +2

    this was the most legendary programming video I've seen in a while

  • @polza_dg
    @polza_dg 11 місяців тому +1

    This is the coolest thing i've seen about programming since i started learning it 5 month ago.

  • @monnef
    @monnef 4 роки тому +4

    Nice educational and entertaining video (not many people can pull off both aspects), good job.
    Even though I knew everything on the Haskell front, I learned a lot about music :D.

  • @Chemaclass
    @Chemaclass 4 роки тому +3

    This is just amazing, bro! :D (and crazy...)

  • @robert33232
    @robert33232 3 роки тому

    Bro, I've watched the video with "one breath", really enjoyed it. Thanks a lot!

  • @Mathilde3219
    @Mathilde3219 3 роки тому

    extremely satisfying. Thank you!

  • @katem.1586
    @katem.1586 3 роки тому

    Thanks for posting such a great video ! :)

  • @EsperSpirit
    @EsperSpirit 4 роки тому

    This is really great content!

  • @Hypafrag
    @Hypafrag 4 роки тому +25

    Переписываю, значит, я тут второй день свой синт с плюсов на раст. Подумываю в процессе как бы это на хаскеле выглядело. А чувак такой: «ща покажу». На следующий день после того как я вообще этот канал обнаружил. Что это? Телепатия? Отсутствие приватности? Магия?

    • @shegeley
      @shegeley 4 роки тому +10

      Это Гугл тебя слушает.

    • @user-cy3do4xc2c
      @user-cy3do4xc2c 4 роки тому +4

      Да, со мной происходило подобное. Мне близко объяснение такого явления тем, что у людей с похожими интересами и занятиями рождаются +/- одни и те же идеи. Ну, а получить соответствующее видео к просмотру - вопрос времени.
      Есть история одного писателя-фантаста, который изо всех сил торопился выпустить свой роман. Потому что по его убеждению в то самое время другие ~двадцать человек обыгрывали ту же самую идею в своих произведениях. Вопрос был в том, кому удастся высказаться первым. В то же время публично эта идея не обсуждалась, и было это в доинтернетную эпоху. Но идеи-то витают: кто-то где-то обмолвился, кто-то что-то подумал, - и вот оказывается, таких больше одного.

  • @luizinoue8635
    @luizinoue8635 4 роки тому +4

    Amazing content.
    I would like to see more video exploring sound generation changing the frequency as a function of the time. Like police car alarm.

  • @OleJodd10
    @OleJodd10 4 роки тому

    Very fun and educational, thank you!

  • @mariansam_was_taken
    @mariansam_was_taken 4 роки тому +1

    This video is awesome. I've never used Emacs and Haskell, but this is awesome.

  • @DanDart
    @DanDart 4 роки тому +12

    "442 pies per second"
    - Tsoding, 2020

  • @GabrielFreites
    @GabrielFreites 4 роки тому

    This is amazing o.o!

  • @gonzalochristobal
    @gonzalochristobal 4 роки тому +1

    the reason why a is 2 ^ 1/12 is because an octave has 12 notes, (i think it's kind of made to be like that, because of the chromatic scale and things) so if we multiply the standard pitch with that 12 times:
    (2 ^ 1/12) ^ 12 = 2
    we get 2, and that's because the ratio of one octave to the next is 1/2. if the process start again multiplying the last frequency we got, times 2 ^ 1/12 that will be in the next octave. our ears perceives pitches with double the frequency as one octave above :)
    source: www.simplifyingtheory.com/mathematics-and-music/

  • @cn-ml
    @cn-ml 4 роки тому

    I watched the whole thing. You have a really nice coding style. That undertale in the end caught me pretty off guard though

  • @jackkensik7002
    @jackkensik7002 4 роки тому +2

    OMG he made DARUDE SANDSTORM IN HASKELL, absolute mad lad

    • @redumptious2544
      @redumptious2544 Рік тому

      Argh!!
      Thank you.
      I knew I definitely knew the song but I could not find it for the life of me.
      First comment I found that actually mentioned the name 🙏

  • @asdfmonstrosity
    @asdfmonstrosity 5 місяців тому

    That was great. Now I really want to learn Haskell

  • @wliaputs
    @wliaputs 4 роки тому

    Subscribed when I see music and Haskell

  • @pepegasit610
    @pepegasit610 4 роки тому +17

    Do you know about TidalCycles? It's a music DSL based on haskell that allows you to do cool live music performances.

  • @eliasavelino6729
    @eliasavelino6729 Рік тому

    another fantastic video sir you are fantastic at coding haskell nice video

  • @miconomo
    @miconomo 3 роки тому

    It's really nice, proposal for the next session: music visualization :-)

  • @juancasilla684
    @juancasilla684 4 роки тому

    Awesome man thanks a lot

  • @spacewad8745
    @spacewad8745 4 роки тому

    oh. god!!! i am now discovering this channel.

  • @pasdenom.9062
    @pasdenom.9062 4 роки тому

    That was awesome.

  • @felixlipski3956
    @felixlipski3956 4 роки тому +1

    Very cool! this convinced me to learn Haskell

  • @shamsartem
    @shamsartem 4 роки тому

    Really cool video

  • @kacperozieblowski3809
    @kacperozieblowski3809 4 роки тому +2

    I'm new here and I have one thing to say, love the slavic accent

  • @random-characters4162
    @random-characters4162 Рік тому

    mesmerising

  • @davidfriedman6625
    @davidfriedman6625 3 роки тому +2

    That was so happy! Loved how much you were enjoying it. (And what a great invitation to Haskell...)

  • @shadowleague2486
    @shadowleague2486 4 роки тому +13

    Code You a Sound for Great Good!

  • @AlexsandError
    @AlexsandError 4 роки тому

    amazing!

  • @robert33232
    @robert33232 3 роки тому

    We can go further: to construct notes with the sine overtones, to use Just Intonation note system.

  • @Jango1989
    @Jango1989 4 роки тому

    That's amazing >_

  • @cuadernoazul5958
    @cuadernoazul5958 3 місяці тому

    Says the legend there was a dude who uses Haskell to compose Electronic music by ear.❤

  • @divest6527
    @divest6527 4 роки тому

    I've been following through this tutorial. FYI: the pitch standard tone seems slightly sharp in Tsoding's UA-cam video, but when you compare against the Wikipedia 440hz tone ( en.wikipedia.org/wiki/File:Sine_wave_440.ogg ), it sounds identical :)

  • @tagged5life
    @tagged5life 4 роки тому +14

    idea for a part 2: make it read .midi files, and have summation of [Pulse] for multiple frequencies at the same time

    • @AndersJackson
      @AndersJackson 4 роки тому

      Sum and scale the pulses.
      Anonther thing that is needed is symbols for notes and symbols for periods (full, half, quater, eighth and so forth).
      And not to forget abour doted notes.
      Probably more useful to parse the abc format.

  • @evebogomil2777
    @evebogomil2777 4 роки тому

    this is a completely different lvl of insanity

  • @dewijones92
    @dewijones92 2 роки тому

    so fucking awesome. Thanks so much

  • @mgetommy
    @mgetommy 4 роки тому

    wonderful

  • @yomaru_1999
    @yomaru_1999 4 роки тому

    Interesting tutorial

  • @AmitGold00
    @AmitGold00 4 роки тому

    Great video, if you want to explore this topic more you can do videos on different types of waves like sawtooth and square, and maybe on distortions and effects like that

  • @418teapot9
    @418teapot9 3 роки тому

    Awesome Video! Since you made me wanna start with haskell, whats the best way to learn haskell?

  • @buddyze
    @buddyze 4 роки тому

    Subscribed because of this video only :p

  • @kahnfatman
    @kahnfatman 2 роки тому

    Sir, you are a musician.

  • @nexovec
    @nexovec 4 роки тому +4

    Lol I'm first... also I'm glad you uploaded sth. again

  • @JarerFolders
    @JarerFolders 10 місяців тому

    чувак, ты лучший

  • @rifaldhiaw
    @rifaldhiaw 4 роки тому +3

    HELL YEAHH.. 48:59

  • @arthura.kupriyanov4667
    @arthura.kupriyanov4667 4 роки тому

    Sarude Dandstorm!!!

  • @valcron-1000
    @valcron-1000 4 роки тому +34

    Tsoding: "But I'm not a musician..."

    • @meneereenhoorn
      @meneereenhoorn 4 роки тому

      Either that statement was (Just Musician) or he had some notes and this was (Just NotByEar). Awesome video btw :D

  • @harshadmhatre6021
    @harshadmhatre6021 3 роки тому

    I find all your haskell videos very helpful, Can you please please create a video on how to connect to a mysql database. There is no single video on youtube to get help from.

  • @PhLADiPreLiO
    @PhLADiPreLiO 4 роки тому +4

    I have a question. I am making my independent research in the domain. I find some information useful for me in the video. My project code is published under MIT licence but does not use the code from the video. May I use some ideas (e. g. Float type etc.) in the project with credits to the authors of the video and still with the same license?

    • @Tsoding
      @Tsoding  4 роки тому +7

      The code shown in this video is also released under MIT license github.com/tsoding/haskell-music/blob/master/LICENSE
      So, yes, I suppose. :)

  • @karolisr
    @karolisr 2 роки тому

    How do I "like" this 1000 times?

  • @htol78
    @htol78 3 роки тому +1

    не знаю что больше поразило, sandstorm на хаскеле или температура чая

  • @gabrielebellavia6024
    @gabrielebellavia6024 4 роки тому +1

    it can become a morse translator if you create a table of letters

  • @creaatiive1718
    @creaatiive1718 4 роки тому

    who are you? why is your voice so magical ? you make me melt no homo

  • @dansch3274
    @dansch3274 4 роки тому

    Liked it

  • @pasdenom.9062
    @pasdenom.9062 4 роки тому

    I would find great to have better tooling for Haskell. For example, an Haskell compiler that can be easily ported to any system (it's painful to port it on new systems…), a compiler which can easily compile statically (even itself), etc.

  • @JasonKT13
    @JasonKT13 4 роки тому

    HOLY SHIT

  • @tjpld
    @tjpld 4 роки тому

    Which key switches do you use? Sound nice.

  • @afonsorafael2728
    @afonsorafael2728 3 роки тому

    more haskell videos pls :b

  • @anwiseru9064
    @anwiseru9064 4 роки тому

    hot i3wm setup, near default ftw

  • @greob
    @greob 4 роки тому +9

    I noticed your mouse cursor becomes the "hourglass" cursor whenever you zoom-in to highlight what your pointing at (e.g. 19:44 and 29:11). Maybe you forgot to do "exec --no-startup-id" in your i3 config? This should prevent the cursor from changing.

  • @robert33232
    @robert33232 3 роки тому

    "Специфик" - I'm already hearing this for the second time from you ;) Don't reveal yourself :-D

  • @alivijb
    @alivijb 4 роки тому

    Гуд)

  • @bashful228
    @bashful228 3 роки тому

    loved this tutorial, thanks for it. only been learning Haskell for a couple of days, I didn't understand the beta reduction used @37:40 - could someone explain pls? does the compiler simply infer the other argument to the min function?

  • @strelkan
    @strelkan 4 роки тому

    я человек простой, вижу цодинг - ставлю лайк

  • @npb73
    @npb73 4 роки тому

    Теперь ждем самодельную флку)

  • @SolathPrime
    @SolathPrime 11 місяців тому

    Oh yeah the old channele

  • @jakubsebek
    @jakubsebek 4 роки тому +3

    I don't know Haskell, but it looks beautiful.. it is like a completely alien language. I wonder how would this code look e.g. in C, could you do a video where you compare Haskell programs with their equivalents in conventional langages?

    • @twb0109
      @twb0109 4 роки тому

      I will start...
      static blah blah blah{
      Blah blah{
      # The actual Code goes here
      }
      }

    • @jakubsebek
      @jakubsebek 4 роки тому

      @@twb0109 I am not a fan of C# either :D

  • @johncontoso7232
    @johncontoso7232 4 роки тому

    Nice. What's the name of the emacs theme?

  • @robert33232
    @robert33232 3 роки тому

    It was fun for me to listen to you in English realizing that we're both Russian :-D