audio-generator icon indicating copy to clipboard operation
audio-generator copied to clipboard

Fix error in README.md (Direct)

Open sdesalas opened this issue 6 years ago • 0 comments

Following instructions for 'Direct' use in Readme.md creates a TypeError: generate is not a function:

To duplicate follow these steps:

$ node -v && node
v6.10.0
> const generator = require('audio-generator');
undefined
> const generate = generator(time => Math.sin(time * Math.PI * 2 * 440));
undefined
> typeof generate
'object'
> generate()
TypeError: generate is not a function
    at repl:1:1
    at sigintHandlersWrap (vm.js:22:35)
    at sigintHandlersWrap (vm.js:96:12)
    at ContextifyScript.Script.runInThisContext (vm.js:21:12)
    at REPLServer.defaultEval (repl.js:340:29)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.<anonymous> (repl.js:538:10)
    at emitOne (events.js:101:20)
    at REPLServer.emit (events.js:188:7)

This is happening because package.json is pointing main to stream.js.

Instead of repointing the package.json (which may have undesired effects elsewhere) the workaround here is to point directly to the direct direct.js (Generator) function.

sdesalas avatar Apr 11 '18 00:04 sdesalas