项目作者: s-d-m

项目描述 :
Shows a piano in your terminal while playing a midi file.
高级语言: C++
项目地址: git://github.com/s-d-m/pianoterm.git
创建时间: 2014-10-18T21:28:15Z
项目社区:https://github.com/s-d-m/pianoterm

开源协议:

下载


PIANOTERM

Pianoterm, as the name suggests, displays a piano in your terminal.
It supports playing midi files, and waiting for events from a midi input port.
Have a look at the following video to get a preview of what it does.

video demo of pianoterm

The video has no embedded sound in it, but the real program plays it.

License

Todo: choose a license

Build dependencies

Pianoterm requires a C++11 compiler to build (clang++-3.5 and g++-4.9 are both fine).
It also depends on the following libraries:

Also note that pianoterm does not play music itself. Instead it
relies on a system-wide midi sequencer. On GNU/Linux you might
consider installing timidity

On debian, one can install them the following way:

  1. sudo apt-get install timidity librtmidi-dev librtmidi2 g++-4.9

Unfortunately the termbox library is not packaged by debian so
you need to compile and install it too. To do so:

  1. git clone --depth 1 'https://github.com/nsf/termbox'
  2. cd termbox
  3. ./waf configure # requires python
  4. ./waf
  5. sudo ./waf install

Compiling instructions

Once all the dependencies have been installed, you can simply compile pianoterm by entering:

  1. make

This will generate the pianoterm binary in ./bin

How to use

Pianoterm needs a midi sequencer. If you decided to use timidity, you will need to run it first using:

  1. timity -iA &

Then, you can list the midi “ports” using

  1. ./bin/pianoterm --list

This prints something like:

  1. 5 output ports found:
  2. 0 -> Midi Through 14:0
  3. 1 -> TiMidity 128:0
  4. 2 -> TiMidity 128:1
  5. 3 -> TiMidity 128:2
  6. 4 -> TiMidity 128:3

Then you can then play a midi file through one of the former sequencer using:

  1. ./bin/pianoterm --output-port 1 <your_midi_file>

An example midi file is provided in the misc folder.

You might also connect a (virtual) keyboard to your computer and use
it in place of the midi file. If such a keyboard is connected it must show up in the listing.
E.g with a virtual midi keyboard player

  1. ./bin/pianoterm --list

This print something like:

  1. 6 output ports found:
  2. 0 -> Midi Through 14:0
  3. 1 -> VMPK Input 129:0
  4. 2 -> TiMidity 130:0
  5. 3 -> TiMidity 130:1
  6. 4 -> TiMidity 130:2
  7. 5 -> TiMidity 130:3
  8. 2 input ports found:
  9. 0 -> Midi Through 14:0
  10. 1 -> VMPK Output 128:0

Now run

  1. ./bin/pianoterm --input-port 1 --output-port 2

This will use the virtual keyboark (VMPK) as input, and will use TiMidity 130:0 as the midi sequencer.

Other files you may want to read

todo.txt contains a list of things that I still need to do.

Bugs & questions

Report bugs and questions to da.mota.sam@gmail.com (I trust the anti spam filter)