Hello friends,
Today I am coming with another passion after computer. “Music” is part of my life if it’s not in my life than I don’t know what happened to me. So I am dedicating this small creation to my musical friends who helps, enjoy music. Here I am with solution how to play synthesizer by WPF application.
I choose WPF here just because it’s very much attractive and I seem its give emphatic vision to my program, so friends its very simple and attractive task. We have to go in 3 simple steps.
Step1:- Design a WPF page with buttons as shown below fig.
Step2:- Download notes wav file (Sa,Re,Ga,Ma, Pa’s wav file) and include in your project.
Step3:- Now play music on key press and button click event as shown below
Dim btn As Button = CType(sender, Button)
Dim player As New SoundPlayer
Dim strPath As String = Configuration.ConfigurationManager.AppSettings(“path”).ToString()
Select Case btn.Name
Case “btnA”
player.SoundLocation = strPath & “\a.wav”
Case “btnB”
player.SoundLocation = strPath & “\b.wav”
Case “btnC”
player.SoundLocation = strPath & “\c.wav”
Case “btnD”
player.SoundLocation = strPath & “\d.wav”
Case “btnE”
player.SoundLocation = strPath & “\e.wav”
Case “btnF”
player.SoundLocation = strPath & “\f.wav”
Case “btnG”
player.SoundLocation = strPath & “\g.wav”
Case “btnH”
player.SoundLocation = strPath & “\gg.wav”
End Select
player.Play()
player.Dispose()
You can download the source code from Download link
I hope you all are musical lover and use it enhance it and more over send me updated version
Enjoy music with dot net.
Thanks
Rajat Jaiswal
Kindle Wireless Reading Device, Wi-Fi, 6" Display, Graphite - Latest Generation