Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scores not playing in NFSmartPlayerCLI tool #3

Open
PaulSlocum opened this issue May 27, 2021 · 1 comment
Open

Scores not playing in NFSmartPlayerCLI tool #3

PaulSlocum opened this issue May 27, 2021 · 1 comment

Comments

@PaulSlocum
Copy link

I've built the library (libNFSmartPlayer.a) and the command line tool (NFSmartPlayerCLI) on MacOS 10.15.6, but I can't get the command line tool to play. I added some debug output, and I can see that it successfully converts the JSON and loads the score, but I either get an error or playback stops at 0 seconds, depending on which score I use. I wasn't able to find a definitive test score in the documentation, so it's possible that there could be something incorrect about how I'm constructing the JSON score. I'm including the scores that I've tried below.

I thought the noise plugin would work for a simple test score, and although the CLI tool accepts the score, it doesn't play anything and playback stops at zero:

{
  "graph": {
    "id": "graphId1",
    "loadingPolicy": "allContentPlaythrough",
    "nodes": [
      {
        "id": "noiseId1",
		"kind": "com.nativeformat.plugin.noise.noise",
		"config": 
		{
			"when": 0,
			"duration": 2000
        },
        "params": {}
      }
    ],
    "edges": [
    ],
    "scripts": []
  },
  "version": "1.2.24"
}

...and this is the output from running the CLI with the above score (with some extra debug output added by me):

paulslocum@Pauls-MacBook-Pro cli % ./NFSmartPlayerCLI --input-file test8.json
Native Format Command Line Interface 7-f74da5b
Loading JSON
DECODING JSON
PARSED JSON: {"graph":{"edges":[],"id":"graphId1","loadingPolicy":"allContentPlaythrough","nodes":[{"config":{"duration":2000,"when":0},"id":"noiseId1","kind":"com.nativeformat.plugin.noise.noise","params":{}}],"scripts":[]},"version":"1.2.24"}
CREATING GRAPH FROM GRAPH IMPLEMENTATION
LOADING...
Initialised playback.
Time: 0
Final time: 0
Finished rendering...

I've also tried the score described in the NFGrapher Javascript documentation, but it doesn't work with "spotify:track:275KAjHjZOtnTVWZ2Kcr7k" as the 'file', and I've tried changing the 'file' to a local mp3 or an mp3 on my web server, but the CLI just says "Failed to play the JSON file." I also noticed that the file duration is set to 0 (not sure if this is a mistake or if the loop overrides this duration) but I tried changing the file duration to "10000" and I still get the same results.

{
  "graph": {
    "id": "07f96d1b-2d3f-46e8-bbc5-c424f30a19c3",
    "loadingPolicy": "allContentPlaythrough",
    "nodes": [
      {
        "id": "2eedb6a8-3230-4fc6-9343-f140d5b29af1",
        "kind": "com.nativeformat.plugin.file.file",
        "config": {
          "file": "spotify:track:275KAjHjZOtnTVWZ2Kcr7k",
          "when": 0,
          "duration": 0,
          "offset": 0
        },
        "params": {}
      },
      {
        "id": "5f5ec094-3471-404f-9566-bcdce8f8df4c",
        "kind": "com.nativeformat.plugin.time.loop",
        "config": {
          "when": 0,
          "duration": 5600000000,
          "loopCount": -1
        },
        "params": {}
      },
      {
        "id": "7f08e466-650c-4960-ab02-dbecea03daab",
        "kind": "com.nativeformat.plugin.waa.gain",
        "config": {},
        "params": {
          "gain": [
            {
              "name": "setValueAtTime",
              "args": {
                "value": 0,
                "startTime": 0
              }
            },
            {
              "name": "linearRampToValueAtTime",
              "args": {
                "value": 1,
                "endTime": 3000000000
              }
            }
          ]
        }
      }
    ],
    "edges": [
      {
        "id": "eb4cfcc1-4829-4200-b0c9-810075c865eb",
        "source": "2eedb6a8-3230-4fc6-9343-f140d5b29af1",
        "target": "5f5ec094-3471-404f-9566-bcdce8f8df4c"
      },
      {
        "id": "abb01f3b-26de-4efa-9e79-b30e8a1bde44",
        "source": "5f5ec094-3471-404f-9566-bcdce8f8df4c",
        "target": "7f08e466-650c-4960-ab02-dbecea03daab"
      }
    ],
    "scripts": []
  },
  "version": "1.2.24"
}

Thanks in advance for any information you can provide.

@PaulSlocum
Copy link
Author

We're probably not going to use this library because we encountered too many issues, but I'm adding information about what we found in case it helps anybody else.

The library had a lot of build configuration issues, and was challenging to get building in the first place, required various changes to CMake, scripts, and Gyp configurations. Even thought I did get it to build successfully, I was never able to get any sound output working.

In debugging the issues I outlined above with the CLI tool, I found that the noise plugin was being instantiated but its audio callback was never being called. I traced this to a problem with NFDriver where the Apple Audio Units were being loaded correctly but never triggering a callback. I tried switching to outputting to a file instead of the sound card, and this did get the noise plugin callback working, but the file writer never would write a valid WAV file output. Either the file was empty or not a valid WAV file.

I tried playing files using the File Plugin instead of using the noise plugin, and MP3 files always failed to play. When I tried to play WAV files, it didn't give an error but seemed to be stuck in a loop that I had to use CTRL+C to break.

I tried all of this on OSX, so perhaps it works better on other platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant