The Song Sync (S-SYNC) device allows you to play songs from other sources and synchronize them with Patchwork devices. Working in Unreal Editor for Fortnite, you can sync a level sequence to the imported sound data. When you import MIDI files into the device, you can generate Patchwork note data output to control other audio or events!
Possible uses:
-
Set up a virtual concert with pre-recorded audio, then use Patchwork to control the timing of audiovisual effects in sync with that audio.
-
Build musical gameplay experiences ranging from rhythm action, like Fortnite Festival, to platformers where hazards and enemies move to the music, or racing games where the song you select changes the track layout, and more!
-
Play a pre-recorded vocal track and mix live Patchwork audio with it.
The video below gives a preview of possibilities when using the Song Sync device:
Device Options
Option | Values | Description |
---|---|---|
1. Enabled Switch l | On, Off | When disabled, the device does not play content or output note data. |
2. Expand Buttons | Closed, Open | Expand the device to reveal more customization options. |
3. Note Out Cable | N/A | Connect the Note Out cable to a yellow Note In port. |
4. Playback Time Counter | N/A | Shows the current playback time and the total time for the displayed MIDI asset, Level Sequence, or synced device. |
5. Linked Song Syncs icon | N/A | Indicates if any other Song Sync devices are linked to this one. There are 2 possible states:
|
6. Controls Tempo icon | N/A | Indicates whether the Controls Tempo Play Behavior is selected. There are 4 possible states:
|
7. Sync Target display | N/A | If you’ve selected a MIDI asset for the device, its name is shown here. If not, the name of the longest Level Sequence or synced device is shown. |
8. Stop Button | N/A | End output of selected track. Disabled until playback begins. |
9. Play Button | N/A | Begins playback of any MIDI file and Sync Targets. Disabled if neither MIDI nor Sync Targets are defined. |
UEFN Editor Options
The options appear in the UEFN Editor only, and you can choose which assets should play in sync when this device is played.
Option | Description |
---|---|
MIDI File | Select a MIDI asset in your UEFN project to be played by the device. For details on how to set up and use MIDI data, see MIDI Files below. |
Level Sequence | Select a Level Sequence in your UEFN project to be played by the device. |
Synced Devices | Select any number of other Song Sync devices to be played by the device. Triggering Play or Stop on a Song Sync device, whether with the Patchwork Tool or Event System, will also play or stop all devices in this list. |
Other Device Options
The options below can be modified in the UEFN editor, but you can also modify them in Create mode by walking up to the device and pressing E to reveal the device options.
Option | Values | Description |
---|---|---|
Play Behavior | Control Tempo, Play from Start, Play from Current Time |
|
Playback Delay | None, Next Beat, Next Bar | When this device is played, this option determines if it starts immediately or if it waits to play on a selected quantized interval. |
Looping | None, On MIDI Length, On Sequence Length | Determines whether the playback loops. The loop length must be based on either a MIDI file or a Level Sequence. If "Control Tempo" is selected for the Play Behavior user option, the global timeline will reset each time the playback loops on this device. |
MIDI track | N/A | Lets you select a track within the chosen MIDI file. |
MIDI Beat Offset | Default: 0 | Allows for notes to be delivered early/late in musical time, to enable gameplay akin to a Fortnite Festival target appearing on the note highway before it needs to be played. Offsets only affect the Note output from the device. |
MIDI Millisecond Offset | Default: 0 | The same as Beat Offset, but useful in cases where real time is more relevant than musical time. |
MIDI Starting Time | Default: 0 | Sets the starting point for MIDI playback in seconds. Any Sync Targets will have their starting points adjusted to match. |
Allow Cable Access | On, Off | Determines if the Patchwork Tool can access any cable input or output ports on the device. |
Enabled on Phase | None, Always, Pre-Game Only, Gameplay Only | Determines the game phases during which the device will be enabled. |
The following video shows you the steps needed to play your custom audio using the Song Sync device:
Playback Delay
Playback Delay is essentially the concept of quantization in music. It is like snapping notes to the beat. If a note is played a little early or late, quantization moves it to the nearest beat or rhythm spot, making the timing more exact. It helps the music sound more on time and organized.
With Playback Delay set to None and Play Behavior set to Play from Start, pressing Play on the Song Sync device will result in the sample starting at the exact moment the button is pressed, regardless of the measure count on the global timeline:
With Playback Delay set to Next Beat and Play Behavior set to Control Tempo, pressing Play will only start the sample at the start of the next beat. The Control Tempo setting will restart the measure count:
Looping
Looping determines whether the sample and/or MIDI file loaded into your Song Sync device will restart from the beginning after it finishes playing.
With Looping set to On MIDI Length and Play Behavior set to Control Tempo, the length of the MIDI file loaded into the device will determine where the device loops. The Control Tempo setting will restart the measure count:
With Looping set to On Sequence Length and Play Behavior set to Control Tempo, the length of the Level Sequence synced to the device will determine where the device loops:
The following video illustrates how quantization and looping work in the context of a real musical sample:
MIDI Files
The Song Sync device allows you to import and play MIDI files as though you were using the Patchwork Note Sequencer. Using the Note Out cable, you can patch Song Sync to an Instrument Player or an Omega Synthesizer to play the MIDI notes using Patchwork! You can also patch Song Sync output to a Note Trigger to drive Events timed to your MIDI data.
Be aware that some Digital Audio Workstations (DAWs) do not add a Tempo Map when exporting MIDI files. A MIDI file without a Tempo Map cannot control the tempo of Patchwork devices.
The following video takes a deeper dive into using the Song Sync device with a MIDI file:
When a Song Sync device Play Behavior is set to Control Tempo, it can use a MIDI file tempo map to determine the Patchwork tempo. The minimum Patchwork tempo is 60 BPM and the maximum is 180 BPM. Tempo values outside of that range will be clamped.
MIDI files can also change the Patchwork key and mode. To do this, open your MIDI file editor and add a text event in the following format at the MIDI time where you’d like the change to happen:
key KEY_NAME MODE_NAME
Sharps are denoted with #, and flats with b. Currently, only major and minor modes are supported. Some example text events:
-
key F# minor
-
key Bb major
Direct Event Binding System
Direct event binding allows devices to communicate directly, which makes your workflow more intuitive, and gives you more freedom to focus on your design ideas.
Below are the functions and events for this device:
Functions
Option | Select Device | Select Event | Description |
---|---|---|---|
Play | Click the arrow to display a list of available devices. | Click the arrow to display a list of available events. | The device is played when an event occurs. If this device can be enabled by more than one event, click Add to add a line. |
Stop | Click the arrow to display a list of available devices. | Click the arrow to display a list of available events. | The device is stopped when an event occurs. If this device can be enabled by more than one event, click Add to add a line. |
Enable | Click the arrow to display a list of available devices. | Click the arrow to display a list of available events. | The device is enabled when an event occurs. If this device can be enabled by more than one event, click Add to add a line. |
Disable | Click the arrow to display a list of available devices. | Click the arrow to display a list of available events. | The device is disabled when an event occurs. If this device can be disabled by more than one event, click Add to add a line. |
Events
Option | Select Device | Select Function | Description |
---|---|---|---|
On Played | Click the arrow to display a list of available devices. | Click the arrow to display a list of available functions. | When this device is played, a signal is sent to the linked device. This Event occurs _after _any delay set in the Playback Delay user option. |
On Stopped | Click the arrow to display a list of available devices. | Click the arrow to display a list of available functions. | When this device is stopped, a signal is sent to the linked device. |
On Playback Initiated | Click the arrow to display a list of available devices. | Click the arrow to display a list of available functions. | When the playback is initiated, a signal is sent to the linked device. This can be triggered by direct user interaction or by this device receiving a Play event. This Event occurs _before _any delay set in the Playback Delay user option. |
On Enabled | Click the arrow to display a list of available devices. | Click the arrow to display a list of available functions. | When this device is enabled, a signal is sent to the linked device. |
On Disabled | Click the arrow to display a list of available devices. | Click the arrow to display a list of available functions. | When this device is disabled, a signal is sent to the linked device. |
Using Song Sync in Verse
You can use the code below to control a Song Sync device in Verse. This code uses all features of the Song Sync device API. Modify it to fit the needs of your experience.
using { /Fortnite.com/Devices }
using { /Fortnite.com/Devices/Patchwork }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# A Verse-authored creative device that can be placed in a level
song_sync_example := class(creative_device):
@editable
SongSync:song_sync_device = song_sync_device{}
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
Sleep(5.0)
SongSync.Disable()
Print("Device Disabled")
Sleep(5.0)
SongSync.Enable()
Print("Device Enabled")
To use this code in your UEFN experience, follow these steps.
-
Drag a drum sequencer device onto your island.
-
Create a new Verse device named song_sync_example. To learn how to create a new device in Verse, see Create Your Own Device Using Verse.
-
Open Verse Explorer and double-click song_sync_example.verse to open the script in Visual Studio Code.
-
Paste in the code above, compile, and drag the Verse-authored device onto your island.
-
Select your Verse device in the Outliner.
-
In the device’s Details panel, assign the object reference for the DrumSequencer to the drum sequencer device on your island. You can use the eyedropper to pick the device in the viewport, or use the dropdown and search for the device.
-
Save your project and click Launch Session.
Song Sequencer API
See the song_sync_device
API Reference for more information on using the drum sequencer device in Verse.