Live audio recording troubles

Hi, there.
It’s first time to post here.
It’s been for few months after using csound.
And I have a specific trouble with live recording from terminal on macOS.
The code is the basic csd such like a “ins.csd”.
The trouble is likely a buffer noise only about live recording.No trouble about other offline renderings. Every each seconds the audio data is lacked and it sounds like a noise.
I learned about ksmps size and buffer and set them properly.
And I tried some command “-+rtaudio” ,”realtime”,”—num-threads”,but they don’t seem to be worked.
Then I tried “-+rtaudio=coreaudio” but returned the message “command segments fault”.
Are there anyone has ideas to solve this trouble?

Commands I use are like bellows
csound -W -3 -b512 -+rtaudio=coreaudio -iadc2 -+rtmidi=null -o /Users/…./rec.wav /Users/…./ins.csd

My mac and csound
MacBookpro2011 os10.85
Csound ver.6.10

hi -

i don’t understand your command line. in it, iit is written
-o /Users/…./rec.wav

if you do this, it is not real time, but rendering. for real time, you
should use
-o dac

perhas you can post your complete csd, to have a look. best -

joachim

Yes, @joachim is right, something seems off about that command line. If you are recording in real time you don’t need to specify a file to output do in your command line. You should instead use fout in your orchestra code.

Thank you Joachim and Rory for your advices.
I figured csd and command out, and tried some experiments.
But unfortunately it seems not to be solved about lacking noise.
Because of using -odac the error massage was cleared.
By the way, I also programmed almost the same on maxmsp and it works well. I don’t know why noise occurs on csound.
Commands and contents of csd are bellows.
Best regards,
////////
csound -b256 -+rtaudio=coreaudio -iadc7 -odac7 /User/…./ins.csd
///////
*No options in csd

<CsInstruments>
sr=48000
ksmps=64
nchnls=2
0dbfs=1

instr 1

a1,a2 ins
outs a1,a2
fout “rec.wav”,18,a1,a2

endin
</CSInstruments>
<CsScore>
i 1 0 3600
e
</CsScore>

Thank you Joachim and Rory , I figured it out somehow.
The main problem was a just audio driver’s name.
I found it in a part of article of csound book.
pa_bl (portaudio:blocked) worked for all.
It was not so big problem but took so many time to find it.
If anyone has the same trouble try “pa_bl”.
I feel fout worth more than -o /.wav, so I improve codes so that i can touch from command every time.
Thank you.
////////
csound -+rtaudio=pa_bl -iadc7 -odac7 -b 256 —omacro:wav=/Users/…/rec.wav /Users/…/ins.csd
////////

sr=48000
ksmps=64
nchnls=2
0dbfs=1

instr 1

a1,a2 ins
outs a1,a2
fout “$wav”,18,a1,a2

endin

i 1 0 3600
e

That’s great @Kajikoji , and thanks for posting your final solution so that others can benefit from it :+1:

1 Like

hi -

thanks for telling the solution; that’s important to know. two questions:

  1. what happens if you don’t specify the module, but use the defaults?
    so in your case, it should be:
    csound -iadc -odac
    does it not work properly then?

  2. where can we put better descriptions in the documentation? where did
    you look and found something not helpful?

cheers -
joachim

Thank you for your comment and question, and give me for a few days to answer after verification.
2nd question is a little bit difficult to understand for me. Do you mean how I learned about live audio recording with csound?

yes this was what i meant. what you read, and how our manual or the
flossmanual could be improved:
https://csound.com/docs/manual/index.html
https://flossmanual.csound.com/

j

Thank you for your additional comment, I’m not so used to using difficult english in my country.
I verified about Q1, and it seems not good in my case.

-iadc -odac off course /ins.csd, cause error massage like ”less buffer”, so added -b256 and file has some noises as before.

Basically I write codes with Qt so used configure settings to change portaudio blocked and saved it. And again tried to record but the result was not good.
It took for a couple of month to fix my problem, and while those term I also tried plane text csd files and so on. Nothing worked except “pa_bl”.

Q2, off course I read both of them, but not all of them in detail. I could learn about relationship of ksmps and buffer. About real-time audio, your opinion is written that -iadc and -odac is needed in floss manual, I noticed today. But in my thought, real-time recording on Mac is not written enough in them. About other off-line codes both of books are so useful and have no trouble.
And “pa_bl” is likely to be written in this book though I haven’t bought yet.
https://link.springer.com/book/10.1007/978-3-319-45370-5
Best regards,

thanks for your description. actually, in my experience, jack is the
best option not only for linux, but also for mac. if you use csoundqt,
it is easy to configure. just install jackosx from
Downloads | JACK Audio Connection Kit, then run it, and choose jack in
csoundqt’s configuration panel as RT Audio Module. it also needs some
adjustment for the buffer size, for instance in jack, use 2 frames of
512 samples, and then in csound, use -B 1024. but once it is set, it
works much better than pa_bl (portaudio blocking).

joachim

Thank you Joachim for your advice.
I have prepared jack as well on other macOS for an option already. Are there archives of jack package for macOS 10.8? I searched it but couldn’t find. So I installed it to main OS using macports. And it runs without problem. But it’s too complicated to install macports and jack to the other OS for the use of music.
Best regards,
Junji@kajikoji

good to hear that it runs for you. i think jack is really the best
solution. i am sure there will be archives about older versions, but i
don’t know where.
best -
joachim

I found a kind of official archive of old jack for macOS here.
Release jackOSX Version 0.9 · jackaudio/jackaudio.github.com · GitHub.

The simple command seems not work properly.
It will take several time to learn, but I feel ok with only csound.
Commands are like this, please advice me if anything wrong.
jackd -d coreaudio -P -r 48000 -p 64 -n 4 & csound -+rtaudio=jack -iadc -odac -b 256 /User/…/.csd

It’s a kind of conclusion on this topic.
Using jack is not still competed. The routing between csound and jack is likely looping.
And I did a experiment of recording with only csound using pa_bl and realtime flags through over 5 min playing a instrument. I feel that no noise and the result is good.
Maybe jack is also possible and would give me a good result, but I wonder what is advantage to make programs complicated if the quality of sounds are enough only with a simple system.
Coding and using terminal for recording is fun and cool, but composing and playing is more important than them.

Thanks for Joachim and Rory.
And Joachim, I found your name in csound book so you are one of writer of that book are you?
I’m pleasure to be advised from you.
Best regards,
Junji@kajikoji

If you forego the command line there are many more ways of recording audio output from a Csound instrument. Blue, CsoundQT and Cabbage all features easy ways of recording audio to disk. But I understand the desire to stick with the command line :+1:

1 Like

You understand what I want.
If csound would have any problem then I’ll use wavelab or same DAWs as just work.
Thank you, Rory.