Csound Csound-dev Csound-tekno Search About

[Csnd] MIDI activated instruments: passing on note-off

Date2024-09-18 16:03
From"Jeanette C."
Subject[Csnd] MIDI activated instruments: passing on note-off
Hey hey,
I have a MIDI activated instrument, by using realtime MIDI events 
(-+rtmidi=...). Inside that instrument I need to call other instruments. Or 
possibly activate one instrument several times by one MIDI event. Her's the 
basic outline:

massign 1, "Player" ; Assign MIDI channel 1 to Player

instr Oscillator
   ; Play some sound using p4 and p5 MIDI note and velocity
endin

instr Player
   ; start several Oscillator instruments
   ; and stop them, when the MIDI note ends
endin

Of course, the Oscillator instrument is something quite complex that would 
require a lot of code to duplicate and thus be open to typos, huge code 
redundancy and very awkward maintenance. Any kind of loop, like while or 
loop_lt would not work either. Think of it like a string section made up of 
individual instruments.

Is there any tried and tested solution? Or perhaps a good opcode which I have 
overlooked that is made for this purpose?

Best wishes and thanks,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * Audiobombs: https://www.audiobombs.com/users/jeanette_c
  * GitHub: https://github.com/jeanette-c

Top down, on the strip
Lookin' in the mirror
I'm checkin' out my lipstick <3
(Britney Spears)

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

Date2024-09-18 19:48
FromVictor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE>
SubjectRe: [Csnd] MIDI activated instruments: passing on note-off
The way I would do this is to send events with fractional p1 and p3=-1 and then check for the release flag, then send corresponding negative p1s to stop the events.

Prof. Victor Lazzarini
Maynooth University
Ireland

> On 18 Sep 2024, at 17:03, Jeanette C.  wrote:
> 
> Hey hey,
> I have a MIDI activated instrument, by using realtime MIDI events (-+rtmidi=...). Inside that instrument I need to call other instruments. Or possibly activate one instrument several times by one MIDI event. Her's the basic outline:
> 
> massign 1, "Player" ; Assign MIDI channel 1 to Player
> 
> instr Oscillator
>  ; Play some sound using p4 and p5 MIDI note and velocity
> endin
> 
> instr Player
>  ; start several Oscillator instruments
>  ; and stop them, when the MIDI note ends
> endin
> 
> Of course, the Oscillator instrument is something quite complex that would require a lot of code to duplicate and thus be open to typos, huge code redundancy and very awkward maintenance. Any kind of loop, like while or loop_lt would not work either. Think of it like a string section made up of individual instruments.
> 
> Is there any tried and tested solution? Or perhaps a good opcode which I have overlooked that is made for this purpose?
> 
> Best wishes and thanks,
> 
> Jeanette
> 
> --
> * Website: http://juliencoder.de - for summer is a state of sound
> * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
> * Audiobombs: https://www.audiobombs.com/users/jeanette_c
> * GitHub: https://github.com/jeanette-c
> 
> Top down, on the strip
> Lookin' in the mirror
> I'm checkin' out my lipstick <3
> (Britney Spears)
> 
> 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

Date2024-09-18 20:02
From"Jeanette C."
SubjectRe: [Csnd] MIDI activated instruments: passing on note-off
Hi Victor,
thanks for the feedback. This sounds quite viable and clean.

Best wishes,

Jeanette

Sep 18 2024, Victor Lazzarini has written:

> The way I would do this is to send events with fractional p1 and p3=-1 and then check for the release flag, then send corresponding negative p1s to stop the events.
>
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
>
>> On 18 Sep 2024, at 17:03, Jeanette C.  wrote:
>>
>> Hey hey,
>> I have a MIDI activated instrument, by using realtime MIDI events (-+rtmidi=...). Inside that instrument I need to call other instruments. Or possibly activate one instrument several times by one MIDI event. Her's the basic outline:
>>
>> massign 1, "Player" ; Assign MIDI channel 1 to Player
>>
>> instr Oscillator
>>  ; Play some sound using p4 and p5 MIDI note and velocity
>> endin
>>
>> instr Player
>>  ; start several Oscillator instruments
>>  ; and stop them, when the MIDI note ends
>> endin
>>
>> Of course, the Oscillator instrument is something quite complex that would require a lot of code to duplicate and thus be open to typos, huge code redundancy and very awkward maintenance. Any kind of loop, like while or loop_lt would not work either. Think of it like a string section made up of individual instruments.
>>
>> Is there any tried and tested solution? Or perhaps a good opcode which I have overlooked that is made for this purpose?
>>
>> Best wishes and thanks,
>>
>> Jeanette
>>
>> --
>> * Website: http://juliencoder.de - for summer is a state of sound
>> * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
>> * Audiobombs: https://www.audiobombs.com/users/jeanette_c
>> * GitHub: https://github.com/jeanette-c
>>
>> Top down, on the strip
>> Lookin' in the mirror
>> I'm checkin' out my lipstick <3
>> (Britney Spears)
>>
>> 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
>

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * Audiobombs: https://www.audiobombs.com/users/jeanette_c
  * GitHub: https://github.com/jeanette-c

Skip on the drinks Head to the floor
Makin' my way Past the show
My body's taken over And I want some more <3
(Britney Spears)

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