hi ti every one i am create the digital guitar by pressing the diffrent key it gives diffrent sound but how to set key

Recommended Answers

All 3 Replies

You have to work on the event "Form_KeyDown()".
By reading each "keycode" and then playing a specific sound using the "Microsoft Multimedia Control"

Where the "Sound" would be an audio file.(ex mp3,wma,etc)

Hope that helps :)

You have to work on the event "Form_KeyDown()".
By reading each "keycode" and then playing a specific sound using the "Microsoft Multimedia Control"

KSS is correct but just to show you what he means i've written a short piece of code

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        Select Case e.KeyCode
            Case Keys.A
                'play note A
            Case Keys.B
                'play note B
        End Select
    End Sub

This was written in the Form_Keydown() event.

"Select Case e.KeyCode" - This is a type of Conditional statement but its better for large numbers of conditions rather than writing out lots of If statements

"Case keys.A" - This means that in the Case of the key "A" being pressed the code beneath it (in this case "'Plays note A" will be executed


Hope this was helpful

And to the KeyUP() event, stop playing the note.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.