-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ben Titcomb
committed
Mar 3, 2016
1 parent
24dc992
commit 98d4b41
Showing
8 changed files
with
171 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
`Goertzel = require('../build/goertzel');` | ||
DTMF = require('../build/dtmf') | ||
require('jasmine-expect') | ||
|
||
describe 'DTMF', -> | ||
|
||
pairs = [ | ||
{low: 697, high: 1209, char: '1'} | ||
{low: 697, high: 1336, char: '2'} | ||
{low: 697, high: 1477, char: '3'} | ||
{low: 697, high: 1633, char: 'A'} | ||
{low: 770, high: 1209, char: '4'} | ||
{low: 770, high: 1336, char: '5'} | ||
{low: 770, high: 1477, char: '6'} | ||
{low: 770, high: 1633, char: 'B'} | ||
{low: 852, high: 1209, char: '7'} | ||
{low: 852, high: 1336, char: '8'} | ||
{low: 852, high: 1477, char: '9'} | ||
{low: 852, high: 1633, char: 'C'} | ||
{low: 941, high: 1209, char: '*'} | ||
{low: 941, high: 1336, char: '0'} | ||
{low: 941, high: 1477, char: '#'} | ||
{low: 941, high: 1633, char: 'D'} | ||
] | ||
|
||
describe '#processSample', -> | ||
it 'identifies all dial tones', -> | ||
dtmf = new DTMF | ||
sampleRate: 44100 | ||
peakFilterSensitivity: 1.4 | ||
repeatMin: 1 | ||
for pair in pairs | ||
dualTone = Goertzel.Utilities.generateSineBuffer([pair.low, pair.high], 44100, 512) | ||
buffer = Goertzel.Utilities.floatBufferToInt(dualTone) | ||
dtmf.processBuffer(buffer) | ||
expect(dtmf.processBuffer(buffer)).toContain(pair.char) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters