> For the complete documentation index, see [llms.txt](https://bennykok.gitbook.io/rhythm-game-starter/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bennykok.gitbook.io/rhythm-game-starter/note-sequences/recording-mode.md).

# 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&#x20;

![](https://32629026-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76iL7-CNlRUwW2lAqS%2F-MFk4o8L2t-cEbNDDgjX%2F-MFkBZdHn7I3bfo1byQW%2Fimage.png?alt=media\&token=fd09f678-6759-42e5-8e41-70ce27db0847)

For any existing scene, drag and drop the NoteRecorder prefab&#x20;

![](https://32629026-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76iL7-CNlRUwW2lAqS%2F-MFk4o8L2t-cEbNDDgjX%2F-MFk8amIi1UMNZhw5ofJ%2Fimage.png?alt=media\&token=4fa10ca3-bfee-4250-9e35-fb79eb3fdbc9)

### 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.&#x20;

![Hierarchy Overview](https://32629026-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76iL7-CNlRUwW2lAqS%2F-MFkCzxkTXePde67ICBl%2F-MFkHxYuc63wt1HhU_x3%2Fimage.png?alt=media\&token=3a8352f8-a3ba-4155-9409-11596d5be6c3)

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

![Note Recorder Prefab UI ](https://32629026-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76iL7-CNlRUwW2lAqS%2F-MFkCzxkTXePde67ICBl%2F-MFkMfDtCXge70AXEkz7%2Fimage.png?alt=media\&token=d8a06364-022b-40bb-8369-dbb674f9deb4)

![File Browser](https://32629026-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76iL7-CNlRUwW2lAqS%2F-MFkZyID0mg05rcAJXKi%2F-MFkapkxOxO2MfeVA5Ze%2Fimage.png?alt=media\&token=80c13737-a532-4f2e-8cab-28ed726657ec)

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

![Main components of the Recorder Prefab](https://32629026-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76iL7-CNlRUwW2lAqS%2F-MFkNzLYFYJ-O7diZaU2%2F-MFkO1xaBOPw0O5Tm6jG%2Fimage.png?alt=media\&token=f54bca19-9612-468f-b57c-d1f0dc3cfc59)

![](https://32629026-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76iL7-CNlRUwW2lAqS%2F-MFpGX-tPgy0K3SIotPo%2F-MFpHU4FHI-u1stPFPIH%2Fimage.png?alt=media\&token=bda4bee4-30b0-4b3f-9426-d44c07dc95c2)

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`

{% code title="NoteRecorder.cs" %}

```csharp
/// <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);
```

{% endcode %}

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.

![](https://32629026-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76iL7-CNlRUwW2lAqS%2F-MFkO_oznuo_Br7BZ0uy%2F-MFkPE06fisz-5mhgJFT%2Fimage.png?alt=media\&token=d83f7fd0-dea3-438b-a09c-d13ef074ced1)

### Retrieving JSON files

The recorded JSON file by default saved to the `Application.persistentDataPath`&#x20;

#### Editor

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

![](https://32629026-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76iL7-CNlRUwW2lAqS%2F-MFkQLTMbyl0_hSTqCIZ%2F-MFkVaV8GjwOTdDfB0Yo%2Fimage.png?alt=media\&token=662edf2e-dc45-4e64-b047-3b1d5cda83d9)

#### iOS

{% hint style="warning" %}
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&#x20;

* UIFileSharingEnabled
* LSSupportsOpeningDocumentsInPlace

<https://www.appcoda.com/files-app-integration/>
{% endhint %}

Using iOS's Files app

![](https://32629026-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76iL7-CNlRUwW2lAqS%2F-MFkbDGJ_0QRjsnLbA57%2F-MFkf1SUyNZ3TzIAMRSD%2Fimage.png?alt=media\&token=aec5ffe5-5b44-420d-bfb3-087928be2a7e)

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.

{% code title="PlistPostProcessExample.cs" %}

```csharp
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
    }
}
```

{% endcode %}

#### 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.

![](https://32629026-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76iL7-CNlRUwW2lAqS%2F-MFmwda-xOwtF1gHgKhH%2F-MFmwlpKt9ovar_ZZvEM%2Fimage.png?alt=media\&token=c9680c85-3aeb-41d2-93e8-cbb3d438e68c)

### Importing the JSON file back

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

![](https://32629026-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76iL7-CNlRUwW2lAqS%2F-MFkiGahWrGoxZ2O6LBP%2F-MFkj8HtdUh7HgS_fOA3%2Fimage.png?alt=media\&token=b0c5a364-b168-44c6-9bba-d7ebc662df08)

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...

![](https://32629026-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76iL7-CNlRUwW2lAqS%2F-MFkiGahWrGoxZ2O6LBP%2F-MFkikMztlnD5UP2t5rA%2Fimage.png?alt=media\&token=63cbb30d-36cd-43a3-b5a9-5a523a07ac40)

![](https://32629026-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M76iL7-CNlRUwW2lAqS%2F-MFkiGahWrGoxZ2O6LBP%2F-MFkiu41RbPnxYBBFHl6%2Fimage.png?alt=media\&token=04653626-2fd5-4c5e-bba4-57bf31c71f69)

### Video

{% embed url="<https://youtu.be/jQsHNnFmRh4>" %}
