Recent

Author Topic: MIDI commands  (Read 2063 times)

Chip

  • Newbie
  • Posts: 2
MIDI commands
« on: December 09, 2018, 01:02:06 pm »
Can I somehow send MIDI commands or other instructions
to the soundcard to select instruments, play notes etc.
Or is there some UNIT available for this.

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 916
    • Burdjia
Re: MIDI commands
« Reply #1 on: December 10, 2018, 02:01:17 pm »
Yes, you can.  But AFAIK there's not an "standard" way.  You can use a game library, such as SDL (may be you'll need an add-on) or Allegro.pas (version 5 doesn't has MIDI support so you should use version 4 instead).
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

lucamar

  • Hero Member
  • *****
  • Posts: 2018
Re: MIDI commands
« Reply #2 on: December 10, 2018, 03:34:48 pm »
Also, if you are in Windows, you can use the multimedia services of the system: there should be a JEDI translated unit somewheree in the FPC sources/binaries. Check Microsoft's docs to see how that works.

Linux (and presumably MacOS) shoud have something similar but AFAIK the headers are not (yet?) translated to Pascal ... unless it's in some framework or engine for games, as indicated by Ñuño.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

sash

  • Sr. Member
  • ****
  • Posts: 266
Re: MIDI commands
« Reply #3 on: December 10, 2018, 05:26:13 pm »
Probably not very useful info for a beginner, but ...

There's a very promising C++ library RtMidi I wish I'd translate (currently finishing another project), and there are chances I will, at least I'm going to test it as is.

Interesting part it is crossplatform, has C interface (suitable for Pascal), supports multiple MIDI backends (Jack, Alsa) on Mac and Linux.
Lazarus 2.0.2 FPC 3.0.4 x86_64-linux-gtk2 -- Ubuntu 19.04 XFCE

morknot

  • New Member
  • *
  • Posts: 28
  • still learning
Re: MIDI commands
« Reply #4 on: December 10, 2018, 05:30:33 pm »
There is the BASS audio library (BASSMIDI) for Windows, Apple and Linux. It is free for non-commercial use. I haven't used BASSMIDI but I have used BASS for playing mp3s etc. for which it works very well. For BASS itself there are quite a lot of examples for Delphi, perhaps there are some for BASSMIDI as well. There is a very useful site forum as well.

Find it at https://www.un4seen.com/.

PeterX

  • Sr. Member
  • ****
  • Posts: 326
Re: MIDI commands
« Reply #5 on: February 06, 2019, 04:47:33 pm »
And here the low level way :   TMidiInput and TMidiOutput

http://breakoutbox.de/pascal/pascal.html#TMidi
usually using latest Lazarus release version
with Windows 10 at home
and Windows 7 on the job

sash

  • Sr. Member
  • ****
  • Posts: 266
Re: MIDI commands
« Reply #6 on: February 06, 2019, 04:53:25 pm »
And here the low level Windows only way
Lazarus 2.0.2 FPC 3.0.4 x86_64-linux-gtk2 -- Ubuntu 19.04 XFCE