Stagelinq protocol API availability? (Part 1)

Looking at the example data sent inside the go-library, it looks like I’ll first have to expand on it to read / look for BPM / timecode data. Thanks for the node ableton link repo, that will be very useful as well!

Yoo just wanted to drop by and let y’all know that the new Twitch Extension for Unbox is live, you can get access with Unbox Pro in the latest Unbox release.

Here’s a link to the extension: ID? And here are the latest Unbox releases: Mac and Windows

1 Like

Hey guys, has the system requirements for Unbox changed? I spotted a new version (V9.0) and downloaded it but now I can’t open it as I need MacOS 11 apparently?

I’m on 10.15.7 as that’s the last compatible MacOS version for my Mid-2012.

Screenshot 2021-07-12 at 09.05.24

1 Like

Hey Denon Forum boys and girls, anyone else have the same problem that the track detection and so on works fine for about 5-10 tracks but suddenly stops working and only a restart of unbox fixes the problem?

We had this problem about ehm 15-30 times in a 4hour stream.

Anyone has a solution?

I would post the log into here but i think it’s to much data :slight_smile:

Thanks a lot for all this amazing info here. Should anyone here be interested in it: I’m currently working on a Node.js version that is able to communicate directly (no need for Go) with StageLinq, as I’m not fluent in Go. I’ll keep you posted on the progress.

1 Like

Can you please zip the log and post it here, I can take a look to see if there’s any indication why the connection was lost. The current plan to fix this is to start a check for stale data, and automatically restart the poller so you don’t have to restart manually yourself.

Hmmm I’m developing on the latest macOS / M1 which may be causing issues, let me see if I can build an unbox version that is compatible with your macOS version.

1 Like

Awesome stuff, are you using the go code as reference or writing from scratch?

Not to worry if not. It’s just something that you maybe able to put in your release notes that a higher version is needed.

Looking good though!

1 Like

Log.docx (71.9 KB)

Hey Erik, thank you. attached the log in Microsoft word. Hopefully this works.

1 Like

Thanks for sending, unfortunately not seeing anything in here that tells us more than what we already know. Hoping to have the automatic restart out soon, should fix up this problem for y’all.

I’m using the Go code as a reference! Thanks a lot for that. So far I’m able to connect to my prime go and request the services.

Couple of things I noticed:

when simply outputting all data I receive on the main connection, I notice that first I always receive the following pattern:

<Buffer 00 00 00 02 ec ba 12 fe 52 be 4f d4 b6 34 40 80 5c b6 26 76>
<Buffer 00 00 00 01 ec ba 12 fe 52 be 4f d4 b6 34 40 80 5c b6 26 76 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8b ce 02 95 fe>
<Buffer 00 00 00 01 ec ba 12 fe 52 be 4f d4 b6 34 40 80 5c b6 26 76 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8c f8 02 51 52>
...

So first it sends a 0x2 message (which you indicated as being a servicesRequestMessage), followed by the 16 byte target token. And then it outputs the 0x1 message every 5 seconds or so. This is followed by again the target token, a lot of zeros and some kind of timestamp. I believe the last 8 bytes indicates the time alive of the device (in nanoseconds; no idea why we would need that precision though). That value resets to 0 when you reboot the device.

In your code you assigned that value to Reference, does it mean the same thing?

Furthermore I noticed that when you request the StateMap, you send the following:

	msgConn.WriteMessage(&serviceAnnouncementMessage{
		tokenPrefixedMessage: tokenPrefixedMessage{
			Token: token,
		},
		Service: "StateMap",
		Port:    uint16(getPort(conn.LocalAddr())),
	})

So a 32 bit 0x0, followed by the 16 byte client token, a UTF16 network string “StateMap” and a 16 bit local port. I did notice that when simply setting port to whatever value (e.g., 0), I also get the StateMap results in your code. Any reason as to why you used that local port?

