C3 starting pdf viewer on remote tablet

Hi

When loading a song in C3 (on my desktop machine) I’d like to automatically launch a pdf document on a Windows tablet via WLAN. The pdf document does reside in the tablet’s flash memory.

While it is very easy to launch the pdf viewer locally on the C3 machine, doing so on a remote (Windows 10, not the Pro version) tablet is not so straight forward. Is there any easy solution for that?

Thanks and regards
Michael

Hi Michael,

there may actually be a pretty easy way to do this:

  • install Cantabile on your Windows tablet as well
  • create a Cantabile song (call it “PDF”) on the tablet with as many states as you have PDF documents
  • create a binding in that song SongStates->OnLoad–>External Script;execute that loads your PDF document
  • set that binding’s state behavior to make sure that each state loads a different document
  • maybe you’ll need to also create a binding on SongStates->Unload to close the PDF viewer

So far, you have a Cantabile song on your tablet that allows you to open different PDF documents by selecting a state

Now we need Cantabile on your desktop machine and Cantabile on your tablet to communicate. For this, the easiest way is to use MIDI over your WLAN connection. Use rtpMIDI for this. Install it on both machines and create a network MIDI connection between your two machines (read the tutorial on Tobias’ site for more details). Let’s call this connection “NetworkMIDI” on both machines.

Now you need to create an OUTPUT port on your desktop Cantabile and an INPUT port on your tablet Cantabile for this NetworkMIDI connection. This way, your desktop C3 can send program changes to your tablet C3 over this connection.

Now to make this connection work:

  • create a “Song;OnLoad->OutputPort - NetworkMIDI; Program Change” binding for each of your songs on your desktop PC. Set the program change to the corresponding state number in the PDF song on your tablet.
  • Create a new binding in your “PDF” song on your tablet “InputPort - NetworkMIDI; Program Change --> SongStates; LoadStateByProgram (Instant)”.

Now every time your desktop C3 loads a song, it will send the right program change via rtpMIDI to your tablet C3, which in turn will load up the corresponding song state that will open the PDF viewer with the (hopefully) correct document.

How does that sound?

Cheers,

Torsten

5 Likes

Hi Torsten

Thanks for your detailed answer. Sounds pretty neat, actually. This raises the question about licensing.

At the desktop PC I think a Performer licence (which I do own) is needed to be able to send MIDI events.

Running Cantabile at the tablet does require a second licence, as both Cantibile instances would run at the same time. Is a Performer licence necessary (which would be a quite expensive solution) or is a Solo licence sufficient? I started with C3 so I’m not aware of C2 features. I noticed there is still C2 Lite available, which (correct if I’m wrong) is free. Do you know if it is feasible to use C2 Lite at the tablet to make your solution happen?

Regards, Michael

Hmm, you’re right - @brad’s licensing model allows you to install C3 on multiple machines, but only run it on one at a time. Since you DO need Performer for my proposed solution (you need song states, which are only available in Performer), this would be a pretty expensive solution, just to pop up PDFs

You could take a look at bome’s MIDI Translator Pro - looks like it can also execute programs based on MIDI triggers. But it’s not free - it costs 59 EUR.

Depending on the content of your PDF documents, there might be an alternative solution to displaying PDF documents: not sure if you’ve looked at LivePrompter yet? It’s a (free) teleprompter specialized for live musicians, but it doesn’t display sheet music, only lyrics and chords. But it works really well with Cantabile and allows exactly your scenario to work nicely. So if it’s mainly lyrics and chords you need displayed, give it a try!

Cheers,

Torsten

1 Like

Yes, I’me aware of LivePrompter, but my documents may contain bitmaps (scores), so a PDF Viewer is needed to display them. The MIDI Translator Pro seems quite powerful, so 59 EUR may be justified. But…

I had a look at rtpMIDI, it was very easy to setup. With this in place, I thought it shouldn’t be too difficult to write a simple app that is listening to the rtpMIDI port and launch a process when receiving a program change event. Just wrote a little test program that will beep at the tablet (LOL) on receiving a prog chg from Cantabile instead of launching the PDF viewer and it works like a charm. What remains is just some routine work to finalize…

Thanks a lot, Torsten, for your ideas that got me on track!

Cheers, Michael

I think MobileSheets can load PDF on received MIDI - there is a win10 version now.

1 Like

Hehe, I couldn’t resist a little coding exercise: why don’t you download this and give it a try?

It’s just a simple tool that allows you to execute programs on receiving a (banked) program change, with a parameter that lets you insert the program number (e.g. “score_%p.pdf” expands to “score_123.pdf”). It also gives you the option to close the previously opened window before opening a new one.

