Playing audio programmatically via NodeJSHow can I know which radio button is selected via jQuery?react native windows, spawn npm ENOENT errorspawn ls ENOENT when watched file is modifiedNodemon crashed errorHow to run a windows batch file with node jsCorrect way to put node_modules/.bin on PATH for WebStormAspNetCore NodeServices throws NodeInvocationExceptionError on running npm run devGetting react to work on github pagesPM2 getting error while starting with json file
What is the closest airport to the center of the city it serves?
Endgame puzzle: How to avoid stalemate and win?
Dihedral group D4 composition with custom labels
What Kind of Wooden Beam is this
Simple Derivative Proof?
Should I simplify my writing in a foreign country?
MX records from second domain to point to first domain but email is not delivered like on first domain
GitLab account hacked and repo wiped
How to remap repeating commands i.e. <number><command>?
How do I, as a DM, handle a party that decides to set up an ambush in a dungeon?
How to preserve a rare version of a book?
Why would one crossvalidate the random state number?
Sheared off exhasut pipe: How to fix without a welder?
When did England stop being a Papal fief?
It isn’t that you must stop now
Would a "Permanence" spell in 5e be overpowered?
How to pass hash as password to ssh server
Has the Hulk always been able to talk?
What happens if I accidentally leave an app running and click "Install Now" in Software Updater?
Is disk brake effectiveness mitigated by tyres losing traction under strong braking?
In Futurama, how many beings has Leela slept with?
Why didn't this character get a funeral at the end of Avengers: Endgame?
Would a small hole in a Faraday cage drastically reduce its effectiveness at blocking interference?
All superlinear runtime algorithms are asymptotically equivalent to convex function?
Playing audio programmatically via NodeJS
How can I know which radio button is selected via jQuery?react native windows, spawn npm ENOENT errorspawn ls ENOENT when watched file is modifiedNodemon crashed errorHow to run a windows batch file with node jsCorrect way to put node_modules/.bin on PATH for WebStormAspNetCore NodeServices throws NodeInvocationExceptionError on running npm run devGetting react to work on github pagesPM2 getting error while starting with json file
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I've spent the whole day trying to get any of the npm
packages related to playing audio from nodejs
but couldn't get any to work.
Basically what I need is to play batch audios.
For example:
//files containing the name of the audios
var files = require('./list-of-audios-to-play.json')
var player = require('play-sound')(opts = )
var counter = 0;
//every 5 seconds, play the referenced audio
setInterval(function()
counter++;
player.play(files[counter]+'.mp3', function(err)
if (err) throw err
)
,5000)
Tried everything.
When I run the above code, I get this error:
INFORMATION: wasnt possible to locate files for the specified pattern(s)
events.js:183
throw er; // Unhandled 'error' event
^
Error: spawn play ENOENT
at _errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
Can anyone help?
javascript node.js audio
add a comment |
I've spent the whole day trying to get any of the npm
packages related to playing audio from nodejs
but couldn't get any to work.
Basically what I need is to play batch audios.
For example:
//files containing the name of the audios
var files = require('./list-of-audios-to-play.json')
var player = require('play-sound')(opts = )
var counter = 0;
//every 5 seconds, play the referenced audio
setInterval(function()
counter++;
player.play(files[counter]+'.mp3', function(err)
if (err) throw err
)
,5000)
Tried everything.
When I run the above code, I get this error:
INFORMATION: wasnt possible to locate files for the specified pattern(s)
events.js:183
throw er; // Unhandled 'error' event
^
Error: spawn play ENOENT
at _errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
Can anyone help?
javascript node.js audio
We'd need to see the JSON file with the filenames in order to tell why it couldn't locate the file, and maybe the file tree on your system for the audio files as the error indicates that the filenames/patterns don't match your files.
– ChrisBrownie55
Mar 23 at 3:32
looks like it can't locate the files. I always have trouble with relative/absolute paths. You can try console.log-ingfiles[counter]
to see what path it is looking for. Also you might want to use the nodejs path API (maybepath.join
)
– Michael S
Mar 23 at 3:38
Thanks for the answer! It turned out I had to update npm.
– spaceman
Mar 23 at 3:55
add a comment |
I've spent the whole day trying to get any of the npm
packages related to playing audio from nodejs
but couldn't get any to work.
Basically what I need is to play batch audios.
For example:
//files containing the name of the audios
var files = require('./list-of-audios-to-play.json')
var player = require('play-sound')(opts = )
var counter = 0;
//every 5 seconds, play the referenced audio
setInterval(function()
counter++;
player.play(files[counter]+'.mp3', function(err)
if (err) throw err
)
,5000)
Tried everything.
When I run the above code, I get this error:
INFORMATION: wasnt possible to locate files for the specified pattern(s)
events.js:183
throw er; // Unhandled 'error' event
^
Error: spawn play ENOENT
at _errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
Can anyone help?
javascript node.js audio
I've spent the whole day trying to get any of the npm
packages related to playing audio from nodejs
but couldn't get any to work.
Basically what I need is to play batch audios.
For example:
//files containing the name of the audios
var files = require('./list-of-audios-to-play.json')
var player = require('play-sound')(opts = )
var counter = 0;
//every 5 seconds, play the referenced audio
setInterval(function()
counter++;
player.play(files[counter]+'.mp3', function(err)
if (err) throw err
)
,5000)
Tried everything.
When I run the above code, I get this error:
INFORMATION: wasnt possible to locate files for the specified pattern(s)
events.js:183
throw er; // Unhandled 'error' event
^
Error: spawn play ENOENT
at _errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
Can anyone help?
javascript node.js audio
javascript node.js audio
asked Mar 23 at 3:06
spacemanspaceman
1851416
1851416
We'd need to see the JSON file with the filenames in order to tell why it couldn't locate the file, and maybe the file tree on your system for the audio files as the error indicates that the filenames/patterns don't match your files.
– ChrisBrownie55
Mar 23 at 3:32
looks like it can't locate the files. I always have trouble with relative/absolute paths. You can try console.log-ingfiles[counter]
to see what path it is looking for. Also you might want to use the nodejs path API (maybepath.join
)
– Michael S
Mar 23 at 3:38
Thanks for the answer! It turned out I had to update npm.
– spaceman
Mar 23 at 3:55
add a comment |
We'd need to see the JSON file with the filenames in order to tell why it couldn't locate the file, and maybe the file tree on your system for the audio files as the error indicates that the filenames/patterns don't match your files.
– ChrisBrownie55
Mar 23 at 3:32
looks like it can't locate the files. I always have trouble with relative/absolute paths. You can try console.log-ingfiles[counter]
to see what path it is looking for. Also you might want to use the nodejs path API (maybepath.join
)
– Michael S
Mar 23 at 3:38
Thanks for the answer! It turned out I had to update npm.
– spaceman
Mar 23 at 3:55
We'd need to see the JSON file with the filenames in order to tell why it couldn't locate the file, and maybe the file tree on your system for the audio files as the error indicates that the filenames/patterns don't match your files.
– ChrisBrownie55
Mar 23 at 3:32
We'd need to see the JSON file with the filenames in order to tell why it couldn't locate the file, and maybe the file tree on your system for the audio files as the error indicates that the filenames/patterns don't match your files.
– ChrisBrownie55
Mar 23 at 3:32
looks like it can't locate the files. I always have trouble with relative/absolute paths. You can try console.log-ing
files[counter]
to see what path it is looking for. Also you might want to use the nodejs path API (maybe path.join
)– Michael S
Mar 23 at 3:38
looks like it can't locate the files. I always have trouble with relative/absolute paths. You can try console.log-ing
files[counter]
to see what path it is looking for. Also you might want to use the nodejs path API (maybe path.join
)– Michael S
Mar 23 at 3:38
Thanks for the answer! It turned out I had to update npm.
– spaceman
Mar 23 at 3:55
Thanks for the answer! It turned out I had to update npm.
– spaceman
Mar 23 at 3:55
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55310231%2fplaying-audio-programmatically-via-nodejs%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55310231%2fplaying-audio-programmatically-via-nodejs%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
We'd need to see the JSON file with the filenames in order to tell why it couldn't locate the file, and maybe the file tree on your system for the audio files as the error indicates that the filenames/patterns don't match your files.
– ChrisBrownie55
Mar 23 at 3:32
looks like it can't locate the files. I always have trouble with relative/absolute paths. You can try console.log-ing
files[counter]
to see what path it is looking for. Also you might want to use the nodejs path API (maybepath.join
)– Michael S
Mar 23 at 3:38
Thanks for the answer! It turned out I had to update npm.
– spaceman
Mar 23 at 3:55