[Csnd] scanned synthesis ihold not working

Hello list,

; Select audio/midi flags here according to platform ; Audio out Audio in No messages -odac ; -iadc -d ;;;RT audio I/O ; For Non-realtime ouput leave only the line below: ; -o scans.wav -W ;;; for file output any platform sr = 44100 ksmps = 32 nchnls = 1

instr 1
a0 = 0
; scanu init, irate, ifnvel, ifnmass, ifnstif, ifncentr, ifndamp, kmass, kstif, kcentr, kdamp, ileft, iright, kpos, kstrngth, ain, idisp, id
scanu 1, .01, 6, 2, 3, 4, 5, 2, .1, .1, -.01, .1, .5, 0, 0, a0, 1, 2
;ar scans kamp, kfreq, ifntraj, id
a1 scans ampdb(p5), cpsmidinn(p4), 7, 2

ihold

outs a1,a1
endin


f1 0 128 -7 0 128 0 ; Initial condition
f2 0 128 -7 1 128 1 ; uniform masses
f3 0 16384 -23 “string-128.matrxB” ; Spring matrices
f4 0 128 -7 0 128 0 ; no force ; Centering force
f5 0 128 -7 0 128 0 ; no damping ; Damping
f6 0 128 -7 0 128 0 ; Initial velocity
f7 0 128 -7 0 128 127 ; linear Trajectories

; Note list
f 1 0 128 -7 -1 128 1 0 ; sawtooth
i1 0 1000 69.00 75
e

In this very simple scanned synthesis instrument, either using ihold or a negative p3 doesn’t work. (csound just exits immediately).

I need the note to be held to simulate rehammering the string without resetting the state of the masses.

I was going to do some hack like this:

while indx < 128 do
k1,k2 xscanmap 2, 1, 1, indx
kvel table indx,1
tablew k1+kvel,indx,1
tablew k2,indx,6
od

to add the hammer waveform over the current state of the vibrating system but I can’t do that without the note being held.

Thank you in advance.

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

To keep Csound open use

f 0 z

that’ll keep it going beyond our lifetimes

Prof. Victor Lazzarini
Maynooth University
Ireland

Hello Victor,

Simple solution, thank you very much!

On the same topic, am I going about this the right way?, it seems a bit of a hacky solution and maybe something that should be integrated into scan/u to be able to retrigger it.

Missatge de Victor Lazzarini <Victor.Lazzarini@mu.ie> del dia dc., 5 de gen. 2022 a les 19:18:

To keep Csound open use

f 0 z

that’ll keep it going beyond our lifetimes

Prof. Victor Lazzarini
Maynooth University
Ireland

Warning

This email originated from outside of Maynooth University’s Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.

Hello list,

; Select audio/midi flags here according to platform ; Audio out Audio in No messages -odac ; -iadc -d ;;;RT audio I/O ; For Non-realtime ouput leave only the line below: ; -o scans.wav -W ;;; for file output any platform sr = 44100 ksmps = 32 nchnls = 1

instr 1
a0 = 0
; scanu init, irate, ifnvel, ifnmass, ifnstif, ifncentr, ifndamp, kmass, kstif, kcentr, kdamp, ileft, iright, kpos, kstrngth, ain, idisp, id
scanu 1, .01, 6, 2, 3, 4, 5, 2, .1, .1, -.01, .1, .5, 0, 0, a0, 1, 2
;ar scans kamp, kfreq, ifntraj, id
a1 scans ampdb(p5), cpsmidinn(p4), 7, 2

ihold

outs a1,a1
endin


f1 0 128 -7 0 128 0 ; Initial condition
f2 0 128 -7 1 128 1 ; uniform masses
f3 0 16384 -23 “string-128.matrxB” ; Spring matrices
f4 0 128 -7 0 128 0 ; no force ; Centering force
f5 0 128 -7 0 128 0 ; no damping ; Damping
f6 0 128 -7 0 128 0 ; Initial velocity
f7 0 128 -7 0 128 127 ; linear Trajectories

; Note list
f 1 0 128 -7 -1 128 1 0 ; sawtooth
i1 0 1000 69.00 75
e

In this very simple scanned synthesis instrument, either using ihold or a negative p3 doesn’t work. (csound just exits immediately).

I need the note to be held to simulate rehammering the string without resetting the state of the masses.

I was going to do some hack like this:

while indx < 128 do
k1,k2 xscanmap 2, 1, 1, indx
kvel table indx,1
tablew k1+kvel,indx,1
tablew k2,indx,6
od

