All Projects → generativefm → samples.generative.fm

generativefm / samples.generative.fm

Licence: other
[DEPRECATED] Browser and Node client for accessing files from samples.generative.fm

Programming Languages

javascript
184084 projects - #8 most used programming language

DEPRECATED

Replaced by @generative-music/samples-alex-bainter.

samples.generative.fm

Browser and Node client for accessing files from samples.generative.fm.

Access to samples.generative.fm is currently restricted with CORS. Unrecognized origins will not be able to fetch audio files.

Usage

There are three ways to import the client.

1. Environment Automatic Detection

This method will detect if the package has been imported in a browser or Node environment.

import fetchSpecFile from 'samples.generative.fm';
// or
const fetchSpecFile from 'samples.generative.fm';

2. Browser-only

import fetchSpecFile from 'samples.generative.fm/browser-client';

3. Node-only

const fetchSpecFile from 'samples.generative.fm/node-client';

The imported function can be used like so:

fetchSpecFile('my-sample-host.com', 'sample-spec.json').then(sampleInfo => {
  console.log(sampleInfo.samples['sampled-instrument'].ogg['A4']);
  // outputs something like 'https://samples.generative.fm/sampled-instrument/ogg/<filename>.ogg'
});

API

fetchSpecFile([baseUrl], [filename])

Returns an object containing information about the samples.

Parameters

  • baseUrl (string) [optional, default 'https://samples.generative.fm']: Prepended to all requests.
  • filename (string) [optional, default 'index.<CURRENT_PKG_VERSION>'.json]: The filename to use when fetching the spec file.

Local Development

The package is built with npm run build:pkg.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].