ciseaux
JavaScript utility to chop an audio buffer, inspired from youpy/scissor
✂️ Demo
✂️ Documents
✂️ Installation
$ npm install ciseaux
downloads:
✂️ API
Ciseaux.context = AudioContext
Ciseaux.from(src: string): Promise<Tape>
Ciseaux.silence(duration: number): Tape
Ciseaux.concat(...tapes: Tape): Tape
Ciseaux.mix(...tapes: Tape, [method='silence']): Tape
Instance attributes
sampleRate: number
readonlylength: number
readonlyduration: number
readonlynumberOfChannels
readonlynumberOfTracks
readonly
Instance methods
gain(gain: number = 1): Tape
pan(pan: number = 0): Tape
reverse(): Tape
pitch(rate: number = 1): Tape
stretch(rate: number = 1): Tape
- not implemented (Pull Request please)
concat(...tapes: Tape): Tape
slice(startTime: number = 0, duration: number = inf): Tape
loop(n: number = 2): Tape
fill(duration: number): Tape
replace(startTime: number = 0, duration: number = 0, tape: Tape = null): Tape
split(n: number = 2): Tape[]
mix(...tapes: Tape, [method = 'silence']): Tape
render(): Promise<AudioBuffer>
dispose(): void
Ciseaux.Sequence
Utility class for creating a sequence tape that is concatenated tapes
constructor(...args: any)
pattern: string
durationPerStep: number|number[]
instruments: object
Instance methods
apply(...args: any): Tape
pattern: string
durationPerStep: number|number[]
instruments: object
✂️ Usage
browser
const Ciseaux = ; Ciseauxcontext = ; // create a tape instance from the urlCiseaux;
node.js
const fs = ;const Ciseaux = ; // create a tape instance from the filepathCiseaux;
✂️ Examples
slice + concat
tape = tape2;
slice + concat + loop
tape = tape3;
replace + reverse
tape = tape1;
gain
tape = Ciseaux;
pan
tape = Ciseaux;
pitch
tape = Ciseaux;
mix
tape = tape1;
stutter
tape = Ciseaux;
phase
tape = Ciseaux;
lace
tape = Ciseaux;
concrete
tape = Ciseaux;
sequence
tape = "a bdacbba babfeg" 02 a: tape10 b: tape11 c: tape12 d: tape13 e: tape24 f: tape25 g: tape3;
shuffled sequence
tape = "a bdaabcaccbgabb" a: tape14 b: tape11 c: tape12 d: tape13 e: tape24 f: tape25 g: tape3;
✂️ Architecture
+---------------+ +----------------+ +-----------+
| new Tape() | --> | Float32Array[] | -- transfer -> | |
| | +----------------+ | |
| | | |
| | +----------------+ | |
| Tape.render() | --> | JSON | -- transfer -> | WebWorker |
+---------------+ +----------------+ | |
| |
+---------------+ +----------------+ | |
| AudioData | <-- | Float32Array[] | <- transfer -- | |
+---------------+ +----------------+ +-----------+
|
+----------------+
| browser | node.js
v v
+-------------+ +---------------------+
| AudioBuffer | | Buffer (wav format) |
+-------------+ +---------------------+
✂️ Developments
# Build : babel -> browserify -> uglify-js npm run build # Test : mocha + power-assert npm run test # Coverage : mocha + isparta npm run cover # Lint : eslint npm run lint
✂️ Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D