Recording Mode [0.5+]

Available to v0.5 and above

The most direct, intuitive, enjoyable way of creating note sequences has arrived finally! Thanks to all the suggestions and support from the discord server!

Example scenes & prefab

Check directly for the recorder specific demo scene at

For any existing scene, drag and drop the NoteRecorder prefab

Overview

With the new recording mode demo, it will listen to Tap / Swipe / Long Press gestures, and record directly to a JSON file and save it on to the device.

The Note Recorder demo consists of a UI panel for on-device recording control and File browser

Switching to the "File" tab will let you view all the previous recorded history and preview them as if you were playing it.

Recording Target

To record a different song, add your new SongItem into the RecordingTarget list.

To set the recording target via code, there is a method for you in the NoteRecorder

NoteRecorder.cs
/// <summary>
/// Set the new recording target, usually a SongItem with blank or reference sequence
/// </summary>
/// <param name="songItem">New Recording Target</param>
public void SetRecordingTarget(SongItem songItem);

If you are in the editor, you can enable "Save In Editor", which will directly save a copy of the current recording target's SongItem with the new sequence inside your project folder.

Retrieving JSON files

The recorded JSON file by default saved to the Application.persistentDataPath

Editor

You can visit the location by this little menu helper in the editor.

iOS

In order for the files in Application.persistentDataPath to show up in the IOS Files app, you will need to have 2 plist values set to true

  • UIFileSharingEnabled

  • LSSupportsOpeningDocumentsInPlace

https://www.appcoda.com/files-app-integration/

Using iOS's Files app

Here is an example of setting the plist values in a build post process script. Be aware that all files saved in Application.persistentDataPath will now be visible to the end-users.

PlistPostProcessExample.cs
public class PlistPostProcessExample : IPostprocessBuildWithReport // Will execute after XCode project is built
{
    public int callbackOrder { get { return 0; } }

    public void OnPostprocessBuild(BuildReport report)
    {
#if UNITY_IOS
        if (report.summary.platform == BuildTarget.iOS) // Check if the build is for iOS 
        {
            string plistPath = report.summary.outputPath + "/Info.plist"; 

            PlistDocument plist = new PlistDocument(); // Read Info.plist file into memory
            plist.ReadFromString(File.ReadAllText(plistPath));

            PlistElementDict rootDict = plist.root;

            // Enable the files to display in the Files app on ios
            // https://www.appcoda.com/files-app-integration/
            rootDict.SetBoolean("UIFileSharingEnabled", true); 
            rootDict.SetBoolean("LSSupportsOpeningDocumentsInPlace", true);

            File.WriteAllText(plistPath, plist.WriteToString()); // Override Info.plist
        }
#endif
    }
}

Android

You can directly browse in your Android Files app, or connect to your desktop to extract the file. The package name may vary due to your project's settings.

Importing the JSON file back

After you have recorded the note sequence, it will be stored as a JSON file.

There's a JSON import option at the SongItem inspector, you can then locate and import back any JSON file that has this type of structure. You can even code your own note recorder...

Video

Last updated