Example Code

MIDI Drum Machine

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Programming Language

  • LabVIEW G

Code and Documents

Attachment

Description

这是一个“4轨”鼓机,它按照可自定义的节奏模式发送MIDI音符命令。在我的 Windows 计算机上,声卡为设备 =0,鼓声库为通道=10。我已经成功地使用此代码来控制外部MIDI乐器和VST乐器。这些模式可以手动操作或随机化,以获得无限的可能性。我把这个放在那里不是为了对我的编码进行批评 - 它就是这样。这不是一个金星的编程例子,我绝对认为自己是业余爱好者/新手,但想分享一些我认为有趣且可能有用的东西。

*如果没有 https://forums.ni.com/t5/Example-Code/Communicating-with-a-Windows-MIDI-Device-in-LabVIEW/ta-p/39963...

How to Use

The program starts out with 4 default drum patterns.  One for each track.  Each track triggers a different percussion instrument.  The instrument can be selected via RING selector, starting with the "sound group" and then the precise sound/instrument.

Additional Information

16 steps make up 4 beats with 4 steps per beat.  The notes are sent via MIDI to the internal PC soundcard on channel 10.  Each note represents a different percussion instrument.  Timing and synchronizing was somewhat tricky and if there is too much going on with Windows, there could be lags and sluggish timing. 

Related Links

https://forums.ni.com/t5/Example-Code/Communicating-with-a-Windows-MIDI-Device-in-LabVIEW/ta-p/39963...

 

https://www.midi.org/specifications-old/item/gm-level-1-sound-set

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
gavel
Member
Member
on

Forgot to mention - developed with LabVIEW 14.0 Base Development System (32-bit)

*32-bit* may be a critical caveat

Contributors