Package 'drumr'

Title: Turn R into a Drum Machine
Description: Includes various functions for playing drum sounds. beat() plays a drum sound from one of the six included drum kits. tempo() sets spacing between calls to beat() in bpm. Together the two functions can be used to create many different drum patterns.
Authors: James Martherus [aut, cre]
Maintainer: James Martherus <[email protected]>
License: GPL-3
Version: 0.1.0.9000
Built: 2025-03-01 03:34:51 UTC
Source: https://github.com/jamesmartherus/drumr

Help Index


Play a drum sound

Description

beat plays a drum beat.

Usage

beat(drum = "snare", kit = "acoustic", expr = NULL)

Arguments

drum

character string or number specifying which drum is to be played by specifying one of the built in sounds. The default is "snare". Every kit includes at least four pieces:

  1. "kick"

  2. "snare"

  3. "hihat"

  4. "crash"

If drum does not match any of the options in this list, a random sound will be played.

kit

character string specifying which kit is to be used. The default is "acoustic." Possible kits are:

  1. "acoustic"

  2. "hiphop"

  3. "electro"

  4. "beatbox"

  5. "world"

  6. "r2d2"

If kit does not match any of the options in this list, a random sound will be played.

expr

An optional expression to be executed before the sound.

Examples

# Play a "snare" sound from the "acoustic" kit
beat()

# Play a bass sound from the hiphop kit.
beat(drum="kick", kit="hiphop")

Set a tempo

Description

tempo is a wrapper for Sys.time() that sets a tempo in bpm.

Usage

tempo(bpm = 120)

Arguments

bpm

A number specifying the tempo in beats per minute. Default is 120.

Examples

# Set tempo at 60 beats per minute
tempo(60)