to add the hammer waveform over the current state of the vibrating system but I can’t do that without the note being held.

Thank you in advance.

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

for a bit more context what I’m trying to do is a scanned synthesis instrument with a behaviour similar to sympathetic resonance.

I’m modelling 2 “strings” for now as the 2 halves of a 128 string and a hammer shape to hit one half or the other. This induces some vibration on the other end.

The idea would be to model all of the strings of an instrument like that, so I need to be able to retrigger the instrument with different hammer shapes while keeping the internal state of the spring simulation to simulate plucking/hammering each string.

Missatge de Victor Lazzarini <Victor.Lazzarini@mu.ie> del dia dc., 5 de gen. 2022 a les 19:18:

To keep Csound open use

f 0 z

that’ll keep it going beyond our lifetimes

Prof. Victor Lazzarini
Maynooth University
Ireland

Warning

This email originated from outside of Maynooth University’s Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.

Hello list,

; Select audio/midi flags here according to platform ; Audio out Audio in No messages -odac ; -iadc -d ;;;RT audio I/O ; For Non-realtime ouput leave only the line below: ; -o scans.wav -W ;;; for file output any platform sr = 44100 ksmps = 32 nchnls = 1

instr 1
a0 = 0
; scanu init, irate, ifnvel, ifnmass, ifnstif, ifncentr, ifndamp, kmass, kstif, kcentr, kdamp, ileft, iright, kpos, kstrngth, ain, idisp, id
scanu 1, .01, 6, 2, 3, 4, 5, 2, .1, .1, -.01, .1, .5, 0, 0, a0, 1, 2
;ar scans kamp, kfreq, ifntraj, id
a1 scans ampdb(p5), cpsmidinn(p4), 7, 2

ihold

outs a1,a1
endin


f1 0 128 -7 0 128 0 ; Initial condition
f2 0 128 -7 1 128 1 ; uniform masses
f3 0 16384 -23 “string-128.matrxB” ; Spring matrices
f4 0 128 -7 0 128 0 ; no force ; Centering force
f5 0 128 -7 0 128 0 ; no damping ; Damping
f6 0 128 -7 0 128 0 ; Initial velocity
f7 0 128 -7 0 128 127 ; linear Trajectories

; Note list
f 1 0 128 -7 -1 128 1 0 ; sawtooth
i1 0 1000 69.00 75
e

In this very simple scanned synthesis instrument, either using ihold or a negative p3 doesn’t work. (csound just exits immediately).

I need the note to be held to simulate rehammering the string without resetting the state of the masses.

I was going to do some hack like this:

while indx < 128 do
k1,k2 xscanmap 2, 1, 1, indx
kvel table indx,1
tablew k1+kvel,indx,1
tablew k2,indx,6
od

to add the hammer waveform over the current state of the vibrating system but I can’t do that without the note being held.

Thank you in advance.

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

I’m quite lost, nothing I try works.

  1. I’ve tried to hammer the instrument using ain:

I create an instrument to generate the audio waveform to strike the spring with table 1. This should generate a very short burst and stay at 0 afterwards

instr 2
kamp linseg 1, 0.0001, 0, 50, 0
a1 oscil 1, cpsmidinn(p4), 1
zaw a1*kamp, 1
endin

and read it on the scanned synthesis instrument

instr 1
a0 zar 1
; scanu init, irate, ifnvel, ifnmass, ifnstif, ifncentr, ifndamp, kmass, kstif, kcentr, kdamp, ileft, iright, kpos, kstrngth, ain, idisp, id
scanu 1, .01, 6, 2, 3, 4, 5, 2, .1, .1, -.01, .1, .5, 0, 0, a0, 1, 2
;ar scans kamp, kfreq, ifntraj, id
a1 scans ampdb(75), cpsmidinn(p4), 7, 2
outs a1,a1
endin

my intention is that this generates exactly the same excitation that it would by starting with table 1

f1 0 128 -7 0 128 0; empty table
i1 0 -1 69.00 ; trigger instrument forever
f 1 1 128 -7 0 120 0 0 1 8 1 ; line hammer
i2 1 10; Hammer it!

ftable 1: 128 points, scalemax 1.000

So, I think I completely misunderstood what feeding audio does. Of course it can’t feed the 128 samples at once into each of the springs (which is what I want). Instead it’s probably feeding each sample at once to all of the springs (although it seems it’s scaled for each mass)

Mass displacement 128 points, scalemax 6902.736