Results 1 to 14 of 14

Thread: How to create sounds in C#?

  1. #1

    Thread Starter
    Hyperactive Member Janaka's Avatar
    Join Date
    Nov 2001
    Posts
    277

    How to create sounds in C#?

    How to create sounds in C#?
    Any idea of class, that can be used to crate sounds?

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Do you want to play wav files, mp3 files, etc..?

  3. #3

    Thread Starter
    Hyperactive Member Janaka's Avatar
    Join Date
    Nov 2001
    Posts
    277
    No
    I want to design a small program that can produce sounds.
    I am thinking of a class that when u give the frequency produce the sound…
    Or something like that…

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    I have no idea. Wish I did, it would be pretty cool. I am sure there are ways, just none that I know. Sorry.

  5. #5
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    i already have though of that...it is the only thing that the framework is missing: sound! maybe with directx or something..

  6. #6
    Hyperactive Member Scott Penner's Avatar
    Join Date
    Dec 2000
    Location
    Mountain View
    Posts
    327
    Direct access to the sound card might be a bit limited from the dot net framework, but nothing is stopping you from creating a wav file and playing that with windows media player. You can use the player through COM Interop.

    Or, you might want to look at the WaveIn/OutXXX functions in the platform SDK.

    If you've used DirectX, then you might find the DirectSound functions pretty straight forward.
    -scott
    he he he

  7. #7
    Hyperactive Member kleptos's Avatar
    Join Date
    Aug 2001
    Location
    The Dark Carnival
    Posts
    346
    Anyone know how to play mp3's then? I would love to make a C# mp3 player.
    ..::[kleptos]::..
    • Database Administrator (MSSQL 2000)
    • Application Developer (C#)
    • Web Developer (ASP.NET)


  8. #8
    Hyperactive Member Scott Penner's Avatar
    Join Date
    Dec 2000
    Location
    Mountain View
    Posts
    327

    Talking

    Playing an MP3 is easy if you've got Windows Media Player installed (like MS would let you not install it ).

    Add the Windows Media Player ActiveX control to your toolbox and then drop it onto a form in your Winform project...

    This code will play a song:
    PHP Code:
    axMediaPlayer1.FileName FileNameAndPathToMP3;
    axMediaPlayer1.Play(); 
    -scott
    he he he

  9. #9
    Hyperactive Member kleptos's Avatar
    Join Date
    Aug 2001
    Location
    The Dark Carnival
    Posts
    346
    Very cool. Thanks...
    ..::[kleptos]::..
    • Database Administrator (MSSQL 2000)
    • Application Developer (C#)
    • Web Developer (ASP.NET)


  10. #10

    Thread Starter
    Hyperactive Member Janaka's Avatar
    Join Date
    Nov 2001
    Posts
    277
    Ok that is all nice..
    But is there a way to play some sounds?


  11. #11
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Seems only through media player.

    The .NET framework has nearly no multimedia capabilities. This will change with the release of DirectX 9, which will provide a .NET interface (just as DirectX 7 finally provided a VB interface).
    With DirectX 9 you will then be able to do advanced (fast) 2D, 3D, Sound and Music programming, as well as using DirectShow to display movies or play MP3s, DirectPlay for network connections beyond the encapsulated protocols of the .NET framework etc.

    My opinion? The high performance of DirectX is nice for .NET, but that won't make it any more useful for games, and it's sad that the only multimedia part of the CLR is non-portable.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  12. #12

    Thread Starter
    Hyperactive Member Janaka's Avatar
    Join Date
    Nov 2001
    Posts
    277
    *bump*

  13. #13
    Hyperactive Member Scott Penner's Avatar
    Join Date
    Dec 2000
    Location
    Mountain View
    Posts
    327
    bump yourself...

    there's no easy way to do what you are asking.

    you might need to look into APIs from SoundBlaster etc. or you can create the WAV file yourself and play it via the media player.
    -scott
    he he he

  14. #14
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002
    Location
    Eygelshoven
    Posts
    1,611

    Re: How to create sounds in C#?

    Maybe al little late (8 years) but you could use
    vb Code:
    1. Console.Beep(frequency,duration)
    VB6 & C# (WCF LINQ) mostly


    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

    Free online tools

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width