Results 1 to 12 of 12

Thread: SerialPort configuration for MIDI

  1. #1

    Thread Starter
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    354

    SerialPort configuration for MIDI

    Hi all, Conventional MIDI serial protocol - as its developers say - runs at 31250 baud rate, 8 data bits, 1 stop bit, 1 start bit and none parity (not sure for this one). The underlined item does not exist in SerialPort control properties in VB.NET what should I do?

  2. #2

    Thread Starter
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    354

    Re: SerialPort configuration for MIDI

    Here's the MIDI configurations: https://ccrma.stanford.edu/~gary/con...ata%22%20byte.

    And SerialPort class/properties as Microsoft documentations say: https://docs.microsoft.com/en-us/dot...t-plat-ext-6.0

  3. #3

    Thread Starter
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    354

    Re: SerialPort configuration for MIDI

    As a faultfinding action, behavior to pressing middle 'C' key was monitored and results are shown in table below:
    Status Byte (1) Pitch Byte (2) Velosity Byte (3)
    0X20 0XF8 don't care
    Which expected results are:
    Status Byte (1) Pitch Byte (2) Velosity Byte (3)
    0X90 0X3C don't care
    Serial Port settings: 31250 sps baud rate, 8 bits data, 1 stop bit, parity (none and mark same results)

    In a similar way for Key-off event there is:
    Status Byte (1) Pitch Byte (2) Velosity Byte (3)
    0X00 0XF8 0X00 0XFF
    Which correct response should be (A hundred percent sure that it should be 3 bytes max):
    Status Byte (1) Pitch Byte (2) Velosity Byte (3)
    0X80 0X3C 0X40

    My inference is there's a '1' bit shifted to left. Consider 0x90 (1001 0000) to 0x20 (0010 0000) and similarly 0x80 (1000 0000) to 0x00 (0000 0000).
    Should I keep looking to rectify the Serial Port 1 start bit additional setting?
    Or correct every receiving byte by shifting 1 bit to right? (>>1 with 1 for status bytes, >>1 with 0 for value byte(s))?

  4. #4

    Thread Starter
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    354

    Re: SerialPort configuration for MIDI

    Update: Well, nothing new were achieved and no answers yet... but, there's a promising thing about uart protocol which can appliable on every kind of microcontrollers. The 'start bit' thing had been built-in on this protocol - thanks to its developers - And as it can be monitored by PC, it should be a way to configure SerialPort control with 1 start bit to spy a MIDI simplex communication.

    Here's the uart data frame:
    Attachment 184794

  5. #5
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: SerialPort configuration for MIDI

    I believe one start bit is default / standard. I'd collect a lot of bytes from the device and look for patterns. Are you certain you are capturing all messages?

    Look at this MIDI tutorial.https://learn.sparkfun.com/tutorials...l/all#messages
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  6. #6

    Thread Starter
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    354

    Re: SerialPort configuration for MIDI

    Quote Originally Posted by dbasnett View Post
    Are you certain you are capturing all messages?
    Yes sir, Note On messages (for middle 'C') are 3 bytes all the time and they are repeatable. Here's the sniffed packets (For note on middle 'C'): Cursor point to the end are Note Off for middle 'C' messages which should be 3 bytes and last FF is a wrong reading obviously.
    Name:  MIDI screenshot.png
Views: 180
Size:  14.4 KB

    If you mean are buffered data digitally okay? I might say 'not sure' because my oscilloscope is an audio frequency range one, so I'm not able to see what's going on but the cp2102 uart to usb converter proofed to be OK in recent projects. That's the reason I'm suspected to Visual Studio low-level configuration or such.
    Last edited by pourkascheff; May 12th, 2022 at 01:22 PM.

  7. #7
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: SerialPort configuration for MIDI

    Quote Originally Posted by pourkascheff View Post
    Yes sir, Note On messages (for middle 'C') are 3 bytes all the time and they are repeatable. Here's the sniffed packets (For note on middle 'C'): Cursor point to the end are Note Off for middle 'C' messages which should be 3 bytes and last FF is a wrong reading obviously.
    Attachment 184801

    If you mean are buffered data digitally okay? I might say 'not sure' because my oscilloscope is an audio frequency range one, so I'm not able to see what's going on but the cp2102 uart to usb converter proofed to be OK in recent projects. That's the reason I'm suspected to Visual Studio low-level configuration or such.
    Can't see any of your attachments...
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  8. #8

    Thread Starter
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    354

    Re: SerialPort configuration for MIDI

    Quote Originally Posted by dbasnett View Post
    Can't see any of your attachments...
    Corrected sir.

  9. #9
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: SerialPort configuration for MIDI

    In the link I posted there is a finite state machine with a heading of Message Parsing.

    Did you follow that? Did you read the paragraphs that follow it?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  10. #10

    Thread Starter
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    354

    Re: SerialPort configuration for MIDI

    Quote Originally Posted by dbasnett View Post
    In the link I posted there is a finite state machine with a heading of Message Parsing.
    Did you follow that? Did you read the paragraphs that follow it?
    Um, not quite sir. I mean I forgot moore's diagram and how to extract its functionality. But what I'm one hundred percent sure is that UART protocol includes 1 start bit in itself which can easily achievable on C based microcontrollers IDEs but how do to such thing in VB (The mothership of most of them)?

  11. #11
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: SerialPort configuration for MIDI

    Quote Originally Posted by pourkascheff View Post
    Um, not quite sir. I mean I forgot moore's diagram and how to extract its functionality. But what I'm one hundred percent sure is that UART protocol includes 1 start bit in itself which can easily achievable on C based microcontrollers IDEs but how do to such thing in VB (The mothership of most of them)?
    https://www.vbforums.com/showthread....=1#post5566895
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  12. #12

    Thread Starter
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    354

    Re: SerialPort configuration for MIDI

    (2023 Update) Well, I know it is not even entered to VisualStudio VB.NET yet... I was going to do things with received bytes but since readings are invalid/wrong I should rectify it first.

    Is my code-generating machine produces them wrongly? Could it be faulty? Nothing else came up to my mind... I'm using Alesis Q49 it is USB MIDI-controller but also covers a DIN5 conventional port. I used DIN5 with external power same identical wrong reading.

    I am considering to create an account on Gearspace.com (formerly called Gearslutz)
    Last edited by pourkascheff; Mar 23rd, 2023 at 11:49 AM.

Tags for this Thread

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