Search code examples
c#audiosoundeffect

Take sound effect from video


I need a digital typeing sound effect.when numbers are typed,Sound effect appears in background of the video.I want to make a program that when I press the keyboard, I also listen this sound effect.How can I find this sound effect or take from this video?

the sound effect between 0:50 and 1:15

www.youtube.com/embed/kIXNpePYzZU


Solution

  • For the 'extracting the sound effect' part of the question, you would likely want to use an online video/audio downloader/converter. In the past, I have used youtube-mp3.org and clipconverter.cc.

    For the second part of the question, it depends what exactly you want. If you want it to apply only to a specific text box in a WinForms/WPF/UWP app you are writing, this should be reasonably easy. The exact method depends on what you are doing, but involves adding a keydown, keyup, or keypress event handler to the text box

    If you want it system wide, this is more difficult. Searching for 'Global Keyboard Hook C#' appears to give good results.

    Once you have detected the key press, have a look at this question for how to play the sound. The answer by bporter gives the following code:

    System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"c:\mywavfile.wav");
    player.Play();