Page 1 of 1

MIDI Note to Filename

Posted: Mon Jun 04, 2018 10:21 pm
by andykoa
Hi there,

I just discovered Fugio and it looks like this can solve my need of a MIDI VIDEO PLAYER.
But I really can't find Examples or a Documentation hat helps me.

Can someone give me an example how to convert the MIDI values NOTE and CHANNEL to a filename for the Mediaplayer

for example:

MIDI Channel 1 and MIDI Note 77 returns filename "1/77.mp4" (File "77.mp4" in Folder "1")
MIDI Channel 2 and MIDI Note 66 returns filename "2/66.mp4"

Any help would be very appreciated.


Re: MIDI Note to Filename

Posted: Tue Jun 05, 2018 5:27 pm
by Demuth
Hi Andy, I just discovered Fugio as well. Yeah, I wish there were more resources about it. Hopefully, that'll come in time.

Re: MIDI Note to Filename

Posted: Fri Jun 08, 2018 9:59 am
by andykoa
Seems this could be done with LUA.
Any idea?

Re: MIDI Note to Filename

Posted: Fri Jun 08, 2018 11:24 am
by andykoa
Could this work?

Code: Select all

fugio = require "fugio"

PinInput1 = fugio.input( "Input1" )
PinInput2 = fugio.input( "Input2" )
PinOutput = fugio.output( "Output" )

local filepath 	= "C:/videos/"
local suffix 	= ".mp4"

functions main()

	-- putting it all together

	local midichannel 	= PinOutput1:get()
	local midinote	 	= PinOutput2:get()
	local filename 		= filepath .. midichannel .. "/" .. midinote .. suffix
	-- log output
	fugio.log( midichannel )
	fugio.log( midinote )
	fugio.log( filename )
	-- check if file exists
	if f~=nil then
		-- file does not exist
		fugio.log( "File does not exist" )
		-- file exists
		fugio.log( "File does exist" )
		PinOutput:set( filename )