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

Pipe PCMData from variable? #146

Open
ughstudios opened this issue Jul 7, 2020 · 2 comments
Open

Pipe PCMData from variable? #146

ughstudios opened this issue Jul 7, 2020 · 2 comments

Comments

@ughstudios
Copy link

In your example you are using stdin to pipe the data, is there a way to do it from a variable, or an outputStream() which I have access to? Please provide working examples if possible! :)

// PCM data from stdin gets piped into the speaker
process.stdin.pipe(speaker);

@ughstudios
Copy link
Author

So I got my audio out but it's sounding realllly bad and robotic.

@Xeonzinc
Copy link

You may need to cork your pipe initially to allow enough of a buffer to build up, before outputting to the speaker. I would also recommend ensuring you are sending a large chunk of data at once to ensure the speaker isn't running out of data intermittently when your application is busy elsewhere, I transmit in 1024 sample chunks to my speakers, enough ms in advance of when I want it to be played.

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