Csound Csound-dev Csound-tekno Search About

[Cs-dev] Extending use of MIDI program change

Date2013-05-26 16:56
FromHenrik Andersson
Subject[Cs-dev] Extending use of MIDI program change
AttachmentsNone  None  
Hi,

I working on a host (musical composer) which uses csound instruments, im relative new on csound so my topic might already be solved in some way. I use control channels to interface between host and instrument and I have a need for having "presets", that do belong to the csound instrument and not the host, for the controls bound to midi program change.
I noticed one could use pgmassign to bind an instrument to a program but what i want is to bind a table of values for control values. I'm thinking about something like:

pgmassign 0, f1

chn_k "amp"...
chn_k "freq"...

instr 1
  kamp  chnget "amp"
  kf  chnget "freq"
  aout    oscil kamp, kf
            out aout
endin

f1 "Damped and dull", 0.25, 65.405
f2 "Strong A4", 0.8, 440


Anyone have any thougths about this ? 

Is it already doable with current csound ?

Is this considered as such a specific feature so it doesnt belong to csound ?


Regards,

Henrik Andersson

Date2013-05-27 16:49
FromRory Walsh
SubjectRe: [Cs-dev] Extending use of MIDI program change
I think this is currently doable, but I don't think you need to assign
a program change to a function table. That part confuses me a little.
Anyhow, one approach is to set up a MIDI listener instrument which
uses the midiin opcode. You could then check for program changes there
and use a simple test to assign different function tables depending on
the program change, or?

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-05-27 17:10
FromAndres Cabrera
SubjectRe: [Cs-dev] Extending use of MIDI program change
AttachmentsNone  None  
Hi,

The built-in program change mechanism is simple and designed to switch only the instrument triggered by incoming MIDI.
But you could have an instrument receive the program changes using midiin and change a global variable that sets the table number for the synthesizer instrument. You then need to make sure your opcode accepts k-rate table changes, or check whether the table has changed and do a re-init.

Cheers,
Andrés


On Sun, May 26, 2013 at 8:56 AM, Henrik Andersson <henrik.4e@gmail.com> wrote:
Hi,

I working on a host (musical composer) which uses csound instruments, im relative new on csound so my topic might already be solved in some way. I use control channels to interface between host and instrument and I have a need for having "presets", that do belong to the csound instrument and not the host, for the controls bound to midi program change.
I noticed one could use pgmassign to bind an instrument to a program but what i want is to bind a table of values for control values. I'm thinking about something like:

pgmassign 0, f1

chn_k "amp"...
chn_k "freq"...

instr 1
  kamp  chnget "amp"
  kf  chnget "freq"
  aout    oscil kamp, kf
            out aout
endin

f1 "Damped and dull", 0.25, 65.405
f2 "Strong A4", 0.8, 440


Anyone have any thougths about this ? 

Is it already doable with current csound ?

Is this considered as such a specific feature so it doesnt belong to csound ?


Regards,

Henrik Andersson

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



Date2013-05-27 20:28
FromHenrik Andersson
SubjectRe: [Cs-dev] Extending use of MIDI program change
AttachmentsNone  None  
Hi,

I definitly wrote that message in haste, it was several questions into one topic, if its doable or not and a feature request... Let me rephrase the whole thing a bit and start with a explanation, i want to have an api for querying and selecting "presets" which hold values for each defined controller channel.

Take this example:

chn_k   "amp"...
chn_k   "freq"...

preset "Loud amp", 1.0, 220
preset "Damped amp", 0.4, 440

pgmassign 1, "Loud amp"
pgmassign 2, "Damped amp"

instr 1
  kAmp getchn "amp"
  kFreq getchn "freq"
  aout  oscil  kAmp, kFreq
           out aout
endin

And consider this Preset API + c code usage:

/* Returns null if index out of range */
const char *csoundGetPreset(CSOUND *cs, int index);
/* Selects a preset with name */
void csoundSelectPreset(CSOUND *cs, const char *name);

eg:

/* Example of enumeration of presets */
idx = 0;
name = csoundGetPreset(csound, idx);
while(name)
{
  printf(stderr,"Preset: %s\n", name);
  name = csoundGetPreset(csound, idx++)
}

/* Actual use of a preset */
csoundSelectPreset(csound, "Loud amp");

which will select "Loud amp" program and set "amp" to 1.0 and freq to 220.


/Henrik



2013/5/27 Andres Cabrera <mantaraya36@gmail.com>
Hi,

