Skip to content

Instantly share code, notes, and snippets.

@TomasKostadinov
Last active January 30, 2019 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TomasKostadinov/27c8ebf5c20fb6ccf0bfaa798d4cf493 to your computer and use it in GitHub Desktop.
Save TomasKostadinov/27c8ebf5c20fb6ccf0bfaa798d4cf493 to your computer and use it in GitHub Desktop.
Using a Rane 72 to Control Spotify
on runme(message)
if (item 1 of message = 191) and (item 2 of message = 0) and (item 3 of message = 65) then
tell application "Spotify"
next track
end tell
end if
if (item 1 of message = 191) and (item 2 of message = 0) and (item 3 of message = 63) then
tell application "Spotify"
previous track
end tell
end if
if (item 1 of message = 190) and (item 2 of message = 45) then
tell application "Spotify"
set faderVol to item 3 of message
set sound volume to (faderVol / 128) * 100
end tell
end if
if (item 1 of message = 158) and (item 2 of message = 17) and (item 3 of message > 0) then
tell application "Spotify"
if shuffling is false then
set shuffling to true
else
set shuffling to false
end if
end tell
end if
if (item 1 of message = 159) and (item 2 of message = 50) and (item 3 of message > 0) then
using terms from application "Spotify"
if player state of application "Spotify" is paused then
tell application "Spotify" to play
else
tell application "Spotify" to pause
end if
end using terms from
end if
end runme
@TomasKostadinov
Copy link
Author

TomasKostadinov commented Jan 30, 2019

Why?

Because I use my Rane 72 on a daily basis not only with Serato but also with Spotify I wanted to be able to control my music with my mixer.

Prerequisites

Requirements: You will need a MacOS Computer and a Rane 72 Mixer for this script to work, but the script can be modified to work on any other midi controller.

I'm using the Rane 72 as my main audio output device so I can control the volume using the faders/knobs on the mixer. This step is not needed and optional. To configure the Rane 72 as your main audio output open the audio and midi setup application.

bildschirmfoto 2019-01-30 um 15 25 17

Press configure speaker and select which channel you want to output your pc's sound to:

bildschirmfoto 2019-01-30 um 15 25 25

You could use USB Aux which will output the sound as a sampler, the volume then can be controlled using the 'Sampler Level' knob, you can then also listen to the sound via the main cue mix. I prefer using Deck 1 because of the access to the 3 Band EQ and Effects.

How to use

  1. Install MidiPipe
  2. Drag and drop Midi In into your Pipe, then select the Rane 72

bildschirmfoto 2019-01-30 um 15 14 02

  1. Drag and drop AList into your Pipe, this tool can be used for debugging because it outputs any incoming midi signals
  2. Drag and drop AppleScript Trigger into your pipe and paste the above code

bildschirmfoto 2019-01-30 um 15 13 48

  1. Open Spotify
  2. Press the buttons on the mixer to control Spotify as described below
Button Function
Shift Start/Stop
Scroll Knob Previous/Next Track
Sampler Level Knob Spotify Volume
Session In Cue Shuffle On/Off

You could expand this as you like and even map tracks and playlists to a special midi button or assign a special button to open Spotify. This script can also be modified to work on iTunes and other players.

Sources and further reading

This was inspired by Jake Hebbert's Video "Controlling PhotoShop with a Korg NanoKontrol via midiPipe and AppleScripts".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment