Beep Sounds in C using Windows API

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 ม.ค. 2025

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

  • @sharath2273
    @sharath2273 18 วันที่ผ่านมา +44

    I love the documentation page for this "A long time ago, all PC computers shared a common 8254 programmable interval timer chip for the generation of primitive sounds. The Beep function was written specifically to emit a beep on that piece of hardware.
    ...
    Eventually because of the lack of hardware to communicate with, support for Beep was dropped in Windows Vista and Windows XP 64-Bit Edition.
    In Windows 7, Beep was rewritten to pass the beep to the default sound device for the session."

    • @RTZemun
      @RTZemun 16 วันที่ผ่านมา +6

      Ninjago type ahh intro

  • @MilMike
    @MilMike 17 วันที่ผ่านมา +28

    I remember when computers had a built in speaker in the mainboard and I loved to generate all kinds of beep sounds by code, it was in dos back then

  • @realgoatzy
    @realgoatzy 9 วันที่ผ่านมา +2

    Thats pretty cool! Thanks for sharing! Didn't even know that, now i can include it in my c++ programs if i ever want to

  • @iCrimzon
    @iCrimzon 12 วันที่ผ่านมา +1

    I made an interactive keyboard in Go and when you said you researched the basics of music theory i started chuckling cause i had to do the exact same thing and write out the formula for tones or whatever while knowing nothing about it like you said

  • @efeburako.9670
    @efeburako.9670 14 วันที่ผ่านมา +4

    beep is a interesting function. i remember a dude wrote smallest exe ever possible with beep function.

  • @SuprotimDas-iu6ot
    @SuprotimDas-iu6ot 17 วันที่ผ่านมา +2

    I'm really happy to learn something new

  • @masoooomx
    @masoooomx 19 วันที่ผ่านมา +6

    simple yet impressive stuff

  • @mr.shredder5430
    @mr.shredder5430 12 วันที่ผ่านมา +2

    that is such a great tutorial you i would love to see more audio programming, im a mysician and i love this tyoe of yutorial

  • @smolcryingpepo
    @smolcryingpepo 18 วันที่ผ่านมา +5

    should make a piano
    start with an enum of octaves
    input melody as vector of strings
    map or cast strings to octave enum
    write the switch statement
    profit

  • @philosyche
    @philosyche 11 วันที่ผ่านมา +1

    as a newbie programmer (learning java, but willing to pick up C/C++) can someone give me some ideas about what i can do building upon this to create a simple polyphonic instrument?
    I would like to create let's say a set of 8 beep generators, build a key-set for multiple octaves, then make the generators play depending upon key-presses using some multi-threading (maybe?), add some basic low-pass filter functionality.
    any help at all is welcome

    • @HirschDaniel
      @HirschDaniel  11 วันที่ผ่านมา +3

      Given that you're learning java, maybe have a look at what javax.sound.sampled can do for you. It's already part of Java, so it won't introduce any new dependencies. You can manually generate signals there. For keypresses use KeyListener or AWT, and for playing multiple sounds simultaneously, have a look at ExecutorService. You should also be able to manually code a low pass filter to apply to your signal. Lowpass is as simple as a moving average over your samples.

  • @FuzzyTekShow
    @FuzzyTekShow 17 วันที่ผ่านมา +1

    This is awesome, thanks for the video! :)

  • @kvba0000
    @kvba0000 13 วันที่ผ่านมา +2

    Good to learn soemthing new!

  • @justmax1834
    @justmax1834 18 วันที่ผ่านมา +4

    cool-- what color scheme do you use in your vim?

    • @segsfault
      @segsfault 16 วันที่ผ่านมา +2

      that's the default one vim comes as with.

  • @romanl.4293
    @romanl.4293 5 ชั่วโมงที่ผ่านมา

    Hey, what the font do you use in your Vim?

    • @HirschDaniel
      @HirschDaniel  4 ชั่วโมงที่ผ่านมา

      Hi, it's Cascadia Mono

  • @mrgunn3r904
    @mrgunn3r904 16 วันที่ผ่านมา +1

    I do agree that beep is a good function , However it has a downside of pausing when called until it stops , So combining sounds would be difficult with this function.

    • @HirschDaniel
      @HirschDaniel  16 วันที่ผ่านมา +2

      I think it's just intended for short warning signals. I remember my antivirus beeped (using the motherboard's beeper) when it discovered a virus, around 15 years ago.

    • @mrgunn3r904
      @mrgunn3r904 16 วันที่ผ่านมา

      @HirschDaniel yea its pretty useful for signaling.

  • @KrishnaTripathi1709
    @KrishnaTripathi1709 18 วันที่ผ่านมา +3

    Is this available for Linux as well???

    • @HMF39
      @HMF39 18 วันที่ผ่านมา

      the `Beep` function is only for windows

    • @segsfault
      @segsfault 16 วันที่ผ่านมา +2

      Beep is only defined in the Windows API, If you want to play any sound (Be it a Beep or an ever more complex sound) then you gotta interact with the Kernel or some library like OpenAL.

  • @AndreyDelRosario-k4d
    @AndreyDelRosario-k4d 18 วันที่ผ่านมา +1

    What compiler you use for C ?

    • @HeitorYT
      @HeitorYT 13 วันที่ผ่านมา +1

      Mingw GCC

  • @BitmasterXor
    @BitmasterXor 12 วันที่ผ่านมา +1

    And a Delphi version of this: th-cam.com/video/JC1Tg9GozdA/w-d-xo.html

  • @usamaismail-u9r
    @usamaismail-u9r 12 วันที่ผ่านมา

    Which headphone and keyboard you use?

  • @Kylian19
    @Kylian19 19 วันที่ผ่านมา

    what do you mean with windows api? it's a library no ?

    • @HirschDaniel
      @HirschDaniel  19 วันที่ผ่านมา +16

      A library is an API. Many people think "API" is limited to webservices, which is plain wrong, just in case you mean that. It's the Window OS library (windows.h). API is any interface you code against

    • @arjix8738
      @arjix8738 16 วันที่ผ่านมา +3

      API is basically a contract, you describe what your request will be, and what the expected response is.
      in this case, the contact is with the windows kernel
      as @HirschDaniel said, it is an interface that describes what you can do with it

  • @iamnotahuman2172
    @iamnotahuman2172 18 วันที่ผ่านมา

    that is coooool

  • @udayakumar-iv7ng
    @udayakumar-iv7ng 18 วันที่ผ่านมา

    Nice