Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rochars committed May 6, 2018
0 parents commit a553e26
Show file tree
Hide file tree
Showing 23 changed files with 1,906 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.log
.DS_Store
.nyc_output
coverage
node_modules
package-lock.json
4 changes: 4 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"esversion": 6,
"sub": true
}
6 changes: 6 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
test
.nyc_output
.jshintrc
.travis.yml
appveyor.yml
webpack.config.js
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: node_js
os:
- linux
node_js:
- "7"
- "8"
script:
- npm run build
after_success:
- npm run coverage
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2018 Rafael da Silva Rocha.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# frequency-sweep
Sweep tone generator.
Copyright (c) 2018 Rafael da Silva Rocha.
https://github.com/rochars/frequency-sweep

[![NPM version](https://img.shields.io/npm/v/frequency-sweep.svg?style=for-the-badge)](https://www.npmjs.com/package/frequency-sweep) [![Docs](https://img.shields.io/badge/docs-online-blue.svg?style=for-the-badge)](https://rochars.github.io/frequency-sweep/index.html)
[![Codecov](https://img.shields.io/codecov/c/github/rochars/frequency-sweep.svg?style=flat-square)](https://codecov.io/gh/rochars/frequency-sweep) [![Unix Build](https://img.shields.io/travis/rochars/frequency-sweep.svg?style=flat-square)](https://travis-ci.org/rochars/frequency-sweep) [![Windows Build](https://img.shields.io/appveyor/ci/rochars/frequency-sweep.svg?style=flat-square&logo=appveyor)](https://ci.appveyor.com/project/rochars/frequency-sweep) [![Scrutinizer](https://img.shields.io/scrutinizer/g/rochars/frequency-sweep.svg?style=flat-square&logo=scrutinizer)](https://scrutinizer-ci.com/g/rochars/frequency-sweep/)

## Install
```
npm install frequency-sweep
```

## Use
```javascript
/**
* Return the samples of a frequency sweep. The sweep may be divided
* in segments, each using a different waveform (or noise), and each with
* a start and end frequency.
* @param {!Array<Object<!string, string|number>>} sequence The sequence.
* Each item in the array must have the properties:
* start: Integer value, the start frequency of the segment.
* end: Integer value, the end frequency of the segment.
* time: Float value, the duration of the segment. 1 = 1 second.
wave: String, "sine", "square", "triangle", "sawtooth" or "noise".
* @param {!number} sampleRate The sample rate.
* @return {!Array<number>}
*/
function sweep(sequence, sampleRate) {}
```

### Example
```javascript
// Define a sweep sequence.
// This one have 2 steps, each using a different waveform.
const sequence = [
{
"start": 1, // start in 1 Hz
"end": 100, // end in 100 Hz
"time": 1, // goes from 1 Hz to 100 Hz in 1 second
"wave": "sine" // use a sine wave
},
{
"start": 100, // start in 100 Hz
"end": 1400, // end in 1.4 kHz
"time": 5, // goes from 100 Hz to 1.4 kHz in 5 seconds
"wave": "sawtooth" // use a sawtooth wave
}
];

// Get the samples of the 2-step sweep sequence.
// The samples are 64-bit and in the -1 to 1 range.
let samples = sweep(sequence, 8000));
```

## LICENSE
Copyright (c) 2018 Rafael da Silva Rocha.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 changes: 21 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
environment:
matrix:
- nodejs_version: "7"
- nodejs_version: "8"

install:
- ps: Install-Product node $env:nodejs_version
- npm -g install npm@latest
- npm install

test_script:
- node --version
- npm --version
- cmd: npm run build

build: off

version: "{build}"

matrix:
fast_finish: true
8 changes: 8 additions & 0 deletions compile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) 2018 Rafael da Silva Rocha.
* https://github.com/rochars/frequency-sweep
*
*/

const sweep = require("./index.js");
window['sweep'] = sweep;
4 changes: 4 additions & 0 deletions dist/frequency-sweep-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a553e26

Please sign in to comment.