Node.Js Freesound

frank desben's icon

Dear all,
I am getting this error message when trying to use the freesound example (from the Cycling74/n4m-examples github page) with node.script:
"node.script: No value for key FREESOUND_CLIENT_KEY in .env file. Please make sure to create a file called .env with a Freesound API Client key."
Can someone tell me how to fix this?
Thank you! Frank

Jeremy's icon

From the README:

Getting an API key

Before you can do anything with Freesound, you'll need an API key.

Get a Freesound account. It's free. Go to www.freesound.org and sign up.

After you've logged in go to https://freesound.org/apiv2/apply/

Fill in the form to apply for a new set of API keys.

You may notice that Freesound has fewer keys than Twitter. That's because Freesound only hands out client keys, not access keys. So, whereas using the access keys someone could post tweets from your Twitter account, the same isn't true for Freesound.

Anyway, note down the client ID and API key.

In this freesound folder, you should see a file named .env-template. This is an environment file, it contains key-value pairs that other applications, like Node, can load before running.

Duplicate the .env-template file to a new file named .env. It must be named .env, not my.env or anything like that. Fill in this file using the keys you got from Freesound.

You should be all set. Open the Max patcher freesound.maxpat and see!
frank desben's icon

Thanks for this !!

In my folders I can't find the .env-template file,
is there a place I can download it?

Jeremy's icon

You need to make invisible files visible for the folder in order to see it. On OSX, this is Cmd-Shift-.

Pi4 B's icon

Still, not working even after modifying the .env file, i run npm install and everything but the patch can't find anything

klaus filip's icon

hi,
i can confirm, the example is not working.
my .env seems to be ok, the script is not complaining.
i can post my token with maxAPI.post("token", token);
just before the freesound.textSearch
but nothing comes from response.
instead there is an "err" but without any error-code.


Florian Demmer's icon

Just a quick heads up that the freesound example got a little update which fixes the issue you were seeing. The example is available on Github: https://github.com/Cycling74/n4m-examples/tree/master/freesound