-
Notifications
You must be signed in to change notification settings - Fork 1
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
Enable unified set of Csound for JavaScript examples to work on all platforms with csound_loader.js. #133
Comments
Currently the loader assumes that the WebAssembly files are present in the environment. I will not change that at this time. |
On my computer, the AudioWorklet implementation of Csound works fine with just ALSA and no PulseAudio, while csound.node running in NW.js crashes with just ALSA but runs fine with PulseAudio. I had to reconfigure PulseAudio to default to 48 KHz frames per second and float samples for that to work. I would prefer an ALSA setup that supports all my platforms on this computer, failing that I would prefer a PulseAudio setup in which CsoundAudioNode works well. |
I thought my HDMI monitor had speakers, but although the video is very good, it does not have speakers or, if it does, they are not working with my computer. The headphone jack, however, does work. I will try changing my audio input and output code in CsoundAudioNode.Start to parse N from dacN and use that to index into the list of enumerated devices, rather than or in addition to trying to obtain a mic from the navigator. No, I can't find out how to do that. But now, I'm getting the navigator mic connecting (don't yet know if it actually works) to the USB audio. This is with the PulseAudio daemon running. The audio output is back to being full of crackles. Perhaps audio is not routed from the USB device to the navigator without PulseAudio? |
With PulseAudio:
With no PulseAudio, just ALSA:
In both cases the USB interface is active. |
I got WebAudio audio input from the browser to work by passing a buffer size of 0 to csoundSetHostImplementedAudio, and using Csound's input channel count not the host's input buffer channel count to iterate over the input audio buffer and spin buffer, and calling Csound.PerformKsmps after reading into spin but before writing out from spout. |
My Tascam DR-40 can be used as a stereo condenser mic if I go into pre-record (flashing red), turn up the playback volume, and plug the headphone output into my USB audio inputs. |
Built the newlook branch of CsoundQt with html5 support using the web engine. All logging from Csound in HTML goes to the CsoundQt message console, not to the registered Csound callback. minimal.html works (with WebAudio). The camel case of most CsoundQt JavaScript API function names conflicts with my code. |
I will enter a few issues in the CsoundQt repo to fix some of the HTML5 issues, but I will not do the work. |
Getting -inf samples in csound.node with duplex.html, scrims.html works fine. |
Audio configuration for Ubuntu is not well documented, especially not for musicians or programmers. However, I have learned some things. It is indeed possible to permanently turn off PulseAudio and use only plain ALSA for all audio interfacing. This provides audio with less overhead and fewer glitches, but only for one application at a time. This is the best choice for me and probably for most serious musicians. The basic thing in ALSA is a "card," and their names should be determined thus:
Cards in turn have devices, which can be discovered thus ([card number - device number]):
More information can be obtained thus, which lists all available cards and their devices:
The difference between For the pieces in this issue, the Csound options should usually be:
In the browser, there is only 1 input channel, outside the browser there are 2 input channels. It is vital to understand that with plain ALSA, only one audio stream can be active at a time. Hence, in the browser, only one tab can use audio at a time. Other audio tabs should be closed before running a WebAssembly piece. The Chromium browser is invoked by the shell script
|
Got message.html to play in Android. There are some things I need to change.
|
The problem on Android and in CsoundQt is that not all the Csound class API methods exposed in JavaScript have initial caps. Most are in camel case. Options:
It's not clear to me if SWIG will automatically wrap less derived functions in simple inheritance. But I have multiple inheritance, anyway. |
I have added initial caps signatures to all CsoundOboe methods exposed to JavaScript. |
|
This is now working well enough for government work. |
Enable
csound_loader.js
to load and instantiate Csound with a JavaScript interface, the same or very similar on all platforms, for a set of example/test pieces:WebAssembly (now built only based on AudioWorklet)
NW.js (csound.node bypasses browser audio, uses low-level Csound audio directly)
Android (no message callback, needed to use
-odac -idac
without-+rtaudio
.CsoundQt (newlook branch) HTML5 support basically works, yet on reflection, I am not testing these. The API functions are camel case, it is hard to get the code to run, it doesn't print Csound messages to the API callback, and it may leave CsoundQt hanging and in need of manually killing both CsoundQt and the WebEngine helper processes. Of course, if just WebAudio is used (edit
csound_loader.js
not to use injected csound), they probably all work as well as in any other browser.The text was updated successfully, but these errors were encountered: