that's a nice idea. You could provide sliders happy/sad, slow/fast to influence trends. I've heard someone on the csound mailing list having programmed an automated radio without interaction except the kind of music trance/jazz/... see https://algorythmradio.com/ . Maybe you could exchange together
Hello! I am a beginner in Haskell, coming more from mathematics, Overtone/Supercollider and composing with modular synthesizers.
csound-expression so far seems very promising to me, and I would like to thank you for creating this wonderful library! I have a few questions which I was unable to answer with the tutorial: I would like to do function composition to create effect chains (and perhaps also branch effects). However some effects have signatures like
... -> Sig -> SE Sig2while others have
... -> Sig -> SE Sig. How do I deal with this specific case and a function to put the
Sig into a
Sig2or the other way around? As an example of such an attempt at function composition which does not work:
snare = at (hp 1000 10 . chorus 0.1 0.2 0.1) $ mul (adsr 0.01 0.4 0 0) pink
Also (I may simply have missed this), is there a way to have buses or use things like Jack with
snare = at (hp 1000 10) . at (chorus 0.1 0.2 0.1) $ mul (adsr 0.01 0.4 0 0) pink
fromMono :: Sig -> Sig2
what is the best way to combine scores and playback of samples? My current approach is:
clap :: D -> SE Sig2 clap _ = runSam bpm $ wav1 "clap.wav" mkpattern :: [Int] -> Sco D mkpattern lst = mel $ map (\i -> if i == 0 then rest 1 else temp (double 1.0)) lst clapp :: Sco (Mix Sig2) clapp = sco clap $ mkpattern [0,0,1,0,0,0,1,1] -- then run `dac $ mix clapp`
but I would ideally like to work with samples like with
Csound.Sam like I can do with scores? Maybe there is a good way scores and samples are separated in this way?
like this one:
loopRam, readRam :: Fidelity -> TempoSig -> PitchSig -> String -> Sig2
though they expose a bit more params than wav1
dac $ testDrone $ cpspch 4.02 works. There is sound.
ticks doesn`t work, no sound. And no error:
dac $ nticks [3,2,3] 135 0dBFS level = 32768.0 --Csound version 6.10 (double samples) 2018-01-27 [commit: none] libsndfile-1.0.28 UnifiedCSD: tmp.csd STARTING FILE Creating options Creating orchestra closing tag Creating score rtaudio: ALSA module enabled rtmidi: ALSA Raw MIDI module enabled csound command: Segmentation fault end of score. overall amps: 0.0 overall samples out of range: 0 0 errors in performance Elapsed time at end of performance: real: 0.253s, CPU: 0.002s
What should i do to hear sound from
dac $ repeatSnd 3 $ leg 1 2 0 0 * osc 220 0dBFS level = 32768.0 --Csound version 6.10 (double samples) 2018-01-27 [commit: none] libsndfile-1.0.28 UnifiedCSD: tmp.csd STARTING FILE Creating options Creating orchestra closing tag Creating score rtaudio: ALSA module enabled rtmidi: ALSA Raw MIDI module enabled csound command: Segmentation fault end of score. overall amps: 0.0 overall samples out of range: 0 0 errors in performance Elapsed time at end of performance: real: 0.252s, CPU: 0.002s
Hi, Vladislav! Sorry for late reply I was away in the mountains, no computers available.
I've tried nticks and it works for me. I guess that problem is with version of Csound compiler that you use.
The code indicates:
csound command: Segmentation fault
--Csound version 6.10 (double samples) Dec 18 2017
right now and all your code snippets work with it
If you compile Csound from sources it's better to compile from master branch,
Csound.Patch is a part of the library
so if we install only
csound-expression this module is not available for us.
I guess you can try to update cabal source list and install csound-catalog:
cabal update cabal install csound-catalog
there is tutorial of the lib:
to learn csound:
Hi Anton! Thanks for the awesome library. It is exactly what I was looking for for my new project. (I'm reading osc-data generated from cell-phone sensors to drive synthesizers and produce different sounds.) I particularly appreciate the tutorial, which really is a good introduction and shows how simple it is to generate complex sound with just a few lines.
I was wondering, is there a way to use external audio sources (in particular microphones)? I've seen something in Csound.Options about PulseAudio, Jack, adc etc., but it is not clear to me how this can be used to actually get a
Sig type for further processing. Idealy I am looking for something like
getInp :: SE Sig effect :: Sig -> SE Sig main = dac $ getInp >>= effect
getInp provides the microphone input and
effect is the function that I want to apply to the microphone input.
Currently I'm running the whole thing on a Debian with Pulse Audio, but Jack is an option.
dacalso accepts functions
SigN -> SigMor
SigN -> SE SigM. It will pass all needed flags to read the input. Be sure to match the number of inputs of your card. For example if you have 2x2 card. You should pass to
Sig2 -> SE Sig2and use only channel that you want.
Simple and yet so powerful! It worked almost instantly. Thanks for the quick reply.
It's worth mentioning (for anyone else reading this) that the input may have to be scaled down by a lot (like 2 ** 8). For me the code
main = dac $ ((\mic -> mic) :: Sig2 -> Sig2)
generated only noise, while
main = dac $ ((\mic -> mul (2 ** (-8)) mic) :: Sig2 -> Sig2)
successfully created a loop back.
dac $ osc 440gives me the following -
λ> dac $ osc 440 0dBFS level = 32768.0 --Csound version 6.15 (double samples) Oct 23 2020 [commit: 18c2c7897425f462b9a7743cee157cb410c88198] libsndfile-1.0.30 UnifiedCSD: tmp.csd STARTING FILE 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.002s, CPU: 0.002s sorting score ... ... done Elapsed time at end of score sort: real: 0.002s, CPU: 0.002s displays suppressed 0dBFS level = 1.0 orch now loaded audio buffered in 1024 sample-frame blocks reading 2048-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 overall samples out of range: 0 1 errors in performance Elapsed time at end of performance: real: 0.021s, CPU: 0.009s closing device λ>