🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

codebeat

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codebeat - npm Package Compare versions

Comparing version

to
1.0.10

6

package.json
{
"name": "codebeat",
"version": "1.0.9",
"description": "",
"version": "1.0.10",
"description": "A browser-based audio programming language for music composition and audio synthesis.",
"main": "index.js",

@@ -19,3 +19,3 @@ "directories": {

"author": "Brandon Mailhiot",
"license": "ISC",
"license": "MIT",
"bugs": {

@@ -22,0 +22,0 @@ "url": "https://github.com/lefthandhacker/Codebeat/issues"

@@ -1,9 +0,16 @@

# Recommended Usage
# Introduction
Codebeat is a browser-based audio programming language for music composition and audio synthesis. [This](https://kebo.herokuapp.com) is an example application using the codebeat module.
# Usage
Install:
~~~
npm install codebeat
~~~
Import and instantiate with voice config:
Import and instantiate with voice config:
~~~
const Codebeat = require('codebeat')
import Codebeat from 'codebeat'

@@ -17,3 +24,5 @@ const melody = new Codebeat({

~~~
Write and play music:
Write and play:
~~~

@@ -29,13 +38,9 @@ melody.update({notes: `

_Note: Up to six audio contexts (voices) can be active on the window object. Each instance of Codebeat creates a new context._
_Note:_ Up to six audio contexts (voices) can be active on the window object. Each instance of Codebeat creates a new context.
Continue reading below to learn more about writting music in Codebeat.
# Introduction
Codebeat is a javascript library that provides a simple language for music composition.
## Note duration
A note's duration is the relative amount of time it is played, known as a subdivision.
The names of common subdivisions are abbreviated as follows:
A note's duration is the amount of time it is played relative to the tempo, known as a subdivision.
Common subdivisions are abbreviated as follows:
* z = zero (useful for slides where the end note is not held)
* ts = thirty-second

@@ -52,25 +57,30 @@ * s = sixteenth

* w = whole
* w. = dotted-whole
* w. = dotted-whole
* i = indefinite (or 32,000 thirty-second notes to be clear)
_Note: 3 triplets = 2 eighths_
_Note:_ 3 triplets = 2 eighths
## Note pitch
A note's pitch is the name for its frequency in Hertz. D in the 5th octave is written as `d5`. Similarly, G-flat in the 3rd octave is `g_3`, and C-sharp in the 6th octave is `c#6`. A pitch can be between `a0` and `g#7`, inclusive.
## Note names
A note's name is mapped to its frequency in hertz. D in the 5th octave is written as `d5`. Similarly, G-flat in the 3rd octave is `g_3`, and C-sharp in the 6th octave is `c#6`. A note may be between `a0` and `g#7`, inclusive.
## Basic notation
General format: `[note_duration][space][note_pitch][comma]`
In practice: `h d5, q g_3, q c#6` etc.
_Note: any amount of tabs, newlines, or whitespace can appear after the comma, but not between the duration and pitch_
### General format
`h d5, q g_3, q c#6`
`[duration][space][note][comma]`
## Repetition
To simplify the writing process, groups of notes may be assigned to variables (separated with a semicolon) and repeated notes may be multiplied by an integer value.
_Note:_ Any amount of tabs, newlines, or whitespace can appear after the comma, but one space must appear between the duration and pitch.
1) Variable assignment
### Repetition
To simplify the writing process, groups of notes may be assigned to variables (separated by semicolons).
~~~
motif = h d5, q g_3, q c#6;
t d4, motif,
t a4, motif
~~~
2) Repeat single notes
Repeated notes may be multiplied by an integer value.
~~~

@@ -80,4 +90,4 @@ h c4 * 8, t b_3 * 3

## Chords
To play multiple notes simultaneously, Codebeat provides the `+` operator. Doing so produces a chord constituted of the pitches provided for the specified duration. The notes within a chord must be played for the same duration.
### Chords
Use the `+` operator to play notes simultaneously. A chord is constituted of its pitches played for a specified duration.

@@ -91,7 +101,7 @@ ~~~

## Slides
Like physical instruments, Codebeat can alter the pitch of a note over time until it reaches a second pitch. This is done with the `-` operator. Both notes are independent of each other, which means they may be any of the allowed durations and pitches.
### Slides
A note may be gradually altered over time until it reaches a new pitch. This is achieved with the `-` operator.
~~~
slide = h e2 - z c3;
slide = h e2 - e c3;

@@ -102,5 +112,8 @@ e f3, slide,

However, slides **cannot** be chained as in the below example.
To chain slides, use the `z` duration for the destination note:
~~~
h e2 - z c3 - e f4 - h d3
h e2 - z c3, h c3 - z f4, e f4 - z d3
~~~
This ensures that the entire duration of the slide is dictated by the duration of the source note.