diff options
| author | julian laplace <julescarbon@gmail.com> | 2025-07-05 17:06:59 +0200 |
|---|---|---|
| committer | julian laplace <julescarbon@gmail.com> | 2025-07-05 17:06:59 +0200 |
| commit | 200c1a4f0ebd3188faebaea8e7278fc5105227cf (patch) | |
| tree | 12f61dcd756ba57e0f718b87e4eb0e9c30d90f4d /client/lib/kalimba.js | |
| parent | d82f99fd89e23fdb62598b616e39537360a10f74 (diff) | |
laod sample
Diffstat (limited to 'client/lib/kalimba.js')
| -rw-r--r-- | client/lib/kalimba.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/client/lib/kalimba.js b/client/lib/kalimba.js index 3d239a5..64ace00 100644 --- a/client/lib/kalimba.js +++ b/client/lib/kalimba.js @@ -1,3 +1,8 @@ +/** + * Kalimba + * @module lib/kalimba.js; + */ + import Tone from "tone"; import { choice } from "./util"; @@ -44,13 +49,11 @@ let last = 440; function play(freq) { last = freq; - const best = choice(samples); - best.index = (best.index + 1) % player_count; - - const player = best.players[best.index]; - player.playbackRate = freq / best.root; - // console.log(player.name); + const sample = choice(samples); + sample.index = (sample.index + 1) % sample.players.length; + const player = sample.players[sample.index]; + player.playbackRate = freq / sample.root; player.start(); } |
