Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Midi piano for VB.net

Midi piano for VB.net

Scheduled Pinned Locked Moved Visual Basic
csharpphpcomquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    re infecta
    wrote on last edited by
    #1

    I'm looking for a midi piano class that is written in vb.net. I have found plenty in VB6 and C, but not written in Vb.net. The class should be able to play notes that I can call from the form with parameters for note (e.g. "C" in octave 4) and for duration (millisecons). The grand piano sound of General MIDI is enough. Here are two examples. Can someone translate one of them in VB.net? I would be most grateful! http://www.xtremevbtalk.com/showthread.php?t=36582& (scroll few posts down) http://www.a1vbcode.com/app-2951.asp (download link)

    P 1 Reply Last reply
    0
    • R re infecta

      I'm looking for a midi piano class that is written in vb.net. I have found plenty in VB6 and C, but not written in Vb.net. The class should be able to play notes that I can call from the form with parameters for note (e.g. "C" in octave 4) and for duration (millisecons). The grand piano sound of General MIDI is enough. Here are two examples. Can someone translate one of them in VB.net? I would be most grateful! http://www.xtremevbtalk.com/showthread.php?t=36582& (scroll few posts down) http://www.a1vbcode.com/app-2951.asp (download link)

      P Offline
      P Offline
      progload
      wrote on last edited by
      #2

      You can modify this vb.net code into a class, Take a look here: http://www.tomgroves.net/projects/vbmidi/[^] Notes: 'Grand Piano Midi Patch Number is 0 'Octave 4 "C" Pitch (Midi Note Number) 108, Freq = 4,186.0090448096 Hz Progload

      R 1 Reply Last reply
      0
      • P progload

        You can modify this vb.net code into a class, Take a look here: http://www.tomgroves.net/projects/vbmidi/[^] Notes: 'Grand Piano Midi Patch Number is 0 'Octave 4 "C" Pitch (Midi Note Number) 108, Freq = 4,186.0090448096 Hz Progload

        R Offline
        R Offline
        re infecta
        wrote on last edited by
        #3

        Hey, thanks a lot! :) I'll try that tomorrow. By the way, is it possible to play two notes at the same time?

        P 1 Reply Last reply
        0
        • R re infecta

          Hey, thanks a lot! :) I'll try that tomorrow. By the way, is it possible to play two notes at the same time?

          P Offline
          P Offline
          progload
          wrote on last edited by
          #4

          re infecta wrote:

          is it possible to play two notes at the same time

          In Sequence, Yes, just send the new message right after the first message.(just don't forget to close all the messages when your done with them.) Progoad

          R 1 Reply Last reply
          0
          • P progload

            re infecta wrote:

            is it possible to play two notes at the same time

            In Sequence, Yes, just send the new message right after the first message.(just don't forget to close all the messages when your done with them.) Progoad

            R Offline
            R Offline
            re infecta
            wrote on last edited by
            #5

            OK! The code worked very well. One question still: How to open two midi channels and play them at the same time: one playing grandpiano and the other playing percussion (drum hit)?

            P 1 Reply Last reply
            0
            • R re infecta

              OK! The code worked very well. One question still: How to open two midi channels and play them at the same time: one playing grandpiano and the other playing percussion (drum hit)?

              P Offline
              P Offline
              progload
              wrote on last edited by
              #6

              'Send a program change message. Change the last zero to any other number < 16 'to specify which channel to alter. Change '70' to any number between 0 and 127 'to set which patch to assign. '

              'sm(&HC0 + (70 \* &H100) + 0)
              '            ^            ^ 
              '            |            |
              '            |            +---------- Midi Channel Number (0 to 16)
              '            |
              '            +----------------------- Midi Patch Number (0 to 127)
              

              sm(&HC0 + (118 * &H100) + 1) ' <<== Change Patch to 118 "GM Synth Drum" on channel 1" Or change Midi Channel to 9 (all notes in GM on channel 9 are different percussion instruments) Here is a "Patch Map" for GM Patches(subtract 1 in your code) and GM Drums( channel 9). http://jedi.ks.uiuc.edu/~johns/links/music/gm.htm[^] Example: sm(&HC0 + (0 * &H100) + 0) <== Change Patch on Channel 0 to "Grand Piano" sm(&HC0 + (118 * &H100) + 1) <== Change Patch on Channel 1 to "GM Synth Drum" sm(&H90 + ((60) * &H100) + (80 * &H10000) + 0) <== Octave 0 Middle "C" "Grand Piano" on Channel 0 sm(&H90 + ((62) * &H100) + (80 * &H10000) + 1) <== Octave 0 Middle "D" "GM Synth Drum" on Channel 1 sm(&H90 + ((38) * &H100) + (80 * &H10000) + 9) <== GM Drum kit "Acoustic Snare" Channel 9 Would play "C" (Pitch on Piano), "D"(Pitch on Synth Drum), And the Acoustic Snare. Progload -- modified at 15:50 Thursday 5th October, 2006

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups