Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@dmxjs/prolink-connect

dmx-js17MIT0.11.4TypeScript support: included

This library is a fork of evanpurkhiser/prolink-connect with a more modern build system and other improvements.

prolink-network, CDJ, pioneer, DJ, reverse-engineer, cdj, djm

readme

This library is a fork of evanpurkhiser/prolink-connect with a more modern build system and other improvements.


prolink-connect

Pioneer's PRO DJ LINK protocol, unlocked.
Consume CDJ states + Retrieve complete track metadata.

build npm


This library implements the Pioneer PROLINK network protocol + additional functionality to interact with the prolink network. This library is used as part of Prolink Tools.

Alternative implementations of the Prolink protocol: Java, golang.

Thank you to @brunchboy for his work on dysentery.

Features

  • Written in Typescript - Accurate typings making implementation a breeze. Autocompete your DJ tools to completion.

  • CDJ Status - Receive Player state details for each CDJ on the network. The status is reported as a CDJStatus.State.

  • Metadata Database - Access metadata of currently the currently playing (or not!) tracks stored in the connected Rekordbox formatted USB / SD device, or via Rekordbox link.

Library usage

Connecting to the network

To talk with Prolink devices on the network you'll first need to...

  1. Bring the network online
  2. Configure the network to be connected to.
  3. Connect to the devices on the network
import {bringOnline} from '@dmxjs/prolink-connect';

async function main() {
    // Bring the prolink network online.
    //
    // This will begin listening for prolink devices on the network that send
    // regular announcment packets over UDP.
    //
    // This will FAIL if Rekordbox is running on the same computer, or a second
    // instance of the prolink-connect library is running on the same machine.
    console.info('Bringing the network online');
    const network = await bringOnline();

    // Once online we can listen for appearning on the network
    network.deviceManager.on('connected', device => console.log('New device on network:', device));

    // To configure the online network to be "connected" we must need to specify
    // what network device to use to announce ourselves as a "virtual" device
    // onto the network, and what ID we want to announce ourselves as. By
    // announcing ourselves this will cause other devices to send us more detailed
    // information.
    //
    // There are two ways to configure the network:
    //
    // 1. Automatically - You can ask prolink-connect to wait for a device to
    //    appear on the network to determine what network interface devices exist
    //    on. Device ID 5 will be used in auto configure mode.
    //
    // 2. Manually - In this case you will need to manually specify the network
    //    device and device ID.
    //
    // NOTES on the Device ID:
    //
    //  It's recommended that you use a Device ID of `5` for the virtual device.
    //  Using a ID between 1 - 6 will take up ONE SLOT on the network that normally
    //  a CDJ would occupy. When a 1-6 ID is used You may ONLY HAVE 5 CDJs on the
    //  network. Attempting to connect a 6th CDJ will conflict with the virtual
    //  device announced on the network by prolink-connect. (On models older than
    //  2000s the rande is 1-4.)
    //
    //  There are some cases where you may want your virtual device to announce
    //  itself with "real" device ID, but this library does not currently support
    //  the scenarios that would requrie that (Becoming master and sending a master
    //  tempo)

    // 1. AUTO CONFIGURATION
    console.info('Auto configuring the network');
    await network.autoconfigFromPeers();

    // 2. MANUAL CONFIGURATION
    //
    // const configuredIface = getNetworkInterfaceInfoIPv4()
    // network.configure({vcdjId: 2, iface: configuredIface})

    // We can now connect to the network.
    //
    // This will begin announcing ourself on the network, as well as enable various
    // services on the network service object.
    console.info('Connecting to the network');
    await network.connect();

    // If you're using trypescript, you can now type guard [0] to coerce the type
    // to ProlinkNetworkConnected, marking all services as non-null.
    //
    // [0]: https://www.typescriptlang.org/docs/handbook/advanced-types.html#using-type-predicates
    //
    // You don't need to do this if you're not using trypescript
    if (!network.isConnected()) {
        console.error('Failed to connect to the network');
        return;
    }
}

changelog

Changelog

0.11.4

Patch Changes

  • 1f9f791: Fix CJS module code

0.11.3

Patch Changes

  • 36fb383: fix cjs module resolution

0.11.2

Patch Changes

  • d26c184: Migrate to modern build system
  • 70c5065: add project metadata

v0.11.0 - 2022-10-24

  • Package updates. No changes

v0.10.0 - 2021-05-23