Still very rough around the edges, but for your purposes, it should do the trick! And did I mention it’s free?

Cheers,

Torsten

4 Likes

Very cool @Torsten - I like it.

1 Like

@Torsten: Woo hoo :smiley: rough but fast, thanks a lot, very useful !

@a6325435: just had a look at MobileSheet, looks good. I like the display options, which gives you more control than a simple PDF Viewer. I will have to check if it runs smoothly on my old tablet (which uses an ARM processor).

Regards, Michael

1 Like

Just wanted to let you know that rtpMidi and MobileSheetsPro now does the job for me.

  • Score display is fast and smooth even on my old old Win 10 tablet equipped with an Atom (not ARM) CPU, way faster than that (pardon me folks) overloaded Adobe Reader crap.

  • It’s more configurable than a simple lightweight PDF Reader (display options, page skipping with a pedal etc.)

  • Comes with the ability to process MIDI events.

  • Extra benefit was that I was “forced” to organize my score collection in a consistent way. When using the tablet standalone (e.g. at my acoustic piano, where - surprise, surprise - I don’t have Cantabile on my side :laughing:), the built-in library gives me now several ways to efficiently search and open my scores. Fun to use!

Thanks again for your valuable input.

Regards, Michael

1 Like

I’d be most grateful for a little insight into ‘unload’. This assumes the PDF reader has focus, and then?
TIA

Ooof - reviving a 6-years-old thread with such a specific question :astonished: - let’s see if I can contribute something meaningful.

The idea behind this was to use a Cantabile song to open a PDF viewer with a specific song on every state, using “External Script” bindings on Song State Load. Opening a PDF viewer and loading a document is pretty easy - simply set the document to load as a parameter in the script command.

But to avoid dozens of PDF viewer windows, you’d have to also close the PDF viewer before opening another one in a different state of that song. So you’d need to use a SongState–>OnUnload binding to execute a command that kills the PDF viewer window.

There are multiple ways to achieve this; I usually build a simple AutoIt script that checks if an application window with a certain title exists, sends it a “close” command and then waits until that window is gone. Compile that script to an .exe and you can call it easily from Cantabile. It will search-and-destroy an existing window that fits its criteria - doesn’t matter if that window has the focus or not.

That would be the way using Cantabile to launch and stop a PDF viewer.

Later in the thread, I published a little utility that launches a program on receiving a MIDI program change, so Cantabile isn’t needed on the “display” machine. This little tool also will automatically kill existing instances of that same program if you want it to, so this whole trickery with StateUnload isn’t needed.

Hope this helps - let me know what your specific use case is, then I can give a more precise answer :wink:

Cheers,

Torsten

2 Likes

Do folks realize what a wonderful community lives here?
Needs to be said now and again.
Thank you @Torsten - I’d love to get a handle on this scripting stuff. :nerd_face:

AutoIt is pretty useful - it allows you to handle a lot of typical automation tasks on Windows. Finding an existing program window and closing in is just very basic stuff. This is what such a script looks like:

; make WinExists and WinKill match any substring of a window title
AutoItSetOption("WinTitleMatchMode",2)

If WinExists("Notepad++") Then
	; forcibly close window
	WinKill("Notepad++")
EndIf

This will force-close the most recently used Notepad++ window. You could also use a While … WEnd loop around the WinKill to close all Notepad++ windows if there are multiple windows open. Lots of fun to be had with these scripts…

Once you have such a script working, you can then compile it to an .exe file, so you can call it from Cantabile. AutoIt is really usefull when you want to automate windows tasks that can’t be done with standard Windows batch command-line scripts.

Cheers,

Torsten

Quick retraction.
Chatbot AI sorted me out.
It was the path. I thought I had it, but apparently it was not complete.
Apart from AI leading to our extinction in short order, on this occasion it was quite useful.
:smiley:

On your (deleted) question why AutoIt finds Notepad.exe without path: it all depends on the Windows %PATH% variable; when asked to run a program without a fully qualified path, Windows will scan through the collection of paths in that variable, and if it finds the program, it will start it. So it seems that Notepad.exe can be found somewhere in the Windows path collection…

I actually asked the chatbot why notepad opened without a path prior to getting the solution.
“ When you run the Run("notepad") command in AutoIt, it works because notepad is an executable program that is included in the Windows operating system’s default search path. This means that the Windows operating system already knows where to find the notepad.exe executable file, and you don’t need to specify a path to it in the Run function.”

This is the short, sweet script to close Acrobat. There is no way to close all tabs - a complete exit is the only guarantee.

; Close Adobe Acrobat
ProcessClose(“Acrobat.exe”)