[Csnd] Looper Instrument is not working - due to a problem with an instrument call?

Hello everybody!

I’m working on an looper instrument, which triggers the recording section via a MIDI Note. So that the instrument which is handling the recording starts recording when a specific midi-note gets in.
I use this method a lot and normaly i have no problems with this. But now an problem occurs.

SECTION 1:
new alloc for instr 1:

csound command: Abort trap
inactive allocs returned to freespace
end of score. overall amps: 0.00000 0.00000
     overall samples out of range: 0 0
0 errors in performance
Elapsed time at end of performance: real: 4.003s, CPU: 0.034s
closing device
0 128 sample blks of 64-bit floats written to dac3

I don’t know why. I also started to build the instrument again, but when the instruments are called via the score. There i have no problems.

Can somebody help?

This is the code:

<CsoundSynthesizer>
<CsOptions>
-d -odac3 -iadc2 -W -3 -+rtmidi=coremidi -M0 -B128 -b64
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 64
nchnls = 2
0dbfs = 1.0
nchnls_i = 1
gimic = 1

gibufferSize = 5
gibuffer ftgen 0, 0, -gibufferSize*sr, 2, 0
massign 1, 100
;-----------------------------------------------------------
#include "/Users/philippneumann/Documents/Csound/PHN-UDOs.txt"
;-----------------------------------------------------------
instr 100
ktrig init 0
imidiNote notnum
if imidiNote == 1 then
  ktrig += 1
  schedkwhen ktrig, 0, 1, 101, 0, gibufferSize
endif
endin

instr 101
ain inch gimic
aindx phasor 1/gibufferSize
tablew ain, aindx, gibuffer, 1
endin

instr 1
aindx phasor 1/gibufferSize
aloop table3 aindx, gibuffer, 1

initc7 1, 1, 0
kloopAmp ctrl7 1, 1, -120, -0
kloopAmp port kloopAmp, 0.05
printks2 "Loop-Amplitude: %d%n", kloopAmp

aout = aloop * ampdbfs(kloopAmp)
outs aout, aout
endin
;-----------------------------------------------------------
</CsInstruments>
<CsScore>
i1 0 z
</CsScore>
</CsoundSynthesizer>
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here

Versio?
pltfoem?

^G Get Help ^X Send ^R Read File ^Y Prev Pg ^K Cut Text ^O Postpone
<<
^G Get Help ^X Send ^R Read File ^Y Prev Pg ^K Cut Text ^O Postpone

This line is crashing Csound

printks2 "Loop-Amplitude: %d%n", kloopAmp

if you change %n to \n, it runs.

I tested it with 6.18 and the line

printks2 "Loop-Amplitude: %d%n", kloopAmp

is responsible. I see in the manual that %d is supposed to be the same as \n but that is what is causing the crash.