Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playing audio in node-js #111

Open
GitterHubber opened this issue Oct 14, 2019 · 4 comments
Open

Playing audio in node-js #111

GitterHubber opened this issue Oct 14, 2019 · 4 comments

Comments

@GitterHubber
Copy link

GitterHubber commented Oct 14, 2019

I see that the audio playing has 2 interfaces

Audio5 - uses Web Audio
Midi5 - uses Web MIDI

I don't think these interfaces would work outside a browser environment eg. when running via node-js, or would they?

Is there a way to get audio playing to work when running abc2svg via node-js in a console?

@moinejf
Copy link
Owner

moinejf commented Oct 14, 2019

The audio playing engine has just been changed today (as you may know, the source is in chisel under fossil).
The new engine generates the play data directly in the tree representation of the music after SVG generation. The new scripts 'sndaud.js' and 'sndmid.js' could be reworked for running via nodejs or quickjs, and output either MIDI or sound (wav?) files, or directly play sound samples or MIDI events via the system interface.

@GitterHubber
Copy link
Author

The audio playing engine has just been changed today (as you may know, the source is in chisel under fossil).

This is amazing! Wasn't aware that you are still actively extending and updating this repository.
Many thanks for this wonderful piece of software!

@GitterHubber
Copy link
Author

I see that in

play-1.js you have exposed a function ToAudio for nodejs

// nodejs
if (typeof module == 'object' && typeof exports == 'object')
	exports.ToAudio = ToAudio

however I don't see a similar line in snd-1.js
is this by design?

Infact I'm unable to access even AbcPlay() function via the snd-1.js file in nodejs.
Is there any other way to access these functions or are these functions kept hidden by choice?

@moinejf
Copy link
Owner

moinejf commented Oct 18, 2019

Sorry: with the new play engine, I was in the browser and I forgot the CLI.
I added the module exports in play.js and sndgen.js.
Anyway, you will have to write a play-1/snd-1 like script to output the sound to file/system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants