CDJ Automation Commands and Responses

Syntax Note:

The expression command[ dog | cat | sheep ] indicates that one of the 3 values must be chosen, e.g. command[dog]

Commands

Playlist Related

playlist_play
playlist_stop
playlist_pause
playlist_next
playlist_prev
playlist_clear
playlist_shuffle
playlist_optimize
playlist_mode[ random | manual ]
playlist_loop[ on | off | toggle ]
playlist_preview[ on | off | toggle ]
playlist_load[ filename ]
playlist_save[ filename ] - saves the playlist. If the filename is blank (e.g. playlist_save[ ]) the current playlist filename is used.
playlist_size - returns playlist_size[ ] response containing number of items and playing time
playlist_getitem [ # ] - returns the playlist_item[ ] response containing information about the requested item in the playlist
playlist_pointer[ random | top | bottom | next | prev | # ] - move selection pointer. # represents a position in the playlist, the first position being 1
playlist_getpointer - returns the playlist pointer position using the playlist_pointer[] response
playlist_insert[ random | top | bottom | next  | # , CDJ ID, tracknum ] - inserts an item from the library identified by its CDJ ID and track number in the specified location in the playlist. A tracknum of 0 indicates that the item is a disc / album, not a track.
playlist_delete[ random | top | bottom | next | prev | cur | # ] - deletes the item at the specified location from the playlist
playlist_delete_matching[ CDJ ID , all | # ] - deletes the matching items playlist identified by CDJ ID and track number. A tracknum of 0 indicates that the item is a disc / album, not a track. The "all" options deleted any item with a matching CDJ ID.

Search Related

search_mode[ disc | track ] - switches between listing disc and track matches in the search
search_clear - clears search results (in turn causing the shuffle mode to use all library items)
search[ search query ] - performs a search using the CDJ query language
searchlist_size - returns searchlist_size[ ] response containing number of items and playing time
searchlist_getitem [ # ] - returns the searchlist_item[ ] response containing information about the requested item in the searchlist

 

Library Related

library_load[ filename ] - loads the specified library file, which becomes the default library. Not specifying a filename will cause the current library to be reloaded.
library_save - saves the changed items in the library to the database
library_save_all[ filename] - saves all of the library contents using the specified filename, which becomes the default library. Not specifying a filename will cause the current library filename to be used.
library_autosave[ on | off ] - changes the state of library autosave option
library_autosave_interval[ minutes ] - changes the library autosave interval
library_discsearch[ player # | all , start slot # | all, stop slot # , empty | emptyfull | allslots, now | queue ] - search for discs in the players. This command parallels the search for discs dialog. The first parameter is which player to search (by number) or all to search all players. The second and third numbers tell which slots to examine if a single player is chosen. Choosing all as a start slot searches all slots within the changer. The next item is the search type, which can be empty (search empty slots), emptyfull (search empty, verify full slots), allslots (load every slot). The final item determine whether the located disc will be looked up in CDDB immediately or queued for later lookup. There are a number of CDJ responses which indicate the progress of the disc search
library_lookup_queued - looks up any queued discs which may be present. There are a number of CDJ responses which indicate the progress of the lookups

Notification Modes

notify_playing_item[ on | off ] - when on, gives the playing[....] response every time a new track is playing. Also gives the playing[....] response immediately after this command is issued to allow you to poll the current playing item.
notify_playing_timecode[ on | off ] - when on, gives the time[...] response every second something is playing
debug[ on | off ] - turns on / off various CDJ debugging messages

Misc

vol+
vol-
mute[ on | off | toggle ]
sleep - causes CDJ to perform shutdown proceedures (including the cdjr:shutdown event), but stay running. This is useful for shutting down the players but keeping CDJ ready to respond quickly when you want to turn it back on when the cdj:awaken command
awaken - resumes from the sleep state and turns on the players the cdjr:pre_startup and cdjr:startup events are executed again
sleepawakentoggle - toggles CDJ between the sleep and awake state each time the command issued.
exit - causes CDJ to close. Make sure the libarary autosave feature is enabled to prevent library save dialogs from hindering the close of CDJ.
getstate - causes CDJ to return the cdjr:state event. This can be used to detect if CDJ is running and what state it is in.
shell [ executable name , parameters , working directory ] - runs the specified program with the given command line parameters in the supplied working directory. The parameters and working directory are optional.
echo [ anything ] - cause CDJ to return the cdjr:echo [ ] event with the same contents. This is useful for sending timestamps which you can wait to receive to insure that CDJ has reached a certain potin in your command stream.
cancel - equivalent to pressing the cancel button on a progress dialog. Useful for cancelling disc searches, etc.
list_players - causes CDJ to return player_info responses for each player CDJ operates

Responses

General

pre_startup - CDJ is starting, but hasn't located players yet. If you use relays to control the interconnection of S-Link busses, this is the time to properly connect the busses for CDJ's use.
startup - CDJ is starting and has located players. At this point you could send additional commands to the players since these devices are now loaded. This is a good time turn on the rest of the stereo.
shutdown - CDJ is about to shut down.You might want to turn off the stereo here. There is no need to shut of the players as there is a CDJ option to do this automatically.
vol_up - the user has opted to increase the volume via the toolbar volup.gif (925 bytes). You would typically map this to your receiver's volume up remote button.
vol_down - the user has opted to decrease the volume via the toolbar voldown.gif (918 bytes). You would typically map this to your receiver's volume down remote button.
mute_on - the user has opted to mute the output via the toolbar mute.gif (945 bytes). You would typically map this to your receiver's mute remote button. If you have seperate mute on and off functions, you could use the "mute on" device command to be sure the CDJ toolbar display is actually in sync with the receiver's mute function.
mute_off - the user has opted to un-mute the output via the toolbar mute.gif (945 bytes). You would typically map this to your receiver's mute remote button. If you have seperate mute on and off functions, you could use the "mute off" device command to be sure the CDJ toolbar display is actually in sync with the receiver's mute function.
state [ sleeping | paused | playing | stopped ]  - a response to the getstate command (see above) indicating CDJ is alive and what mode it is in.
echo [ anything ] - echoes whatever you have sent with the echo [ ] command.

Playlist Related

playlist_play
playlist_stop
playlist_pause
playlist_size[ entries, min:sec ] - a response to the playlist_size command. Tells the number of entries in the playlist and the total playing time.
playlist_pointer[ pos ] - indicates the pointer position in the playlist, the first position being 1. 0 is returned if the playlist is empty.
playlist_item["pos", "album","artist","title","totmin:totsec","image file","CDJ ID","tracknum" ] - information about the requested playlist item. A tracknum of 0 indicates that the item is a disc / album, not a track.

Search Related

searchlist_size[ entries, min:sec ] - a response to the searchlist_size command. Tells the number of entries in the searchlist and the total playing time.
searchlist_item["pos", "album","artist","title","totmin:totsec","image file","CDJ ID","tracknum" ] - information about the requested searchlist item. A tracknum of 0 indicates that the item is a disc / album, not a track.

Library Related

library_discsearch_start - a disc search has begun.
library_discsearch_end - a disc search has completed.
library_discsearch_title - text describing the nature of the search (same as what is in the progress dialog title)
library_discsearch_status["player","slot","progress","progress size"] - indicates which player and slot CDJ is currently search along with information to drive a progress indicator.

Playback Related

playing[ "album","artist","title","totmin:totsec","image file","CDJ ID","tracknum" ] - information about the current item playing
time[ min:sec ] - current position in track
using_player[ player name ] - CDJ is about to start playing on this player. Valid player names include "mp3","cd1","cd2", etc. If you do not combine all of your audio sources with a mixer, you would typically use this event to switch inputs on your receiver to the input which is connected to the audio output of this player.

Player Related

player_info[ playername,"description","mediatypes",capacity,location ] - information about players operated by CDJ.
playername is the CDJ player name, e.g. cd1,cd2,cd3,mp3, etc..  player_info[end,"",] is returned after all player_info responses have been sent.
"description" is a text description of the player, e.g. "CDP-CX300" or "Xaudio Decoder"
"mediatypes" describes what types of media this player plays, e.g. "cd", "dvd","md","mp3 wav"
capacity is the number of media items the player stores. If not applicable, the value is 0.
location is a string describing how the player is connected to CDJ. In the case of Sony CD players, this is a 3 digit number - the digits being the slinke (0-?), s-link port (0-3), and player ID (1-3) numbers respectively. Software-only players return software

Errors

error[ error message ]