Csound Csound-dev Csound-tekno Search About

[Csnd] Tied note-friendly soundfont opcodes

Date2021-01-16 13:54
Fromintercalations <0000080abb89a9d9-dmarc-request@LISTSERV.HEANET.IE>
Subject[Csnd] Tied note-friendly soundfont opcodes
I am trying to build an instrument that makes use of a soundfont, and I'm hoping for it to be able to support tied notes. The closest I've gotten to smooth, click-less audio output is to use sflooper, which allows for the passing of an "iskip" parameter. The one downside to it is that it requires loop points, which to my knowledge is impossible to know when trying to build a generic soundfont player that can support any soundfont file.

I've also tried working with sfplay, which allows for the specification of an "ioffset" parameter, but even if I keep track of the samples processed over the span of a series of tied notes (incrementing accordingly using abs(p3) * sr), it seems I cannot eliminate the clicking.

Any help would be deeply appreciated.

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

Date2021-01-18 14:39
Fromintercalations <0000080abb89a9d9-dmarc-request@LISTSERV.HEANET.IE>
SubjectRe: [Csnd] Tied note-friendly soundfont opcodes
I've figured this out, using a trick Steven Yi showed me:


opcode sfplayForTiedNotes, aa, iiaaiooo
  tigoto skipInit

  ivel, inotenum, aamp, afreq, ipreindex, iflag, ioffset, ienv xin

  aleft, aright sfplay ivel, inotenum, aamp, afreq, ipreindex, iflag, ioffset, ienv

  xout aleft, aright

  skipInit:
endop

opcode sfplayForTiedNotes, aa, iikkiooo
  tigoto skipInit

  ivel, inotenum, kamp, kfreq, ipreindex, iflag, ioffset, ienv xin

  aleft, aright sfplay ivel, inotenum, kamp, kfreq, ipreindex, iflag, ioffset, ienv

  xout aleft, aright

  skipInit:
endop

opcode sfplayForTiedNotes, aa, iiiiiooo
  tigoto skipInit

  ivel, inotenum, iamp, ifreq, ipreindex, iflag, ioffset, ienv xin

  aleft, aright sfplay ivel, inotenum, iamp, ifreq, ipreindex, iflag, ioffset, ienv

  xout aleft, aright

  skipInit:
endop


Note that a- or k-rate arguments passed as amplitude/frequency should also have support for tied notes for the output to occur as intended.


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, January 16, 2021 8:54 AM, intercalations <0000080abb89a9d9-dmarc-request@LISTSERV.HEANET.IE> wrote:

> I am trying to build an instrument that makes use of a soundfont, and I'm hoping for it to be able to support tied notes. The closest I've gotten to smooth, click-less audio output is to use sflooper, which allows for the passing of an "iskip" parameter. The one downside to it is that it requires loop points, which to my knowledge is impossible to know when trying to build a generic soundfont player that can support any soundfont file.
>
> I've also tried working with sfplay, which allows for the specification of an "ioffset" parameter, but even if I keep track of the samples processed over the span of a series of tied notes (incrementing accordingly using abs(p3) * sr), it seems I cannot eliminate the clicking.
>
> Any help would be deeply appreciated.
>
> 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