Skip to the content

Toranpuトランプ

Use a deck, play eleven games with computers, solve a solitaire, or display cards in your own design.

Toranpu is Japanese for playing cards. About the name

Contents

Reference

Sound controls

import { … } from "@johnmorrisdotca/toranpu/card-sounds";

42.9 kB minified and gzipped, with everything it imports (measured with esbuild)

The sounds of a card table, from real recorded cards: a card dealt, turned over or played, the deck shuffled, a pile gathered in, a hand fanned. Off unless a table asks: nothing plays and nothing is fetched until play.

import { createCardSounds } from "@johnmorrisdotca/toranpu/card-sounds";

const sounds = createCardSounds();
sounds.play("shuffle");
sounds.play("deal", { count: 13, delay: 900 });

The recordings themselves are @johnmorrisdotca/toranpu/sounds, loaded by the first sound played. Kenney's Casino Audio, CC0: see docs/credits.md.

Exports

NameKindWhat it is
CARD_SOUND_KINDSconstantEvery kind of sound, in the order a game meets them.
CardSoundDatatypeThe recordings, by name (deal-2), as base64 AAC.
CardSoundKindtypeOne kind of sound: deal a card sent to a hand, flip a card turned over, play a card laid on the table, shuffle the deck shuffled, gather a pile swept in, fan a hand spread open.
CardSoundstypeA table's sounds: play one, mute and unmute, change the volume, close when the table goes.
CardSoundsOptionstypeHow a table's sounds are made.
CardSoundWindowtypeThe parts of a window the sounds use: an audio context and atob.
createCardSoundsfunctionA table's card sounds.
MOST_SOUNDS_AT_ONCEconstantAs many sounds as one call plays: thirteen cards dealt are eight slides, not a wall of noise.
PlayCardSoundOptionstypeHow one sound is played.
soundTimesfunctionWhen each of count sounds starts, in milliseconds from the first: one every gap, and no more than MOST_SOUNDS_AT_ONCE, spread over the same time.

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/toranpu 2.15.0.