The built-in program change mechanism is simple and designed to switch only the instrument triggered by incoming MIDI.
But you could have an instrument receive the program changes using midiin and change a global variable that sets the table number for the synthesizer instrument. You then need to make sure your opcode accepts k-rate table changes, or check whether the table has changed and do a re-init.

Cheers,
Andrés


On Sun, May 26, 2013 at 8:56 AM, Henrik Andersson <henrik.4e@gmail.com> wrote:
Hi,

I working on a host (musical composer) which uses csound instruments, im relative new on csound so my topic might already be solved in some way. I use control channels to interface between host and instrument and I have a need for having "presets", that do belong to the csound instrument and not the host, for the controls bound to midi program change.
I noticed one could use pgmassign to bind an instrument to a program but what i want is to bind a table of values for control values. I'm thinking about something like:

pgmassign 0, f1

chn_k "amp"...
chn_k "freq"...

instr 1
  kamp  chnget "amp"
  kf  chnget "freq"
  aout    oscil kamp, kf
            out aout
endin

f1 "Damped and dull", 0.25, 65.405
f2 "Strong A4", 0.8, 440


Anyone have any thougths about this ? 

Is it already doable with current csound ?

Is this considered as such a specific feature so it doesnt belong to csound ?


Regards,

Henrik Andersson

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



Date2013-06-06 01:36
FromAndres Cabrera
SubjectRe: [Cs-dev] Extending use of MIDI program change
AttachmentsNone  None  
Hi,

I guess it's doable, but it would have to be better defined. For example, how do values map to channel names? i.e. how does Csound know how to set a certain channel with a value.

Maybe this is better handled by an opcode or UDO rather than an API function?

Cheers,
Andrés


On Mon, May 27, 2013 at 12:28 PM, Henrik Andersson <henrik.4e@gmail.com> wrote:
Hi,

I definitly wrote that message in haste, it was several questions into one topic, if its doable or not and a feature request... Let me rephrase the whole thing a bit and start with a explanation, i want to have an api for querying and selecting "presets" which hold values for each defined controller channel.

Take this example:

chn_k   "amp"...
chn_k   "freq"...

preset "Loud amp", 1.0, 220
preset "Damped amp", 0.4, 440

pgmassign 1, "Loud amp"
pgmassign 2, "Damped amp"

instr 1
  kAmp getchn "amp"
  kFreq getchn "freq"
  aout  oscil  kAmp, kFreq
           out aout
endin

And consider this Preset API + c code usage:

/* Returns null if index out of range */
const char *csoundGetPreset(CSOUND *cs, int index);
/* Selects a preset with name */
void csoundSelectPreset(CSOUND *cs, const char *name);

eg:

/* Example of enumeration of presets */
idx = 0;
name = csoundGetPreset(csound, idx);
while(name)
{
  printf(stderr,"Preset: %s\n", name);
  name = csoundGetPreset(csound, idx++)
}

/* Actual use of a preset */
csoundSelectPreset(csound, "Loud amp");

which will select "Loud amp" program and set "amp" to 1.0 and freq to 220.


/Henrik



2013/5/27 Andres Cabrera <mantaraya36@gmail.com>
Hi,

The built-in program change mechanism is simple and designed to switch only the instrument triggered by incoming MIDI.
But you could have an instrument receive the program changes using midiin and change a global variable that sets the table number for the synthesizer instrument. You then need to make sure your opcode accepts k-rate table changes, or check whether the table has changed and do a re-init.

Cheers,
Andrés


On Sun, May 26, 2013 at 8:56 AM, Henrik Andersson <henrik.4e@gmail.com> wrote:
Hi,

I working on a host (musical composer) which uses csound instruments, im relative new on csound so my topic might already be solved in some way. I use control channels to interface between host and instrument and I have a need for having "presets", that do belong to the csound instrument and not the host, for the controls bound to midi program change.
I noticed one could use pgmassign to bind an instrument to a program but what i want is to bind a table of values for control values. I'm thinking about something like:

pgmassign 0, f1

chn_k "amp"...
chn_k "freq"...

instr 1
  kamp  chnget "amp"
  kf  chnget "freq"
  aout    oscil kamp, kf
            out aout
endin

f1 "Damped and dull", 0.25, 65.405
f2 "Strong A4", 0.8, 440


Anyone have any thougths about this ? 

Is it already doable with current csound ?

Is this considered as such a specific feature so it doesnt belong to csound ?


Regards,

Henrik Andersson

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel