Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Paul Chiusano
    I'm not sure what's causing the PortAudio Invalid number of channels error, any ideas?
    Anton Kholomiov

    Hi, Paul (@pchiusano)! Nice to hear from you again!

    I don't have this issue. But I suspect that something can be wrong with PortAudio expectation of number of channels. Maybe it expects strictly stereo with your settings?

    Can you try out to convert to stereo to feed both channels:

    dac $ fromMono $ osc 440

    Both examples work for me.

    Paul Chiusano
    @anton-k same issue with dac $ fromMono $ osc 440
    Here's full output -
    λ> dac $ fromMono $ osc 440
    0dBFS level = 32768.0
    --Csound version 6.15 (double samples) Oct 23 2020
    [commit: 18c2c7897425f462b9a7743cee157cb410c88198]
    UnifiedCSD:  tmp.csd
    Creating options
    Creating orchestra
    closing tag
    Creating score
    rtaudio: PortAudio module enabled ...
    using callback interface
    rtmidi: PortMIDI module enabled
    Elapsed time at end of orchestra compile: real: 0.003s, CPU: 0.003s
    sorting score ...
        ... done
    Elapsed time at end of score sort: real: 0.003s, CPU: 0.003s
    displays suppressed
    0dBFS level = 1.0
    orch now loaded
    audio buffered in 1024 sample-frame blocks
    reading 4096-byte blks of shorts from adc (RAW)
    PortAudio V19.6.0-devel, revision 396fe4b6699ae929d3a685b3ef8a7e97396139a4
       0: adc0 (MacBook Air Microphone [Core Audio])
    PortAudio: selected input device 'MacBook Air Microphone'
       0: dac0 (MacBook Air Speakers [Core Audio])
    PortAudio: selected output device 'MacBook Air Speakers'
     *** PortAudio: error: -9998: Invalid number of channels
    closing device
    Failed to initialise real time audio output
    inactive allocs returned to freespace
    end of score.           overall amps:  0.00000  0.00000
           overall samples out of range:        0        0
    1 errors in performance
    Elapsed time at end of performance: real: 0.027s, CPU: 0.013s
    closing device
    Paul Chiusano
    If I remove the --input=adc from the generated tmp.csd file, it works
    --nodisplays --output=dac --input=adc
    Paul Chiusano

    It looks like my microphone is only 1 channel input but the generated file is requesting two channels? If I change the invocation of csound to csound -+rtaudio="CoreAudio" --nchnls_i=1 tmp.csd then it works. Without the --nchnls_i=1 I get:

    1: MacBook Air Microphone (1 channels)
     *** CoreAudio: Device has not enough inputs (1, requested 2)

    It also doesn't work without the -+rtaudio="CoreAudio".

    @anton-k Now that I have something working, is there some way I can get csound-expression to supply different options to csound when I call dac ?
    ah, dacBy seems like it will work
    Anton Kholomiov

    Ok, I glad that it wokrs now.
    Also there is helpful function if you want to redefine the global options once and forall


    saveUserOptions :: Options -> IO ()
    it saves the options in the current directory and in the user's home it can behave like global .rc fro csound compiler so that you don't need to repeat same specs in the dacBy
    Paul Chiusano
    Anton Kholomiov
    @pchiusano Hi, I've updated CE so that it does not include -adc flag if user does not want to use inputs.
    with it it should run without the need for specific flags in your case.
    Paul Chiusano
    Thanks @anton-k will try it out
    Martin Allen
    Is there an example repository that someone can link to which is using a real midi controller similar to the Novation LaunchKey in this video? I'm not really seeing anything in the tutorial that explains how manage the knobs etc, everything seems to be using a virtual controller.
    Anton Kholomiov

    @blinky3713 Hi Martin!

    For this video for midi-controller I've wrote the code:


    For controllers we can use functions like umidiCtrl or midiCtrl as they are described here


    Anton Kholomiov
    We need to know the id of CC for midi knob or button and then we can use it with those functions
    Anton Kholomiov
    @blinky3713 It's source code for video of peformance with LaunchKey, I guess it was your question on youtube
    It relies on that package csound-controllers. It would not work without wav samples. But you can get the idea of how to do smth similar
    Martin Allen
    Thanks, that's all super helpful. I think that the tutorial is also great, but my one feedback is that some more examples of this nature would be really helpful to include in the repo or in an example repo
    Martin Allen
    for example @anton-k , I watched your presentation at a haskell meetup in Moscow. I thought it sounded cool and the code would probably go a long way to help people like me. I'm a professional haskeller and have some experience with Ableton from just messing around
    Youtube was able to supply sensible, real-time English subtitles, which was mindblowing in its own way.
    Anton Kholomiov

    Hi folks!

    just wanted to share english based video intro to sound design synth with CE:


    It features presentation with ghci session along the way so you can try it out live as it goes.
    It covers basics of subtractive synth. How to do things like Massive or Serrum in Haskell.