Csound Csound-dev Csound-tekno Search About

[Cs-dev] bug in midinoteoncps, midinoteonoct, midinoteonpch (?)

Date2006-05-23 23:57
From"Jon B. Proton"
Subject[Cs-dev] bug in midinoteoncps, midinoteonoct, midinoteonpch (?)
hi,
I think I've stumbled on a bug in the midinoteoncps, midinoteonoct and
midinoteonpch opcodes.  (midinoteonkey seems to work fine.)

To take midinoteoncps as an example:

midinoteoncps xcps, xvelocity

I find that it changes the value of xcps received from the score, even
when there has been no MIDI activation.  The manual states that xcps is
supposed to remain unchanged in this case.  (xvelocity does remain
unchanged)


Here's a simple example to demonstrate:

test_midi.csd
----------------------------


sr=44100
kr=4410
ksmps=10
nchnls=2

massign 1, 2

instr 2

mididefault 12000, p4

print p4
print p5
print p6

midinoteoncps p5, p6

prints "midinoteoncps p5, p6 just happened\n"
print p4
print p5
print p6

aout oscili p4, p5, 1
outs aout, aout
endin





f0 10000
f 1 0 4096 10 0 1

i2      0.0     10.0    10000   100     100
e



----------------------------------

The output of running this is:
SECTION 1:
instr 2:  p4 = 10000.000
instr 2:  p5 = 100.000
instr 2:  p6 = 100.000
midinoteoncps p5, p6 just happened
instr 2:  p4 = 10000.000
instr 2:  p5 = 2636.872
instr 2:  p6 = 100.000


p5 was altered after the midinoteoncps command.  I am sure there was no
spurious MIDI activation because the value of p4 stayed 10000.  When I hit
a key on my midi keyboard, I can see the mididefault command change p4 to
12000.

midinoteonoct and midinoteonpch also alter the value of p5 too.

fyi, I'm using
Csound version 5.01.1 (double samples) Mar 17 2006
for linux i386.

thanks,
Jon






-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-06-03 15:51
FromAndres Cabrera
SubjectRe: [Cs-dev] bug in midinoteoncps, midinoteonoct, midinoteonpch (?)
Hi Ron,

Sorry for the very late reply, was tied up with other stuff.

I think you are right, p-fields shouldn't be changed for score-driven
events, as the score should already provide the information in the
desired format (oct,pch or cps) (what's happening now is that the score
value is taken as MIDI note value and transformed to cps).
I had a look a the sources, and the problem seems to be in file
OOps/midiinterop.c in lines 91-96, 74-75, and 58-60. They should be
removed for the opcodes to behave as currently documented.
This bug/feature has gone unnoticed for a long time, so here comes the
question, should the opcode be fixed to behave as the documentation, or
should an additional optional flag be added to provide this more
sensible behavior? (or should the documentation just reflect the real
behavior- I would prefer one of the other options since working with
MIDI note numbers you are limited to half-note scales)

Cheers,
Andrés


On Tue, 2006-05-23 at 18:57 -0400, Jon B. Proton wrote:
> hi,
> I think I've stumbled on a bug in the midinoteoncps, midinoteonoct and
> midinoteonpch opcodes.  (midinoteonkey seems to work fine.)
> 
> To take midinoteoncps as an example:
> 
> midinoteoncps xcps, xvelocity
> 
> I find that it changes the value of xcps received from the score, even
> when there has been no MIDI activation.  The manual states that xcps is
> supposed to remain unchanged in this case.  (xvelocity does remain
> unchanged)
> 
> 
> Here's a simple example to demonstrate:
> 
> test_midi.csd
> ----------------------------
> 
> 
> sr=44100
> kr=4410
> ksmps=10
> nchnls=2
> 
> massign 1, 2
> 
> instr 2
> 
> mididefault 12000, p4
> 
> print p4
> print p5
> print p6
> 
> midinoteoncps p5, p6
> 
> prints "midinoteoncps p5, p6 just happened\n"
> print p4
> print p5
> print p6
> 
> aout oscili p4, p5, 1
> outs aout, aout
> endin
> 
> 
> 
> 
> 
> f0 10000
> f 1 0 4096 10 0 1
> 
> i2      0.0     10.0    10000   100     100
> e
> 
> 
> 
> ----------------------------------
> 
> The output of running this is:
> SECTION 1:
> instr 2:  p4 = 10000.000
> instr 2:  p5 = 100.000
> instr 2:  p6 = 100.000
> midinoteoncps p5, p6 just happened
> instr 2:  p4 = 10000.000
> instr 2:  p5 = 2636.872
> instr 2:  p6 = 100.000
> 
> 
> p5 was altered after the midinoteoncps command.  I am sure there was no
> spurious MIDI activation because the value of p4 stayed 10000.  When I hit
> a key on my midi keyboard, I can see the mididefault command change p4 to
> 12000.
> 
> midinoteonoct and midinoteonpch also alter the value of p5 too.
> 
> fyi, I'm using
> Csound version 5.01.1 (double samples) Mar 17 2006
> for linux i386.
> 
> thanks,
> Jon
> 
> 
> 
> 
> 
> 
> -------------------------------------------------------
> All the advantages of Linux Managed Hosting--Without the Cost and Risk!
> Fully trained technicians. The highest number of Red Hat certifications in
> the hosting industry. Fanatical Support. Click to learn more
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 
> 



_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https