Closed asheshambasta closed 4 years ago
Hi!
Maybe you have jack by default on your system. And Csound audio-engine expects it to be PulseAudio which is standard for most of the linux systems nowadays.
there are two routes to fix it.
1) To make Pulse audio work and check that Csound on your system can work with it. To check it out you can try out any Csound example to check that it works by itself (without CE). This one for example: http://www.csounds.com/manual/html/oscil3.html Try to copy file with example and invoke Csound on it.
2) Find out which flags of Csound work with your system and use them in CE. With this module: https://hackage.haskell.org/package/csound-expression-5.3.2/docs/Csound-Options.html. This module describes native Csound flags that are documented here http://www.csounds.com/manual/html/CommandFlagsCategory.html
I configure audio with Cadence. It's nice tool to configure it with UI.
I also use external USB audio card
So the first step is to be sure that Csound can work on your system. Check it out with some example csound file. To invoke it you can run
csound oscil3.csd
Csound file to download. It plays pure sine waves:
www.csounds.com/manual/html/examples/oscil3.csd
@anton-k Hi! First of all, thanks for replying and the wonderful library. I've managed to find the issue and I'll put my findings here in case anyone else stumbles on it.
So I'm using NixOS (and hence nix); and I started off by creating a stack project and adding the dependencies.
I also added a shell-stack.nix file and enabled nix
in stack; and in those dependencies I added the csound
nixpkg to be pulled.
However, I noticed the following scenario: see my SO question for details.
And that led me to drill things down a bit further.
What was happening was:
stack ghci
; stack was firing up a nix-shell
using the --pure
flag; therefore: --pure
If this flag is specified, the environment is almost entirely cleared before the interactive shell is started, so you get an environment that more closely corresponds to the “real” Nix build. A few variables, in particular HOME, USER and DISPLAY, are retained. Note that ~/.bashrc and (depending on your Bash installation) /etc/bashrc are still sourced, so any
variables set there will affect the interactive shell.
So any calls to csound
that would eventually lead to looking for some sound server (PulseAudio), did not work. In a fresh session after a reboot; this spawned PulseAudio
(needs confirmation if this was the case) but the rest of my system couldn't connect to it and was trying to spawn a new PA process.
The fix, in the end, was merely to have the option nix.pure = false
set in stack.yaml
.
That retains the environment variable that lets the processes discover PA and hence connect to an already spawned instance instead of attempting to spawn one, and failing.
I'm glad that it works for you now! Wish you many happy musical discoveries!
Hi! Found this because I'm also getting issues with Connection refused
from ALSA when running with --pure
. Is there a way to allow access while keeping the --pure
flag?
I'm not aware on NixOS details, but can I help somehow?
Not sure, I think it has to do with permissions etc set by NixOS so might be very specific to that environment :)
I'm on NixOS 19.09 and I'm thinking this is a system related issue; but in my case, any output doesn't work.
Repl:
And I can see some logs related to PA:
And I'm not sure how to debug this.
Any clues to what I might be doing wrong?
Edit: sound output works perfectly using other applications; Spotify, FF etc.
Another thing to note: I'm using a USB audio interface. I'm not sure if I need to specify special settings for that.
A follow up question: I'm assuming that csound talks to Alsa to route audio. Alsa routes this audio to some interface called 'default' on PA; which either doesn't exist or is not enabled. But in that case, the error message doesn't really agree with my hypothesis.
Is there something I can set in the options to route audio differently?