tonegenerator
Advanced tools
Comparing version 0.3.0 to 0.3.1
{ | ||
"name": "tonegenerator", | ||
"description": "Generates a tone as raw PCM WAV data, so you can do operations on it", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"scripts": { | ||
@@ -6,0 +6,0 @@ "test": "node test.js", |
@@ -17,3 +17,3 @@ ToneGenerator for node.js | ||
volume: 30, | ||
sampleRate: 44100, | ||
rate: 44100, | ||
shape: 'triangle' | ||
@@ -23,3 +23,3 @@ }) | ||
// The old interface, still available for compatibility | ||
var tonedata = tone(frequency, lengthInSeconds, volume = 30, sampleRate = 44100) | ||
var tonedata = tone(frequency, lengthInSeconds, volume = 30, rate = 44100) | ||
``` | ||
@@ -31,9 +31,9 @@ | ||
- **volume** controls max/min for the array values. If you intend to write 8-bit it should be less than or equal to tone.MAX_8, if 16 bit it should be less than or equal to tone.MAX_16. *defaults to 30* | ||
- **sampleRate** number of samples per second. Together with lengthInSecs, this define the length of the output array (lengthInSeccs * sampleRate). *defaults to 44100* | ||
- **rate** sample rate, number of samples per second. Together with lengthInSecs, this define the length of the output array (lengthInSeccs * rate). *defaults to 44100* | ||
- **shape** controls the wave shape. Options are *'triangle', 'square', 'sine', 'saw'*. You can also pass in a custom function, see the tests for an example of this. *defaults to 'sine'* | ||
#### Using the old interface | ||
The old interface takes four arguments: *freq, lengthInSecs, volume, sampleRate*. | ||
**volume** and **sampleRate** are optional, the default is shown above. | ||
**Shape is not available in the old interface. If you want to specify sampleRate, you have to specify volume!** | ||
The old interface takes four arguments: *freq, lengthInSecs, volume, rate*. | ||
**volume** and **rate** are optional, the default is shown above. | ||
**Shape is not available in the old interface. If you want to specify rate, you have to specify volume!** | ||
@@ -40,0 +40,0 @@ #### Useful constants |
12296
5