Making Music with Haskell From Scratch

Making Music with Haskell From Scratch

Tsoding

4 года назад

101,187 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@НиколайНиколай-ж9т
@НиколайНиколай-ж9т - 04.09.2020 23:19

pitchStandard :: Hz
pitchStandard = 440.0/2.0 -- because 1st harmonic in the tembr is smaller then the 2nd

tembr = [1/d, 0.7, 0.5/d, 0.4, 0.3/d , 0.2, 0.2 , 0.2, 0.1 , 0.1, 0.1, 0.1] :: [Float]
where d = 4.0 -- make odd harmonics smaller then even (тёплый ламповый звук!)

-- just sum of harmonics, maybe there is a prettier way to do it
freq :: Hz -> Seconds -> [Pulse]
freq tone dur = foldr (\(n, k) acc -> zipWith (\s v -> s + k*v ) acc $ freq' (tone * n) dur ) (map (\x -> x * (head tembr) ) $ freq' tone dur) $ tail $ zip [1..] tembr

-- change only 'output' subfunction, to make it sound more interesting
freq' :: Hz -> Seconds -> [Pulse]
freq' hz duration =
map (* volume) $ zipWith3 (\x y z -> x * y * z) release attack output
where
step = (hz * 2 * pi) / sampleRate

attack :: [Pulse]
attack = map (min 1.0) [0.0,0.001 ..]

release :: [Pulse]
release = reverse $ take (length output) attack

output :: [Pulse] -- sin^3 sounds better then sin for my (It's rock!). Also add distorshn effect with min-max
output = map (\x -> max (min ((sin x)^3) 0.6) (-0.6) ) $ map (* step) [0.0 .. sampleRate * duration]

Ответить
@afonsorafael2728
@afonsorafael2728 - 28.09.2020 11:36

more haskell videos pls :b

Ответить
@protowalker
@protowalker - 14.10.2020 07:10

You should look into ImplicitCAD. It lets you write Haskell that generates 3D models.

Ответить
@diegorocha2186
@diegorocha2186 - 17.10.2020 21:04

I challenge you to do that in typescript haskell style, how about that?

Ответить
@joriskbos1115
@joriskbos1115 - 18.10.2020 17:39

Now implement overtones and playing multiple notes at the same time

Ответить
@miconomo
@miconomo - 18.10.2020 23:01

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

Ответить
@joriskbos1115
@joriskbos1115 - 23.10.2020 01:34

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

Ответить
@sknk1823
@sknk1823 - 23.10.2020 16:24

You will never know that it is a click bait when he played the tone in the end part. Omegalol. Darudepoggers

Ответить
@camotubi
@camotubi - 30.10.2020 23:51

DUDE WHERE ARE YOU?? COME BACK 😭

Ответить
@pasdenom.9062
@pasdenom.9062 - 08.11.2020 05:27

Man. Where are you? Please, don't tell that you got a job, just do Haskell videos! :-D

Ответить
@monke5100
@monke5100 - 28.11.2020 12:57

Где видосы?

Ответить
@arturshum7612
@arturshum7612 - 28.11.2020 13:38

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

Ответить
@RuRu-vm6yw
@RuRu-vm6yw - 14.12.2020 20:57

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

Ответить
@xxjblexx
@xxjblexx - 29.01.2021 00:01

What a Nerd

Ответить
@katem.1586
@katem.1586 - 17.02.2021 04:36

Thanks for posting such a great video ! :)

Ответить
@siobhanahbois
@siobhanahbois - 25.02.2021 23:52

This is really cool! Can we play two (or more) [Pulse] at the same time? Trying to do Für Elise. :-)

Ответить
@htol78
@htol78 - 04.03.2021 14:38

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

Ответить
@418teapot9
@418teapot9 - 21.03.2021 03:34

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

Ответить
@ekkoflok
@ekkoflok - 27.05.2021 15:48

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!

Ответить
@kesleta7697
@kesleta7697 - 25.06.2021 07:39

Can someone explain what's up with the line numbers?

Ответить
@DeineOmaStinkt2
@DeineOmaStinkt2 - 09.07.2021 18:23

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!

Ответить
@dewijones92
@dewijones92 - 14.08.2021 18:34

so fucking awesome. Thanks so much

Ответить
@Q_20
@Q_20 - 04.12.2021 13:32

This is the first video

Ответить
@crossity
@crossity - 08.01.2022 03:25

Wow he was a little bit fat

Ответить
@karolisr
@karolisr - 08.01.2022 12:15

How do I "like" this 1000 times?

Ответить
@kahnfatman
@kahnfatman - 28.05.2022 01:02

Sir, you are a musician.

Ответить
@drspandanroy
@drspandanroy - 30.06.2022 13:00

Does anyone have any idea of how to write that raw binary file in C++?

Ответить
@eliasavelino6729
@eliasavelino6729 - 16.09.2022 04:29

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

Ответить
@m4rt_
@m4rt_ - 13.12.2022 18:41

Haskell > Music Trackers

Ответить
@NoName-md6fd
@NoName-md6fd - 05.01.2023 21:05

Oh man tsoding, wait until you hear about bytebeat then realise you could have just sent "cycle[1..65535] " to the audio file to get a sawtoothwave

Ответить
@random-characters4162
@random-characters4162 - 26.01.2023 21:34

mesmerising

Ответить
@SolathPrime
@SolathPrime - 13.08.2023 20:30

Oh yeah the old channele

Ответить
@polza_dg
@polza_dg - 18.08.2023 21:45

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

Ответить
@kabukitheater9046
@kabukitheater9046 - 08.09.2023 22:08

can you implement fm synthesis in haskell?

Ответить
@Mrhennayo
@Mrhennayo - 16.09.2023 15:47

Noice

Ответить
@JarerFolders
@JarerFolders - 16.09.2023 18:24

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

Ответить
@cobbcoding
@cobbcoding - 11.10.2023 16:02

Could've really used musializer back then

Ответить
@asdfmonstrosity
@asdfmonstrosity - 21.01.2024 06:41

That was great. Now I really want to learn Haskell

Ответить
@cuadernoazul5958
@cuadernoazul5958 - 02.04.2024 00:30

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

Ответить
@linesuid
@linesuid - 11.05.2024 20:00

The bitch standard is fire 🔥🔥🔥

Ответить
@renren_does_programming
@renren_does_programming - 12.08.2024 11:23

2020 Tsoding: Linus Torvalds
2024 Tsoding: Mark Succerburg

Ответить
@hubstrangers3450
@hubstrangers3450 - 15.10.2024 12:01

Thank you.......

Ответить
@MrSimonizo
@MrSimonizo - 12.11.2024 18:24

So great tutorial! I recommend this great work to my students in a Haskell course!!!

Ответить