Changed

  • Switch to using Player ID 7 for the virtual CDJ. Freeing up slot 5 for CDJ-3000s.

v0.9.0 - 2021-05-18

Added

  • You can now call network.db.getPlaylist to receive the listing for a playlist. Without specifying the playlist to lookup the root playlist will be queried.

Fixed

  • Remote database calls could fail for requests that result in a large number of rows. Unless you were using the remotedb query interface directly, it is unlikely you would have ran into this problem. The two implemented queries do not return enough rows to result in the error.

v0.8.1 - 2021-04-23

Changed

  • Bumped to latest js-xdr to remove node Buffer warnings.

v0.8.0 - 2021-04-12

Added

  • You can now call network.db.getWaveforms to load waveforms for a track.

  • The isEmergencyMode flag has been added to the CDJStatus type. This reports if the CDJ is in an emergency loop (or just emergency mode in newer players)

v0.7.2 - 2021-02-15

Fixed

  • Do not import the mixstatus module in the types export, as this exports more things that we really don't want.

v0.7.1 - 2021-02-15

Fixed

  • Actually export MixstatusMode, not just the type.

v0.7.0 - 2021-02-14

Changed

  • ReportingMode has been renamed to MixstatusMode and is now exported in prolink-connect/lib/types.

v0.6.0 - 2021-02-14

Added

  • A new triggerNextTrack method has been introduced to the Mixstatus service. Calling this will immediately report the player which has been playing for the longest as now playing.

  • the Mixstatus service has learned to follow master. See the changes to Mixstatus below.

Changed

  • The Mixstatus service's configuration has been restructured and has learned how to follow master.

  • reportRequresSilence has been removed

  • A new mode option has been introduced that configures how the mixstatus processor will generally determine when a track change has happened. The ReportingMode defines: SmartTiming (the default), WaitsForSilence (the replacement for reportRequresSilence), and a new FollowsMaster mode, which simply causes tracks to be reported when the player becomes master (assuming it is on air and playing).

v0.5.0 - 2021-02-01

Fixed

  • Binding to the detected interface to broadcast the announcement packets is not the best approach, since we then can no longer receive broadcast packets. Instead, we can just announce to all connected devices on each announcement tick.

Changed

  • Upgraded to latest Kaitai struct definitions for rekordbox database decoding. Thank you @brunchboy.

v0.4.0 - 2021-02-01

Fixed

  • Bind announcement to the configured interface. This corrects an issue where prolink connect could fail to correctly connect to the CDJs when the OS's routing table did not correctly route the announce broadcast packets.

  • Disconnect all sockets when calling disconnect on the network.

v0.3.0 - 2020-12-03

Added

  • Allow the mixstatus processor to be configured.

v0.2.0 - 2020-11-18

Added

  • Introduced a method to play and cue CDJs.

  • Device manager has learned getDeviceEnsured, which will wait until the device appears on the network before resolving. Useful for when you know a device should be on the network, but maybe has not yet announced itself

  • Use getDeviceEnsured when querying the aggregate database. This will help with situations where a device reports having a track loaded from a device which has not yet announced itself on the network.

  • A new prolink-connect/lib/types file is available, which only exports types and enums, and does NOT require any runtime dependencies. This may be useful when you want to use prolink-connect types in a frontend application, and do not want to accidentally bundle various node.js dependencies into your app.

    This specifically will fix an issue where @sentry/node was being bundled into frontend apps.

Changed

  • Expose the mixstatus processor as a service getter on the Network object. This makes it easier to share a single instance of the mixstatus processor within an app.

  • Remove the mikro-orm dependency. We now directly use SQLite to cache pdb databases locally.

Fixed

  • Fixed various false-positive now-playing repostings with the mixstatus processor, along with some missing now-playing events.

    This removes a huge dependency from the library, and makes consumption significantly easier if you plan to bundle your application.

    There should be no API changes because of this.

  • Fixed a minor bug in trackTypeNames mapping.

  • Avoid hard errors on failed artwork lookups.

v0.1.0 - 2020-06-23

Fixed

  • Fixed a bug in mixstatus when ending a track by taking the deck off-air and then cueing before it finished determining if the off-air action passed the number of interrupt beats, causing the track to incorrectly NOT be cleared from having been marked as having reported itself as playing.

v0.1.0-prerelease.21 - 2020-06-17

Added

  • Initial working implementation. This is currently being used to re-implement prolink-tools.