diff --git a/.gitignore b/.gitignore index ea5583f..0ad45dd 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ # Dependency directories (remove the comment below to include it) # vendor/ samples/ +/build/* +!/build/.gitkeep diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0f896f0 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +.PHONY: build + +build: + go build -o build/midino main.go diff --git a/README.md b/README.md index 70a9612..64f7f03 100644 --- a/README.md +++ b/README.md @@ -1 +1,12 @@ -# midi-player \ No newline at end of file +# MIDINO player + +**MIDINO** is a Linux CLI MIDI player for MIDI sound modules, like the [Roland Sound Canvas](https://en.wikipedia.org/wiki/Roland_Sound_Canvas) and the [Yamaha MU-series](https://en.wikipedia.org/wiki/Yamaha_MU-series). + +## Development requirements +Have GoLang installed and configured in your local environment. More information can be found [here](https://golang.org/doc/install). + +### libportmidi-dev +`apt install libportmidi-dev` + +## Run +./midino midi-file.mid diff --git a/build/.gitkeep b/build/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/go.mod b/go.mod index a5d4852..8b29a09 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/ncirocco/midi-player +module github.com/ncirocco/midino go 1.14 diff --git a/main b/main deleted file mode 100755 index 3e0e504..0000000 Binary files a/main and /dev/null differ diff --git a/main.go b/main.go index bc163c8..9f8e92d 100644 --- a/main.go +++ b/main.go @@ -5,8 +5,8 @@ import ( "fmt" "os" - "github.com/ncirocco/midi-player/midiparser" - "github.com/ncirocco/midi-player/midiplayer" + "github.com/ncirocco/midino/midiparser" + "github.com/ncirocco/midino/midiplayer" "github.com/algoGuy/EasyMIDI/smfio" ) diff --git a/midiparser/parser.go b/midiparser/parser.go index 52b60a3..a01c2a7 100644 --- a/midiparser/parser.go +++ b/midiparser/parser.go @@ -5,7 +5,7 @@ import ( "strconv" "github.com/algoGuy/EasyMIDI/smf" - "github.com/ncirocco/midi-player/miditiming" + "github.com/ncirocco/midino/miditiming" ) const tempoMetaType uint8 = 0x51 diff --git a/midiplayer/player.go b/midiplayer/player.go index 2cfa243..eb12e16 100644 --- a/midiplayer/player.go +++ b/midiplayer/player.go @@ -7,9 +7,9 @@ import ( "syscall" "time" - "github.com/ncirocco/midi-player/midimessages" - "github.com/ncirocco/midi-player/midiparser" - "github.com/ncirocco/midi-player/miditiming" + "github.com/ncirocco/midino/midimessages" + "github.com/ncirocco/midino/midiparser" + "github.com/ncirocco/midino/miditiming" "github.com/rakyll/portmidi" ) @@ -25,6 +25,8 @@ func PlayMIDI(midi *midiparser.Midi) { defer out.Close() defer portmidi.Terminate() + // In case that the user interrupts the program (ctrl+c) + // this will stop properly all the playing notes. c := make(chan os.Signal) signal.Notify(c, os.Interrupt, syscall.SIGTERM) go func() { @@ -63,6 +65,8 @@ func PlayMIDI(midi *midiparser.Midi) { ) } } + + StopAllNotes(out) } // StopAllNotes stops all the notes in all the channels inmidiatelly