Cabbage Logo
Back to Cabbage Site

Unable to create output file (solved)

Hi, I’m playing around with both Cabbage and CSound, I’m learning both. I took the code from here - http://write.flossmanuals.net/csound/h-convolution/ and I’m trying to add my own files through Cabbage GUI. I’m also trying to dump the output to a wav file. But even when I comment out the -odac and add -o output.wav, I’m still hearing the sound played through Cabbage, and I’m not able to find an output.wav anywhere. I have tried specifying an absolute path for output.wav as well, but still no luck.

This is my csd file, my comments in the code:

<Cabbage> bounds(0, 0, 0, 0)
form caption(“Convolve”) size(640, 300), colour(58, 110, 182), pluginid(“def1”)
rslider bounds(504, 10, 100, 100), channel(“gain”), range(0, 1, 0, 1, 0.01), text(“Gain”), trackercolour(0, 255, 0, 255), outlinecolour(0, 0, 0, 50), textcolour(0, 0, 0, 255) increment(0.01)

filebutton bounds(42, 24, 80, 40) channel(“filename”)
csoundoutput bounds(0, 100, 400, 200)
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
;-odac -----------------> I HAVE THIS COMMENTED OUT
-o output.wav ; ----------> No output.wav generated
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 512
nchnls = 2
0dbfs = 1

gasig init 0

instr 1 ; sound file player
gasig diskin2 p4,1,0,1
endin

instr 2 ; convolution reverb
; Define partion size.
; Larger values require less CPU but result in more latency.
; Smaller values produce lower latency but may cause -
; - realtime performance issues
ipartitionsize = 256
ar1,ar2 pconvolve gasig, p4,ipartitionsize
; create a delayed version of the input signal that will sync -
; - with convolution output
adel delay gasig,ipartitionsize/sr
; create a dry/wet mix
aMixL ntrpol adel,ar10.1,p5
aMixR ntrpol adel,ar2
0.1,p5
outs aMixL,aMixR
gasig = 0
endin

</CsInstruments>
<CsScore>
; instr 1. sound file player
; p4=input soundfile
; instr 2. convolution reverb
; p4=impulse response file
; p5=dry/wet mix (0 - 1)

i 1 0 8.6 chnget “filename”
i 2 0 10 “stairwell.wav” 0.3

i 1 10 8.6 “loop.wav”
i 2 10 10 “dish.wav” 0.8
e
</CsScore>
</CsoundSynthesizer>

Can someone please help point out what I’m doing wrong?

Thanks in advance

You can’t output a wav file like that wen you are running Csound in realtime mode. That flag is for offline rendering of files only. What you could do is introduce a new instrument that is always on and using the fout opcode to write to disk.

instr 1000
aL, aR monitor
fout "outputfile.wav", 4 ,aL, aR
endin

Note that each time you run the instrument it will overwrite the previous file. To counteract this you could use adate opcode to concoct a unique file name each time.

Thanks!

Cool. It’s kind of covered here. And here’s a simple example of how you might connect your file recorder to a button in Cabbage. It will write a unique file name each time you start recording. FileRecord.csd (1.7 KB)