mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-24 20:18:34 +00:00
Add shabda shortcut (#406)
This commit is contained in:
parent
4fa0a9064b
commit
289820188e
@ -147,7 +147,12 @@ function getSamplesPrefixHandler(url) {
|
|||||||
* sd: '808sd/SD0010.WAV'
|
* sd: '808sd/SD0010.WAV'
|
||||||
* }, 'https://raw.githubusercontent.com/tidalcycles/Dirt-Samples/master/');
|
* }, 'https://raw.githubusercontent.com/tidalcycles/Dirt-Samples/master/');
|
||||||
* s("[bd ~]*2, [~ hh]*2, ~ sd")
|
* s("[bd ~]*2, [~ hh]*2, ~ sd")
|
||||||
*
|
* @example
|
||||||
|
* samples('shabda:noise,chimp:2')
|
||||||
|
* s("noise <chimp:0*2 chimp:1>")
|
||||||
|
* @example
|
||||||
|
* samples('shabda/speech/fr-FR/f:chocolat')
|
||||||
|
* s("chocolat*4")
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const samples = async (sampleMap, baseUrl = sampleMap._base || '', options = {}) => {
|
export const samples = async (sampleMap, baseUrl = sampleMap._base || '', options = {}) => {
|
||||||
@ -162,6 +167,21 @@ export const samples = async (sampleMap, baseUrl = sampleMap._base || '', option
|
|||||||
path = path.endsWith('/') ? path.slice(0, -1) : path;
|
path = path.endsWith('/') ? path.slice(0, -1) : path;
|
||||||
sampleMap = `https://raw.githubusercontent.com/${path}/strudel.json`;
|
sampleMap = `https://raw.githubusercontent.com/${path}/strudel.json`;
|
||||||
}
|
}
|
||||||
|
if (sampleMap.startsWith('shabda:')) {
|
||||||
|
let [_, path] = sampleMap.split('shabda:');
|
||||||
|
sampleMap = `https://shabda.ndre.gr/${path}.json?strudel=1`;
|
||||||
|
}
|
||||||
|
if (sampleMap.startsWith('shabda/speech')) {
|
||||||
|
let [_, path] = sampleMap.split('shabda/speech');
|
||||||
|
path = path.startsWith('/') ? path.substring(1) : path;
|
||||||
|
let [params, words] = path.split(':');
|
||||||
|
let gender = 'f';
|
||||||
|
let language = 'en-GB';
|
||||||
|
if (params) {
|
||||||
|
[language, gender] = params.split('/');
|
||||||
|
}
|
||||||
|
sampleMap = `https://shabda.ndre.gr/speech/${words}.json?gender=${gender}&language=${language}&strudel=1'`;
|
||||||
|
}
|
||||||
if (typeof fetch !== 'function') {
|
if (typeof fetch !== 'function') {
|
||||||
// not a browser
|
// not a browser
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user