mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-22 19:18:31 +00:00
Merge pull request #196 from tidalcycles/fix-numbers-in-sampler
Fix numbers in sampler
This commit is contained in:
commit
88e1211762
@ -70,9 +70,6 @@ const getSoundfontKey = (s) => {
|
|||||||
|
|
||||||
const getSampleBufferSource = async (s, n, note) => {
|
const getSampleBufferSource = async (s, n, note) => {
|
||||||
let transpose = 0;
|
let transpose = 0;
|
||||||
if (note) {
|
|
||||||
transpose = toMidi(note) - 36; // C3 is middle C
|
|
||||||
}
|
|
||||||
const ac = getAudioContext();
|
const ac = getAudioContext();
|
||||||
// is sample from loaded samples(..)
|
// is sample from loaded samples(..)
|
||||||
const samples = getLoadedSamples();
|
const samples = getLoadedSamples();
|
||||||
@ -93,7 +90,9 @@ const getSampleBufferSource = async (s, n, note) => {
|
|||||||
if (!note) {
|
if (!note) {
|
||||||
throw new Error('no note(...) set for sound', s);
|
throw new Error('no note(...) set for sound', s);
|
||||||
}
|
}
|
||||||
const midiDiff = (noteA) => toMidi(noteA) - toMidi(note);
|
const midi = typeof note === 'string' ? toMidi(note) : note;
|
||||||
|
transpose = midi - 36; // C3 is middle C
|
||||||
|
const midiDiff = (noteA) => toMidi(noteA) - midi;
|
||||||
// object format will expect keys as notes
|
// object format will expect keys as notes
|
||||||
const closest = Object.keys(bank)
|
const closest = Object.keys(bank)
|
||||||
.filter((k) => !k.startsWith('_'))
|
.filter((k) => !k.startsWith('_'))
|
||||||
|
|||||||
@ -55,8 +55,9 @@ Pattern.prototype.piano = function () {
|
|||||||
return this.clip(1)
|
return this.clip(1)
|
||||||
.s('piano')
|
.s('piano')
|
||||||
.fmap((value) => {
|
.fmap((value) => {
|
||||||
|
const midi = typeof value.note === 'string' ? toMidi(value.note) : value.note;
|
||||||
// pan by pitch
|
// pan by pitch
|
||||||
const pan = panwidth(Math.min(toMidi(value.note) / maxPan, 1), 0.5);
|
const pan = panwidth(Math.min(midi / maxPan, 1), 0.5);
|
||||||
return { ...value, pan: (value.pan || 1) * pan };
|
return { ...value, pan: (value.pan || 1) * pan };
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user