Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

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

Notifications You must be signed in to change notification settings

generativefm/samples.generative.fm

Repository files navigation

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.

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published