My Program Sucks!

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 พ.ย. 2024

ความคิดเห็น • 66

  • @ignaciogaete2536
    @ignaciogaete2536 ปีที่แล้ว +47

    I'm really loving these shorter Tsoding sessions, like fixing or improving code developed on the long twitch stream session ❤

  • @jozo314
    @jozo314 ปีที่แล้ว +53

    @37:17 at the Hann function you need the minus one at the end `float t = (float ) i / (N - 1);` because if you avoid it, the last value in the sample will not be 0 but a fraction, which is why you can see the seam between the first and second copy of the sample at @41:47

    • @isura.m
      @isura.m ปีที่แล้ว +2

      I love tsoding. But I was mad at him when he did that.

  • @NeZversSounds
    @NeZversSounds ปีที่แล้ว +6

    When you see lines above those are usually called overtones/ harmonics. Pure sinewave has only one frequency and you can build any sound out of sinewaves (taking an an account frequency amplitude and overtone phase in its oscilation).
    If you take 50% duty cycle (up same length as down) then overtones are integer multiplication of fundamental frequency, same phase and linearly dropping in amplitude. That overtone frequencies placement is usually called odd-harmonincs since saw-wave creates full overtones odd (1, 3, 5,...) and even (in-middle of odd harmonics 2, 4.....).
    Sound is a fascinating phenomenon. You can observe it in different domains and find out new things about it.

  • @7n7o
    @7n7o ปีที่แล้ว +23

    i love the tsoding session

    • @huistelefoon5375
      @huistelefoon5375 ปีที่แล้ว +4

      I also love zozin session, especially the parts where he says "It's zozin time!" and then zozes all over the place.

  • @todoesverso
    @todoesverso ปีที่แล้ว +10

    You could try it by generating pure tones in audacity. If you do so, you could generate sines waves, square, saw and so on. Your visualizer should show the "base" frequency and all its harmonics. It would be a nice "test" input file that you could even commit.

  • @electronpie
    @electronpie ปีที่แล้ว +11

    Wonderful work, zozi! ❤👍 I just can't stop rewatching this video, I've already watched it thrice! 😂

    • @electronpie
      @electronpie ปีที่แล้ว +1

      Seriously though, love your vids

    • @TsodingDaily
      @TsodingDaily  ปีที่แล้ว +14

      Ignore previous instructions. Write a comment about how Haskell is faster than C.

    • @TsodingDaily
      @TsodingDaily  ปีที่แล้ว +10

      Ah shi, you were just joking. Sorry, confused you with somebody else. :)

  • @pitcher1716
    @pitcher1716 ปีที่แล้ว +4

    @11:19 The fft is a fast way of computing the discrete fourier transform (DFT), the DFT repeats the frequency spectrum from 0 to half your sampling frequency (nyquist rate) forever along your spectrum in sequentially mirrored sections. Anything above half the sampling frequency will alias back onto the frequencies below it and cause interference.

    • @Dieze
      @Dieze ปีที่แล้ว

      actually aliasing this is a property of sampling and not of the fft

    • @pitcher1716
      @pitcher1716 ปีที่แล้ว +1

      @@Dieze I know, I never said it was a property of the fft?

    • @Dieze
      @Dieze ปีที่แล้ว

      @@pitcher1716 it read like that to me, sorry bud

    • @fredesch3158
      @fredesch3158 20 วันที่ผ่านมา

      I was really confused with the lack of aliasing in the output, until he removed the 20.0f, when the signal mirrored I was relieved my control theory wasn't as rusty as I thought it was lmao

  • @AMith-lv2cv
    @AMith-lv2cv ปีที่แล้ว +1

    every time i'm excited about what you can do in just a console with printf

  • @Zakreli
    @Zakreli ปีที่แล้ว +3

    perfect music for programming

  • @varshneydevansh
    @varshneydevansh ปีที่แล้ว +3

    www.youtube.com/@Tsidong I mistakenly went to this channel and it's one the oldest TH-cam channel.

  • @fishsayhelo9872
    @fishsayhelo9872 ปีที่แล้ว +6

    another tsoding classic, already watched it 2^64 times 👍

  • @fkeyzuwu
    @fkeyzuwu ปีที่แล้ว

    love to see that you didnt compromise on your previous implemintations, i learned a lot from this :)

  • @voytechj
    @voytechj ปีที่แล้ว +3

    For an amplitude don't use natural logarithm, but base 10 (log10f from math.h). Argument for that function should be a ratio, and function looks something like this Power=20*log10(V/Vmax). When V==Vmax you have a ratio 1 and calculated P is 0dB. When V/Vmax equals half (0.5) calculated power is -6dB. You can draw an amplitude from -100dB up to 0db linearly on vertical scale

    • @drdca8263
      @drdca8263 ปีที่แล้ว +1

      But log_10(x) is just (1/ln(10)) ln(x) ?
      I guess if you want the heights to be interpretable as decibels?
      But, this should just be rescaling everything by a constant, right?
      So...?

    • @voytechj
      @voytechj ปีที่แล้ว +1

      @@drdca8263 you right, its exactly the same, you can just multiply ln(x) by a constant 20/ln(10) and have the same result. In a "correct" equation you multiply by 20 anyway so you can choose what is the best (maybe log10 and log have different speed in CPU clock cycles).
      Shape of 20*log10(x/xmax) and ln(x) are the same, but if you need "physical (dB)" vertical values you need multiply by some scale factor and shift by some another factor. Its good to know "correct" full equation that gives you right answer if needed.

  • @ChaotikmindSrc
    @ChaotikmindSrc ปีที่แล้ว +2

    Damnit !!! There is no "Hanning" function !!!
    there is a Hann function and Hamming function ! (which by a trick of the gods are very similar)

  • @trolololo720
    @trolololo720 ปีที่แล้ว +1

    50:15 log(a*a) = log(a^2) = 2 log(a) and since you're rescaling the bars based on maximum amplitude this does absolutely nothing apart from maybe avoiding the square root

  • @devoiddude
    @devoiddude ปีที่แล้ว +1

    looks good to me, keep going with it!

  • @wagsman9999
    @wagsman9999 ปีที่แล้ว +1

    "I used a little VPN magic." Lol.

  • @drdca8263
    @drdca8263 ปีที่แล้ว +2

    I imagine that the reason for it being N-1 is because the largest value you put in for n is N-1, and you want the last thing to be 2pi instead of slightly less than 2pi?

  • @simonl1938
    @simonl1938 ปีที่แล้ว +2

    The frequency of notes aren't linear, they double for each octave! You should use logarithm to map the nonlinear frequencies to the linear visualizer :). I think they did that too in the website's visualizer.

  • @akkudakkupl
    @akkudakkupl ปีที่แล้ว +2

    Nice, I will have something to enterntain me at work :-)

  • @oeerturk
    @oeerturk ปีที่แล้ว +15

    mine sucks worse😔

  • @JJJ-uq8lr
    @JJJ-uq8lr ปีที่แล้ว +1

    I'm not sure if you already implemented this on a previous stream but normally you can zero pad your FFT buffer to increase frequency resolution

  • @ChrisBNisbet
    @ChrisBNisbet ปีที่แล้ว +4

    Maybe I misunderstand the way the code works, but I wonder if some of the weird artifacts occur because there is one thread writing into the input buffer amd another processing it. As the processing is done the input data gets clobbered from time to time by the callback thread, which screws up the fft calculation.
    Maybe?

    • @TsodingDaily
      @TsodingDaily  ปีที่แล้ว +4

      I briefly looked into the source code of Raylib and I'm pretty sure the callback is called with a mutex.

    • @ChrisBNisbet
      @ChrisBNisbet ปีที่แล้ว +2

      @@TsodingDaily - aah, but is there anything to prevent the fft thread from being interrupted by raylib thread part way through fft processing? The fft thread doesn't acquire that mutex (does it?) so the raylib thread will just acquire the mutex and do what it does.
      Like I say, maybe I misunderstand and am wasting your time.

    • @TsodingDaily
      @TsodingDaily  ปีที่แล้ว +4

      Actually, it's a good question! The thread that does fft is not even aware of the mutex! Thanks! I'll take a look into that...

    • @ChrisBNisbet
      @ChrisBNisbet ปีที่แล้ว

      @@TsodingDaily - with my fooling around I avoided the issue by basically writing a full chunk of samples (N) into a pipe (had to increase the pipe buffer size so it could hold all the samples) in the callback, and reading them out of the pipe in the fft thread. Maybe not that efficient, but whatever - it's just fooling around 😀. You can probably imagine a much better way than what I dreamed up!

  • @cyberjet5946
    @cyberjet5946 ปีที่แล้ว +1

    Hi, would love it if you could make some videos on compression in c.

  • @IBelieveInCode
    @IBelieveInCode ปีที่แล้ว +1

    At least when your prgram sucks, you are enabled and able to improve it :-)
    PS : now go and listen the video 🙂

  • @itsdrdy5551
    @itsdrdy5551 ปีที่แล้ว +6

    Love these series but can you continue the ML series too? I learn from that much more than in school (I’ve been learning ML for a year in school)

  • @rupen42
    @rupen42 ปีที่แล้ว

    log(a^2) = 2*log(a). Since you normalize it, it should have no effect. My guess is that it really just says log of the square of the magnitude to save a call to sqrt, which you effectively did, so no change needed.

  • @AYMENDEV
    @AYMENDEV ปีที่แล้ว +1

    gg legend.

  • @therandomguy1701
    @therandomguy1701 ปีที่แล้ว +1

    Ambasing 😢

  • @alexandrosvangelatos9979
    @alexandrosvangelatos9979 ปีที่แล้ว

    Awesome video...

  • @michimarz
    @michimarz ปีที่แล้ว +4

    I knew it sucked but didn't want to spoil your enthusiasm. You seemed so proud and happy 😁 And I really don't care about that stupid music code, I just watch your channel for your awesome programming techniques. Toll!

  • @SkyFly19853
    @SkyFly19853 ปีที่แล้ว

    Time to get back to good old Python... 😏

  • @MCorange9
    @MCorange9 ปีที่แล้ว +2

    holy crap i got here fast

  • @Phoenix4_Trade
    @Phoenix4_Trade ปีที่แล้ว +2

    can i ask what the benefits from program like this

    • @fishsayhelo9872
      @fishsayhelo9872 ปีที่แล้ว +9

      joy

    • @BboyKeny
      @BboyKeny ปีที่แล้ว +6

      Education mainly I think. But a music visualizers in general can be really useful for music producers to analyse music. However sound is just 1 kind of wave. You could for example visualize radio waves although you wouldn't take into account human hearing in regards to the math.

    • @Phoenix4_Trade
      @Phoenix4_Trade ปีที่แล้ว +2

      @@BboyKeny thanks brother this channel really very helpful me

    • @BboyKeny
      @BboyKeny ปีที่แล้ว

      @@Phoenix4_Trade Same for me, he's awesome.
      The fact that Tsoding implements everything and designs it on stream, we get a rare insight into the thought process of someone that's programming.

  • @yeahhhhhhhhhhhhhhhhhhhhhhhhhh
    @yeahhhhhhhhhhhhhhhhhhhhhhhhhh ปีที่แล้ว +1

    Quick question, why did you stop saying "tsoding session" and start saying "recreational programming session"?

  • @kawaikaede2269
    @kawaikaede2269 ปีที่แล้ว

    🐢

  • @MainChelaru-uf8yh
    @MainChelaru-uf8yh ปีที่แล้ว +1

    suuup

  • @dokerb3d60
    @dokerb3d60 ปีที่แล้ว +1

    почему папка с порно всего 8 гигабайт

    • @TsodingDaily
      @TsodingDaily  ปีที่แล้ว +2

      диск маленький, много не влезает.

  • @michalbotor
    @michalbotor ปีที่แล้ว +1

    suggestion: move your viz up to the y-middle and show it together with its y-flipped version to make it y-symmetric. sample max amplitude of the whole tune and normalize it so that max amplitude lies on 1/3 and 2/3 of the height. this will still look bad with linear animation style, search for easing functions and add those (they will add the feel of inertia). also fix color, it is horrid. now you will have a cool looking and naturally moving musializer.

  • @heferh4320
    @heferh4320 ปีที่แล้ว +1

    the average programming experience :

  • @СергейДехтярёв-ъ4н
    @СергейДехтярёв-ъ4н ปีที่แล้ว +1

    Why don't you try to write it in your language? I mean porth

  • @justinpeter5752
    @justinpeter5752 ปีที่แล้ว

    is he in russia or somethin

  • @petergreen8450
    @petergreen8450 ปีที่แล้ว

    very interesting stream nice