However for some reason I cannot request the StateMap service in my own code. When TCP connecting to that port it remains quiet. Same goes with the other services. TCP connecting to each of those ports and simply listening, doesn’t do anything. When sending the exact same 42 bytes as you do, to the StateMap service, it remains quiet as well.

If you recall having the same problem, please let me know how you solved it. I might’ve missed something crucial in your code.

In any case: thanks a heap for all this! Once I get the hang of it, I hope to be able to aid you with newly discovered information :slight_smile:

EDIT: Ok after some more digging, turns out that requesting the statemap service indeed doesn’t do anything, for that connection to spew out data, I needed to subscribe to states as well. Did that and now I got the JSON data. So far so good!

3 Likes

@erikrichardlarson ok, the basics seem to work now in my local NodeJS setup! I’ll post it on GitHub once I’m happy with the results :slight_smile: (I have some buffer corruption/TCP fragmentation problem when I pull the faders quickly, slowly everything works fine)

Couple of questions:

  1. how did you get that list of state values in the first place? Could there be any values that we don’t know of?

  2. I’d like to get all settings that the user can configure (e.g., is the cross fader enabled or not). Any idea on how to do that?

  3. I noticed that MixerCH1faderPosition etc values aren’t normalized but run from [0…1.26]. Any idea why? /Engine/Deck1/ExternalMixerVolume is normalized, however it is also multiplied with the cross fader position, even if the cross fader is disabled. No idea why Denon would do that.

2 Likes

yo @DJRobF awesome work! I actually didn’t create the go-stagelinq library so I can’t speak to the statemap services you’re having issues, but @icedream should be able to. I’m also curious if there are other states we can pull down, I know album art is one that people would be interested in using, @icedream do you recall how you pulled down the states here: go-stagelinq/value_names.go at master · icedream/go-stagelinq · GitHub

Excited to take a look at your code when it’s posted @DJRobF, any idea when you’ll post it? I’ll likely use it with unbox given it’s in Node and I understand Node better than go haha

2 Likes

I retrieved this specific set of states that can be subscribed by listening in on the traffic that existing software such as Resolume generates, it requests these states explicitly. So it is theoretically possible that there are values that we don’t know of yet, and I also didn’t explore the value ranges for all of these.

In regards to album art, this probably needs to be a combination of retrieving the currently playing file path via state, and then using the FileTransfer service. I’ve put some hexdumps of that protocol into this issue ticket but I haven’t been able to decode that protocol yet.

3 Likes

Hi all,

@icedream thanks for your reply! I’ll see if I can do anything with that FileTransfer service.

@erikrichardlarson and others, I posted my NodeJS code on GitHub here today:

MarByteBeep/StageLinq: NodeJS implementation of the Denon StageLinq protocol (github.com)

I added a GNU GPL3 license, as opposed to MIT, as I’d like to keep this code open to the public :slight_smile:

This is a WIP demo that tries to find a Denon Stagelinq device (e.g., Prime4, Prime2 and Prime Go) on the local network, connects with it and outputs all input a user makes.

If you want to fiddle around with the code a bit, try changing this line in main.ts

console.log(`${p_data.name} => ${JSON.stringify(p_data.json)}`);

Please let me know if you can get this to work. From now on I’ll try to maintain this repo. If anyone want to help me with that, feel free to let me know!

Enjoy!

Cheers,

M

4 Likes

Great work @DJRobF! I was able to compile the code and the discovery promise was rejected as expected since I don’t have any Denon gear to test this on haha

I’d be happy to help maintain btw, maybe I’ll finally grab a Prime 4. Can anyone here connect me with a Denon rep?

1 Like

Can you post an example of the json that’s logged from the p_messageHandler here: StageLinq/main.ts at b93bb440e16eef38ff07ffaa88ccfcd344fd656a · MarByteBeep/StageLinq · GitHub

Just want to see the key / values that are logged here and I should be able to integrate with unbox by adding in a custom message handler.

Thanks!

Hi Erik!

Does this help in any way? StageLinq output - Pastebin.com

2 Likes

Yeah this is perfect, thank you!

2 Likes