[Csnd] MIDI scheduling

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Csnd] MIDI scheduling

Chuckk Hubbard
This is getting to me.  I tried to use any midi event to trigger video
with CsoundAV, and it works, but at initialization it inserts or
somehow detects about a dozen noteon/off pairs, and plays the video
immediately.  I added the line:
kmid = (kmid = 224 ? 224:0)
printk2 kmid  (which was there already)

to restrict it to pitch bend, and it worked... once.  Now whenever I
run it, it inserts a pitch bend message at init time!  What could be
causing this?

-Chuckk


--
"Some people got attitude,
Backed up with attitude."
-G. Love
--
Send bugs reports to [hidden email]
              (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] MIDI scheduling

Aidan Collins
I've had a similar thing happen to me, I think it might store up a few
messages when signals are sent while the system isn't running.
maybe delay the triggering in your system? let it sit for a secord or
two before it starts doing things with the midi maybe?

A

On 5/10/05, Chuckk Hubbard <[hidden email]> wrote:

> This is getting to me.  I tried to use any midi event to trigger video
> with CsoundAV, and it works, but at initialization it inserts or
> somehow detects about a dozen noteon/off pairs, and plays the video
> immediately.  I added the line:
> kmid = (kmid = 224 ? 224:0)
> printk2 kmid  (which was there already)
>
> to restrict it to pitch bend, and it worked... once.  Now whenever I
> run it, it inserts a pitch bend message at init time!  What could be
> causing this?
>
> -Chuckk
>
> --
> "Some people got attitude,
> Backed up with attitude."
> -G. Love
> --
> Send bugs reports to [hidden email]
>               (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
> To unsubscribe, send email to [hidden email]
>
--
Send bugs reports to [hidden email]
              (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] MIDI scheduling

Gabriel Maldonado
In reply to this post by Chuckk Hubbard
Please send the .csd, otherwise there is no way to understand it...
--
Gabriel Maldonado
http://csounds.com/maldonado
--

Chuckk Hubbard wrote:

> This is getting to me.  I tried to use any midi event to trigger video
> with CsoundAV, and it works, but at initialization it inserts or
> somehow detects about a dozen noteon/off pairs, and plays the video
> immediately.  I added the line:
> kmid = (kmid = 224 ? 224:0)
> printk2 kmid  (which was there already)
>
> to restrict it to pitch bend, and it worked... once.  Now whenever I
> run it, it inserts a pitch bend message at init time!  What could be
> causing this?
>
> -Chuckk
>
>

--
Send bugs reports to [hidden email]
              (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] MIDI scheduling

Chuckk Hubbard
In reply to this post by Aidan Collins
Just now I tried having the instrument with the midiin/schedwhen
command not called until 3, as in p2 = 3, and again it worked once and
then started reading ghost events.
I take it there would have to be a pause between the midiin statement
and the schedwhen statement...  The only way I can think of would be
to create a third instrument.

Perhaps it will work differently, though, with inter-application midi
than with keyboard input.

-Chuckk

On 5/10/05, Aidan Collins <[hidden email]> wrote:

> I've had a similar thing happen to me, I think it might store up a few
> messages when signals are sent while the system isn't running.
> maybe delay the triggering in your system? let it sit for a secord or
> two before it starts doing things with the midi maybe?
>
> A
>
> On 5/10/05, Chuckk Hubbard <[hidden email]> wrote:
> > This is getting to me.  I tried to use any midi event to trigger video
> > with CsoundAV, and it works, but at initialization it inserts or
> > somehow detects about a dozen noteon/off pairs, and plays the video
> > immediately.  I added the line:
> > kmid = (kmid = 224 ? 224:0)
> > printk2 kmid  (which was there already)
> >
> > to restrict it to pitch bend, and it worked... once.  Now whenever I
> > run it, it inserts a pitch bend message at init time!  What could be
> > causing this?
> >
> > -Chuckk
> >
> > --
> > "Some people got attitude,
> > Backed up with attitude."
> > -G. Love
> > --
> > Send bugs reports to [hidden email]
> >               (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
> > To unsubscribe, send email to [hidden email]
> >
>


--
"Some people got attitude,
Backed up with attitude."
-G. Love
--
Send bugs reports to [hidden email]
              (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] MIDI scheduling

Chuckk Hubbard
In reply to this post by Gabriel Maldonado
I'm actually using a pared-down version of the GLtexvideo example that
comes bundled.  I removed the opcodes that distort the image as I was
able to figure them out by trial-and-error, but there are probably
some unnecessary mapping things I left in, that I wasn't sure about.
I'll post it when I return home.

-Chuckk

On 5/10/05, Gabriel Maldonado <[hidden email]> wrote:

> Please send the .csd, otherwise there is no way to understand it...
> --
> Gabriel Maldonado
> http://csounds.com/maldonado
> --
>
> Chuckk Hubbard wrote:
> > This is getting to me.  I tried to use any midi event to trigger video
> > with CsoundAV, and it works, but at initialization it inserts or
> > somehow detects about a dozen noteon/off pairs, and plays the video
> > immediately.  I added the line:
> > kmid = (kmid = 224 ? 224:0)
> > printk2 kmid  (which was there already)
> >
> > to restrict it to pitch bend, and it worked... once.  Now whenever I
> > run it, it inserts a pitch bend message at init time!  What could be
> > causing this?
> >
> > -Chuckk
> >
> >
>
> --
> Send bugs reports to [hidden email]
>               (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
> To unsubscribe, send email to [hidden email]
>


--
"Some people got attitude,
Backed up with attitude."
-G. Love
--
Send bugs reports to [hidden email]
              (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] MIDI scheduling

Richard Dobson
In reply to this post by Chuckk Hubbard
Just checking: the line as you have typed it appears to have a typo, with an
assignment where one would expect a conditional expression:

kmid = (kmid = 224 ? 224:0)

This just sets kmid to 224 (always), which is consistent with the symptom you
describe.

Richard Dobson



Chuckk Hubbard wrote:

> This is getting to me.  I tried to use any midi event to trigger video
> with CsoundAV, and it works, but at initialization it inserts or
> somehow detects about a dozen noteon/off pairs, and plays the video
> immediately.  I added the line:
> kmid = (kmid = 224 ? 224:0)
> printk2 kmid  (which was there already)
>
> to restrict it to pitch bend, and it worked... once.  Now whenever I
> run it, it inserts a pitch bend message at init time!  What could be
> causing this?
>
> -Chuckk
>
>


--
Send bugs reports to [hidden email]
              (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] MIDI scheduling

Chuckk Hubbard
According to the manual, this sets kmid = 224 if it already is 224,
and 0 if not.  I only inserted this line because it was already
reading events that weren't there.
Maybe it would make more sense to use another variable, like
kswitch = (kmid = 224 ? 224:0)
but I believe I tried that as well.

-Chuckk


On 5/10/05, Richard Dobson <[hidden email]> wrote:

> Just checking: the line as you have typed it appears to have a typo, with an
> assignment where one would expect a conditional expression:
>
> kmid = (kmid = 224 ? 224:0)
>
> This just sets kmid to 224 (always), which is consistent with the symptom you
> describe.
>
> Richard Dobson
>
>
> Chuckk Hubbard wrote:
> > This is getting to me.  I tried to use any midi event to trigger video
> > with CsoundAV, and it works, but at initialization it inserts or
> > somehow detects about a dozen noteon/off pairs, and plays the video
> > immediately.  I added the line:
> > kmid = (kmid = 224 ? 224:0)
> > printk2 kmid  (which was there already)
> >
> > to restrict it to pitch bend, and it worked... once.  Now whenever I
> > run it, it inserts a pitch bend message at init time!  What could be
> > causing this?
> >
> > -Chuckk
> >
> >
>
> --
> Send bugs reports to [hidden email]
>               (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
> To unsubscribe, send email to [hidden email]
>


--
"Some people got attitude,
Backed up with attitude."
-G. Love
--
Send bugs reports to [hidden email]
              (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] MIDI scheduling

Steven Yi
I think Richard was suggesting:

kmid = (kmid == 224 ? 224 : 0)

(== versus = )

On 5/10/05, Chuckk Hubbard <[hidden email]> wrote:

> According to the manual, this sets kmid = 224 if it already is 224,
> and 0 if not.  I only inserted this line because it was already
> reading events that weren't there.
> Maybe it would make more sense to use another variable, like
> kswitch = (kmid = 224 ? 224:0)
> but I believe I tried that as well.
>
> -Chuckk
>
>
> On 5/10/05, Richard Dobson <[hidden email]> wrote:
> > Just checking: the line as you have typed it appears to have a typo, with an
> > assignment where one would expect a conditional expression:
> >
> > kmid = (kmid = 224 ? 224:0)
> >
> > This just sets kmid to 224 (always), which is consistent with the symptom you
> > describe.
> >
> > Richard Dobson
> >
> >
> > Chuckk Hubbard wrote:
> > > This is getting to me.  I tried to use any midi event to trigger video
> > > with CsoundAV, and it works, but at initialization it inserts or
> > > somehow detects about a dozen noteon/off pairs, and plays the video
> > > immediately.  I added the line:
> > > kmid = (kmid = 224 ? 224:0)
> > > printk2 kmid  (which was there already)
> > >
> > > to restrict it to pitch bend, and it worked... once.  Now whenever I
> > > run it, it inserts a pitch bend message at init time!  What could be
> > > causing this?
> > >
> > > -Chuckk
> > >
> > >
> >
> > --
> > Send bugs reports to [hidden email]
> >               (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
> > To unsubscribe, send email to [hidden email]
> >
>
> --
> "Some people got attitude,
> Backed up with attitude."
> -G. Love
> --
> Send bugs reports to [hidden email]
>               (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
> To unsubscribe, send email to [hidden email]
>
--
Send bugs reports to [hidden email]
              (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] MIDI scheduling

Istvan Varga
Steven Yi wrote:

> I think Richard was suggesting:
>
> kmid = (kmid == 224 ? 224 : 0)
>
> (== versus = )

It does not make a difference if you use = or ==. It would in C, but
not in Csound.
--
Send bugs reports to [hidden email]
              (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] MIDI scheduling

Chuckk Hubbard
In reply to this post by Gabriel Maldonado
Here's my original CSD, adapted from the GL video example.  You can
see I tried putting in two qualifiers to make sure the message was a
noteon on note 61, using a 3rd variable, but the same result.
Following is the miditest I ran, that prints out a bunch of extra
messages before I start hitting anything.
-Chuckk



<CsoundSynthesizer>
<CsOptions>

-+Y -+K0

</CsOptions>
<CsInstruments>

        sr = 11050
        kr = 86.328125
        ksmps = 128
        nchnls = 2

        set_t_del 7
        GLfps 23, .5
        GLpanel "OpenGL panel", 528, 432
        GLpanel_end
       
        FLrun

#include "OpenGL.h"


giVidHand GLopenVideoFile "madgab.avi", .3


GLinsert_i $GL_INIT

        glMatrixMode $GL_PROJECTION
        glLoadIdentity
        gluPerspective 25,1,100
        glMatrixMode $GL_MODELVIEW
        glLoadIdentity
       
        glEnable $GL_CULL_FACE
        glEnable $GL_TEXTURE_2D
        glEnable $GL_COLOR_MATERIAL

        glEnable $GL_BLEND
        glBlendFunc $GL_SRC_ALPHA, $GL_ONE_MINUS_SRC_ALPHA

        glColor3 0,0,1
       
GLinsert_i $GL_NOT_VALID
        glClear $GL_COLOR_BUFFER_BIT + $GL_DEPTH_BUFFER_BIT

GLinsert_i 1
gtTex init 0


;///////////////////////////////////////////////////
        instr 1
;///////////////////////////////////////////////////

kmid init 0
        glBindTexture gtTex


        glTranslate .3,.45,-3



        glColor 1.5, 1.5, 1.5, 1.2
        GLtexSquare 1, 0,0, 1,0, 1,1, 0,1



GLinsert 1.1

kmid, kchan, kdata1, kdata2 midiin
;kdata = (kdata1 == 61 ? 1:0)
;kdata = (kmid == 144 ? 1:0)
printk2 kmid

        schedwhen kmid, 2, 0, 3600


        endin


;//////////////////////////////////////////////
        instr 2
;//////////////////////////////////////////////
        glMatrixMode $GL_MODELVIEW
        glLoadIdentity


;tframe = tframe + tplay
tframes init 150

tframe GLphasor 389, 0/389


;gtTex GLvideo2tex giVidHand, tframe
gtTex GLvideo2tex giVidHand, tframe * 389


GLinsert 1.05


        endin






</CsInstruments>
<CsScore>
f1 3600 513 10 1

i1 3 3600


</CsScore>
</CsoundSynthesizer>


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


<CsoundSynthesizer>
<CsOptions>
-+K0 -+Y
</CsOptions>
<CsInstruments>
instr 1

kmid, kchan, kdata1, kdata2 midiin
printk2 kmid


endin

</CsInstruments>
<CsScore>
f1 0 16 10 1

i1 0 3600

e
</CsScore>
</CsoundSynthesizer>







On 5/10/05, Gabriel Maldonado <[hidden email]> wrote:

> Please send the .csd, otherwise there is no way to understand it...
> --
> Gabriel Maldonado
> http://csounds.com/maldonado
> --
>
> Chuckk Hubbard wrote:
> > This is getting to me.  I tried to use any midi event to trigger video
> > with CsoundAV, and it works, but at initialization it inserts or
> > somehow detects about a dozen noteon/off pairs, and plays the video
> > immediately.  I added the line:
> > kmid = (kmid = 224 ? 224:0)
> > printk2 kmid  (which was there already)
> >
> > to restrict it to pitch bend, and it worked... once.  Now whenever I
> > run it, it inserts a pitch bend message at init time!  What could be
> > causing this?
> >
> > -Chuckk
> >
> >
>
> --
> Send bugs reports to [hidden email]
>              (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
> To unsubscribe, send email to [hidden email]
>


--
"Some people got attitude,
Backed up with attitude."
-G. Love
--
Send bugs reports to [hidden email]
              (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] MIDI scheduling

Gabriel Maldonado
I don't see any problem with your second .csd:
===============================
<CsoundSynthesizer>
<CsOptions>
-+K0 -+Y
</CsOptions>
<CsInstruments>

instr 1
kmid, kchan, kdata1, kdata2 midiin
printk2 kmid
endin

</CsInstruments>
<CsScore>
f1 0 16 10 1
i1 0 3600
e
===============================

Since it prints exactly the status of MIDI messages that are coming from
the MIDI input.

Instead, the first (the OpenGL csd) doesn't make sense to me. What do
you exepct from it? What do you intend to do with midi and video?

Gabriel


Chuckk Hubbard wrote:

> Here's my original CSD, adapted from the GL video example.  You can
> see I tried putting in two qualifiers to make sure the message was a
> noteon on note 61, using a 3rd variable, but the same result.
> Following is the miditest I ran, that prints out a bunch of extra
> messages before I start hitting anything.
> -Chuckk
>
>
>
> <CsoundSynthesizer>
> <CsOptions>
>
> -+Y -+K0
>
> </CsOptions>
> <CsInstruments>
>
> sr = 11050
> kr = 86.328125
> ksmps = 128
> nchnls = 2
>
> set_t_del 7
> GLfps 23, .5
> GLpanel "OpenGL panel", 528, 432
> GLpanel_end
>
> FLrun
>
> #include "OpenGL.h"
>
>
> giVidHand GLopenVideoFile "madgab.avi", .3
>
>
> GLinsert_i $GL_INIT
>
> glMatrixMode $GL_PROJECTION
> glLoadIdentity
> gluPerspective 25,1,100
> glMatrixMode $GL_MODELVIEW
> glLoadIdentity
>
> glEnable $GL_CULL_FACE
> glEnable $GL_TEXTURE_2D
> glEnable $GL_COLOR_MATERIAL
>
> glEnable $GL_BLEND
> glBlendFunc $GL_SRC_ALPHA, $GL_ONE_MINUS_SRC_ALPHA
>
> glColor3 0,0,1
>
> GLinsert_i $GL_NOT_VALID
> glClear $GL_COLOR_BUFFER_BIT + $GL_DEPTH_BUFFER_BIT
>
> GLinsert_i 1
> gtTex init 0
>
>
> ;///////////////////////////////////////////////////
> instr 1
> ;///////////////////////////////////////////////////
>
> kmid init 0
> glBindTexture gtTex
>
>
> glTranslate .3,.45,-3
>
>
>
> glColor 1.5, 1.5, 1.5, 1.2
> GLtexSquare 1, 0,0, 1,0, 1,1, 0,1
>
>
>
> GLinsert 1.1
>
> kmid, kchan, kdata1, kdata2 midiin
> ;kdata = (kdata1 == 61 ? 1:0)
> ;kdata = (kmid == 144 ? 1:0)
> printk2 kmid
>
> schedwhen kmid, 2, 0, 3600
>
>
> endin
>
>
> ;//////////////////////////////////////////////
> instr 2
> ;//////////////////////////////////////////////
> glMatrixMode $GL_MODELVIEW
> glLoadIdentity
>
>
> ;tframe = tframe + tplay
> tframes init 150
>
> tframe GLphasor 389, 0/389
>
>
> ;gtTex GLvideo2tex giVidHand, tframe
> gtTex GLvideo2tex giVidHand, tframe * 389
>
>
> GLinsert 1.05
>
>
> endin
>
>
>
>
>
>
> </CsInstruments>
> <CsScore>
> f1 3600 513 10 1
>
> i1 3 3600
>
>
> </CsScore>
> </CsoundSynthesizer>
>
>
> -------------------------------------------------------------------
>
>
> <CsoundSynthesizer>
> <CsOptions>
> -+K0 -+Y
> </CsOptions>
> <CsInstruments>
> instr 1
>
> kmid, kchan, kdata1, kdata2 midiin
> printk2 kmid
>
>
> endin
>
> </CsInstruments>
> <CsScore>
> f1 0 16 10 1
>
> i1 0 3600
>
> e
> </CsScore>
> </CsoundSynthesizer>
>
>
>
>
>
>
>
> On 5/10/05, Gabriel Maldonado <[hidden email]> wrote:
>
>>Please send the .csd, otherwise there is no way to understand it...
>>--
>>Gabriel Maldonado
>>http://csounds.com/maldonado
>>--
>>
>>Chuckk Hubbard wrote:
>>
>>>This is getting to me.  I tried to use any midi event to trigger video
>>>with CsoundAV, and it works, but at initialization it inserts or
>>>somehow detects about a dozen noteon/off pairs, and plays the video
>>>immediately.  I added the line:
>>>kmid = (kmid = 224 ? 224:0)
>>>printk2 kmid  (which was there already)
>>>
>>>to restrict it to pitch bend, and it worked... once.  Now whenever I
>>>run it, it inserts a pitch bend message at init time!  What could be
>>>causing this?
>>>
>>>-Chuckk
>>>
>>>
>>
>>--
>>Send bugs reports to [hidden email]
>>             (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
>>To unsubscribe, send email to [hidden email]
>>
>
>
>

--
Gabriel Maldonado
http://csounds.com/maldonado
--

--
Send bugs reports to [hidden email]
              (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] MIDI scheduling

Chuckk Hubbard
What we discussed before, to use one instance for video and one for
audio, to score film with Csound.  I'm actually hoping to use Blue for
audio.  Either way, to trigger video playback with a MIDI message.

Since I didn't know how to play video in openGL, I started with your
example and gradually eliminated elements; I am sure some of the
perspective commands I left in are unnecessary.
I'm glad there's nothing wrong with my miditest.csd; since it prints a
list of messages before I hit any keys, the problem must lie in my
system?  Or perhaps the program reads ghost messages in initializing
MIDI?

I don't understand how it's possible for it to pick up MIDI messages
when I have no other MIDI programs running and haven't struck a key.
It never does it the first time I run it, but every time after that;
if I restart CsoundAV, I get one good run before it starts reading
ghost messages again.  I also tried initializing each k-variable to 0
at the beginning, and it still prints noteon/off messages when I run
it.

This modified miditest.csd, for reading an arbitrary message from
another instance, crashes CsoundAV:

<CsoundSynthesizer>
<CsOptions>
-+K -+Y
</CsOptions>
<CsInstruments>
instr 1

;kmid, kchan, kdata1, kdata2 midiin
;printk2 kmid
;printk2 kchan
;printk2 kdata1
;printk2 kdata2
ksig midic7 29, 0, 127

printk2 ksig

endin

</CsInstruments>
<CsScore>
f1 0 16 10 1

i1 0 3600

e
</CsScore>
</CsoundSynthesizer>


Thanks for your help.
-Chuckk



On 5/11/05, Gabriel Maldonado <[hidden email]> wrote:

> I don't see any problem with your second .csd:
> ===============================
> <CsoundSynthesizer>
> <CsOptions>
> -+K0 -+Y
> </CsOptions>
> <CsInstruments>
>
> instr 1
> kmid, kchan, kdata1, kdata2     midiin
> printk2 kmid
> endin
>
> </CsInstruments>
> <CsScore>
> f1 0 16 10 1
> i1 0 3600
> e
> ===============================
>
> Since it prints exactly the status of MIDI messages that are coming from
> the MIDI input.
>
> Instead, the first (the OpenGL csd) doesn't make sense to me. What do
> you exepct from it? What do you intend to do with midi and video?
>
> Gabriel
>
>
> Chuckk Hubbard wrote:
> > Here's my original CSD, adapted from the GL video example.  You can
> > see I tried putting in two qualifiers to make sure the message was a
> > noteon on note 61, using a 3rd variable, but the same result.
> > Following is the miditest I ran, that prints out a bunch of extra
> > messages before I start hitting anything.
> > -Chuckk
> >
> >
> >
> > <CsoundSynthesizer>
> > <CsOptions>
> >
> > -+Y -+K0
> >
> > </CsOptions>
> > <CsInstruments>
> >
> >       sr = 11050
> >       kr = 86.328125
> >       ksmps = 128
> >       nchnls = 2
> >
> >       set_t_del       7
> >       GLfps   23, .5
> >       GLpanel "OpenGL panel", 528, 432
> >       GLpanel_end
> >
> >       FLrun
> >
> > #include "OpenGL.h"
> >
> >
> > giVidHand     GLopenVideoFile "madgab.avi", .3
> >
> >
> > GLinsert_i $GL_INIT
> >
> >       glMatrixMode    $GL_PROJECTION
> >       glLoadIdentity
> >       gluPerspective  25,1,100
> >       glMatrixMode    $GL_MODELVIEW
> >       glLoadIdentity
> >
> >       glEnable        $GL_CULL_FACE
> >       glEnable        $GL_TEXTURE_2D
> >       glEnable        $GL_COLOR_MATERIAL
> >
> >       glEnable        $GL_BLEND
> >       glBlendFunc     $GL_SRC_ALPHA, $GL_ONE_MINUS_SRC_ALPHA
> >
> >       glColor3        0,0,1
> >
> > GLinsert_i $GL_NOT_VALID
> >       glClear $GL_COLOR_BUFFER_BIT + $GL_DEPTH_BUFFER_BIT
> >
> > GLinsert_i 1
> > gtTex init    0
> >
> >
> > ;///////////////////////////////////////////////////
> >       instr   1
> > ;///////////////////////////////////////////////////
> >
> > kmid init 0
> >       glBindTexture   gtTex
> >
> >
> >       glTranslate     .3,.45,-3
> >
> >
> >
> >       glColor 1.5, 1.5, 1.5, 1.2
> >       GLtexSquare     1, 0,0, 1,0, 1,1, 0,1
> >
> >
> >
> > GLinsert      1.1
> >
> > kmid, kchan, kdata1, kdata2   midiin
> > ;kdata = (kdata1 == 61 ? 1:0)
> > ;kdata = (kmid == 144 ? 1:0)
> > printk2 kmid
> >
> >       schedwhen kmid, 2, 0, 3600
> >
> >
> >       endin
> >
> >
> > ;//////////////////////////////////////////////
> >       instr   2
> > ;//////////////////////////////////////////////
> >       glMatrixMode    $GL_MODELVIEW
> >       glLoadIdentity
> >
> >
> > ;tframe = tframe + tplay
> > tframes init 150
> >
> > tframe GLphasor 389, 0/389
> >
> >
> > ;gtTex        GLvideo2tex     giVidHand, tframe
> > gtTex GLvideo2tex     giVidHand, tframe * 389
> >
> >
> > GLinsert      1.05
> >
> >
> >       endin
> >
> >
> >
> >
> >
> >
> > </CsInstruments>
> > <CsScore>
> > f1 3600 513 10 1
> >
> > i1 3 3600
> >
> >
> > </CsScore>
> > </CsoundSynthesizer>
> >
> >
> > -------------------------------------------------------------------
> >
> >
> > <CsoundSynthesizer>
> > <CsOptions>
> > -+K0 -+Y
> > </CsOptions>
> > <CsInstruments>
> > instr 1
> >
> > kmid, kchan, kdata1, kdata2   midiin
> > printk2 kmid
> >
> >
> > endin
> >
> > </CsInstruments>
> > <CsScore>
> > f1 0 16 10 1
> >
> > i1 0 3600
> >
> > e
> > </CsScore>
> > </CsoundSynthesizer>
> >
> >
> >
> >
> >
> >
> >
> > On 5/10/05, Gabriel Maldonado <[hidden email]> wrote:
> >
> >>Please send the .csd, otherwise there is no way to understand it...
> >>--
> >>Gabriel Maldonado
> >>http://csounds.com/maldonado
> >>--
> >>
> >>Chuckk Hubbard wrote:
> >>
> >>>This is getting to me.  I tried to use any midi event to trigger video
> >>>with CsoundAV, and it works, but at initialization it inserts or
> >>>somehow detects about a dozen noteon/off pairs, and plays the video
> >>>immediately.  I added the line:
> >>>kmid = (kmid = 224 ? 224:0)
> >>>printk2 kmid  (which was there already)
> >>>
> >>>to restrict it to pitch bend, and it worked... once.  Now whenever I
> >>>run it, it inserts a pitch bend message at init time!  What could be
> >>>causing this?
> >>>
> >>>-Chuckk
> >>>
> >>>
> >>
> >>--
> >>Send bugs reports to [hidden email]
> >>             (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
> >>To unsubscribe, send email to [hidden email]
> >>
> >
> >
> >
>
> --
> Gabriel Maldonado
> http://csounds.com/maldonado
> --
>
> --
> Send bugs reports to [hidden email]
>              (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
> To unsubscribe, send email to [hidden email]
>


--
"Some people got attitude,
Backed up with attitude."
-G. Love
--
Send bugs reports to [hidden email]
              (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] MIDI scheduling

Gabriel Maldonado
Maybe you are using a version of CsoundAV older than that I'm using... I
suggest to update it to newer version. Here are the messages I get from
the CsoundAV console:

=====================================================
new alloc for instr 100:
   rtevent:   T  3.716 TT  3.716 M:      0.0
         number of samples out of range:        0
new alloc for instr 1:
  i100   144.00000
  i100     0.00000
   rtevent:   T  7.416 TT  7.416 M:      0.0
  i100   128.00000
  i100     0.00000
=====================================================

Notice that I slightly modified the .csd since you need a 'global' instr
100 running for the entire CsoundAV session and a 'bogus' instr 1 that
handles and pops the incoming note-on messages.

--
Gabriel Maldonado
http://csounds.com/maldonado
--






Chuckk Hubbard wrote:

> What we discussed before, to use one instance for video and one for
> audio, to score film with Csound.  I'm actually hoping to use Blue for
> audio.  Either way, to trigger video playback with a MIDI message.
>
> Since I didn't know how to play video in openGL, I started with your
> example and gradually eliminated elements; I am sure some of the
> perspective commands I left in are unnecessary.
> I'm glad there's nothing wrong with my miditest.csd; since it prints a
> list of messages before I hit any keys, the problem must lie in my
> system?  Or perhaps the program reads ghost messages in initializing
> MIDI?
>
> I don't understand how it's possible for it to pick up MIDI messages
> when I have no other MIDI programs running and haven't struck a key.
> It never does it the first time I run it, but every time after that;
> if I restart CsoundAV, I get one good run before it starts reading
> ghost messages again.  I also tried initializing each k-variable to 0
> at the beginning, and it still prints noteon/off messages when I run
> it.
>
> This modified miditest.csd, for reading an arbitrary message from
> another instance, crashes CsoundAV:
>
> <CsoundSynthesizer>
> <CsOptions>
> -+K -+Y
> </CsOptions>
> <CsInstruments>
> instr 1
>
> ;kmid, kchan, kdata1, kdata2 midiin
> ;printk2 kmid
> ;printk2 kchan
> ;printk2 kdata1
> ;printk2 kdata2
> ksig midic7 29, 0, 127
>
> printk2 ksig
>
> endin
>
> </CsInstruments>
> <CsScore>
> f1 0 16 10 1
>
> i1 0 3600
>
> e
> </CsScore>
> </CsoundSynthesizer>
>
>
> Thanks for your help.
> -Chuckk
>
>
>
> On 5/11/05, Gabriel Maldonado <[hidden email]> wrote:
>
>>I don't see any problem with your second .csd:
>>===============================
>><CsoundSynthesizer>
>><CsOptions>
>>-+K0 -+Y
>></CsOptions>
>><CsInstruments>
>>
>>instr 1
>>kmid, kchan, kdata1, kdata2     midiin
>>printk2 kmid
>>endin
>>
>></CsInstruments>
>><CsScore>
>>f1 0 16 10 1
>>i1 0 3600
>>e
>>===============================
>>
>>Since it prints exactly the status of MIDI messages that are coming from
>>the MIDI input.
>>
>>Instead, the first (the OpenGL csd) doesn't make sense to me. What do
>>you exepct from it? What do you intend to do with midi and video?
>>
>>Gabriel
>>
>>
>>Chuckk Hubbard wrote:
>>
>>>Here's my original CSD, adapted from the GL video example.  You can
>>>see I tried putting in two qualifiers to make sure the message was a
>>>noteon on note 61, using a 3rd variable, but the same result.
>>>Following is the miditest I ran, that prints out a bunch of extra
>>>messages before I start hitting anything.
>>>-Chuckk
>>>
>>>
>>>
>>><CsoundSynthesizer>
>>><CsOptions>
>>>
>>>-+Y -+K0
>>>
>>></CsOptions>
>>><CsInstruments>
>>>
>>>      sr = 11050
>>>      kr = 86.328125
>>>      ksmps = 128
>>>      nchnls = 2
>>>
>>>      set_t_del       7
>>>      GLfps   23, .5
>>>      GLpanel "OpenGL panel", 528, 432
>>>      GLpanel_end
>>>
>>>      FLrun
>>>
>>>#include "OpenGL.h"
>>>
>>>
>>>giVidHand     GLopenVideoFile "madgab.avi", .3
>>>
>>>
>>>GLinsert_i $GL_INIT
>>>
>>>      glMatrixMode    $GL_PROJECTION
>>>      glLoadIdentity
>>>      gluPerspective  25,1,100
>>>      glMatrixMode    $GL_MODELVIEW
>>>      glLoadIdentity
>>>
>>>      glEnable        $GL_CULL_FACE
>>>      glEnable        $GL_TEXTURE_2D
>>>      glEnable        $GL_COLOR_MATERIAL
>>>
>>>      glEnable        $GL_BLEND
>>>      glBlendFunc     $GL_SRC_ALPHA, $GL_ONE_MINUS_SRC_ALPHA
>>>
>>>      glColor3        0,0,1
>>>
>>>GLinsert_i $GL_NOT_VALID
>>>      glClear $GL_COLOR_BUFFER_BIT + $GL_DEPTH_BUFFER_BIT
>>>
>>>GLinsert_i 1
>>>gtTex init    0
>>>
>>>
>>>;///////////////////////////////////////////////////
>>>      instr   1
>>>;///////////////////////////////////////////////////
>>>
>>>kmid init 0
>>>      glBindTexture   gtTex
>>>
>>>
>>>      glTranslate     .3,.45,-3
>>>
>>>
>>>
>>>      glColor 1.5, 1.5, 1.5, 1.2
>>>      GLtexSquare     1, 0,0, 1,0, 1,1, 0,1
>>>
>>>
>>>
>>>GLinsert      1.1
>>>
>>>kmid, kchan, kdata1, kdata2   midiin
>>>;kdata = (kdata1 == 61 ? 1:0)
>>>;kdata = (kmid == 144 ? 1:0)
>>>printk2 kmid
>>>
>>>      schedwhen kmid, 2, 0, 3600
>>>
>>>
>>>      endin
>>>
>>>
>>>;//////////////////////////////////////////////
>>>      instr   2
>>>;//////////////////////////////////////////////
>>>      glMatrixMode    $GL_MODELVIEW
>>>      glLoadIdentity
>>>
>>>
>>>;tframe = tframe + tplay
>>>tframes init 150
>>>
>>>tframe GLphasor 389, 0/389
>>>
>>>
>>>;gtTex        GLvideo2tex     giVidHand, tframe
>>>gtTex GLvideo2tex     giVidHand, tframe * 389
>>>
>>>
>>>GLinsert      1.05
>>>
>>>
>>>      endin
>>>
>>>
>>>
>>>
>>>
>>>
>>></CsInstruments>
>>><CsScore>
>>>f1 3600 513 10 1
>>>
>>>i1 3 3600
>>>
>>>
>>></CsScore>
>>></CsoundSynthesizer>
>>>
>>>
>>>-------------------------------------------------------------------
>>>
>>>
>>><CsoundSynthesizer>
>>><CsOptions>
>>>-+K0 -+Y
>>></CsOptions>
>>><CsInstruments>
>>>instr 1
>>>
>>>kmid, kchan, kdata1, kdata2   midiin
>>>printk2 kmid
>>>
>>>
>>>endin
>>>
>>></CsInstruments>
>>><CsScore>
>>>f1 0 16 10 1
>>>
>>>i1 0 3600
>>>
>>>e
>>></CsScore>
>>></CsoundSynthesizer>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>On 5/10/05, Gabriel Maldonado <[hidden email]> wrote:
>>>
>>>
>>>>Please send the .csd, otherwise there is no way to understand it...
>>>>--
>>>>Gabriel Maldonado
>>>>http://csounds.com/maldonado
>>>>--
>>>>
>>>>Chuckk Hubbard wrote:
>>>>
>>>>
>>>>>This is getting to me.  I tried to use any midi event to trigger video
>>>>>with CsoundAV, and it works, but at initialization it inserts or
>>>>>somehow detects about a dozen noteon/off pairs, and plays the video
>>>>>immediately.  I added the line:
>>>>>kmid = (kmid = 224 ? 224:0)
>>>>>printk2 kmid  (which was there already)
>>>>>
>>>>>to restrict it to pitch bend, and it worked... once.  Now whenever I
>>>>>run it, it inserts a pitch bend message at init time!  What could be
>>>>>causing this?
>>>>>
>>>>>-Chuckk
>>>>>
>>>>>
>>>>
>>>>--
>>>>Send bugs reports to [hidden email]
>>>>            (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
>>>>To unsubscribe, send email to [hidden email]
>>>>
>>>
>>>
>>>
>>--
>>Gabriel Maldonado
>>http://csounds.com/maldonado
>>--
>>
>>--
>>Send bugs reports to [hidden email]
>>             (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
>>To unsubscribe, send email to [hidden email]
>>
>
>
>

<CsoundSynthesizer>
<CsOptions>
-+K0 -+Y
</CsOptions>
<CsInstruments>

instr 1
endin

instr 100

kmid, kchan, kdata1, kdata2 midiin
printk2 kmid


endin

</CsInstruments>
<CsScore>
f1 0 16 10 1

i100 0 3600

e
</CsScore>
</CsoundSynthesizer>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] MIDI scheduling

Gabriel Maldonado
...and here is the modification of your openGL example. Now it activates
a video each time you press a note on (for 5 seconds).

Gabriel

Gabriel Maldonado wrote:

> Maybe you are using a version of CsoundAV older than that I'm using... I
> suggest to update it to newer version. Here are the messages I get from
> the CsoundAV console:
>
> =====================================================
> new alloc for instr 100:
>   rtevent:       T  3.716 TT  3.716 M:      0.0
>      number of samples out of range:        0
> new alloc for instr 1:
>  i100   144.00000
>  i100     0.00000
>   rtevent:       T  7.416 TT  7.416 M:      0.0
>  i100   128.00000
>  i100     0.00000
> =====================================================
>
> Notice that I slightly modified the .csd since you need a 'global' instr
> 100 running for the entire CsoundAV session and a 'bogus' instr 1 that
> handles and pops the incoming note-on messages.
>
>
> ------------------------------------------------------------------------
>
> <CsoundSynthesizer>
> <CsOptions>
> -+K0 -+Y
> </CsOptions>
> <CsInstruments>
>
> instr 1
> endin
>
> instr 100
>
> kmid, kchan, kdata1, kdata2 midiin
> printk2 kmid
>
>
> endin
>
> </CsInstruments>
> <CsScore>
> f1 0 16 10 1
>
> i100 0 3600
>
> e
> </CsScore>
> </CsoundSynthesizer>
--
Gabriel Maldonado
http://csounds.com/maldonado
--

<CsoundSynthesizer>
<CsOptions>

-+K -+P

</CsOptions>
<CsInstruments>

        sr = 44100
        kr = 100
        ksmps = 441
        nchnls = 2

        set_t_del 7
        GLfps 23, .5
        GLpanel "OpenGL panel", 528, 432
        GLpanel_end
       
        FLrun

#include "OpenGL.h"


giVidHand GLopenVideoFile "madgab.avi", .3


GLinsert_i $GL_INIT

        glMatrixMode $GL_PROJECTION
        glLoadIdentity
        gluPerspective 25,1,100
        glMatrixMode $GL_MODELVIEW
        glLoadIdentity
       
        glEnable $GL_CULL_FACE
        glEnable $GL_TEXTURE_2D
        glEnable $GL_COLOR_MATERIAL

        glEnable $GL_BLEND
        glBlendFunc $GL_SRC_ALPHA, $GL_ONE_MINUS_SRC_ALPHA

        glColor3 0,0,1
       
GLinsert_i $GL_NOT_VALID
        glClear $GL_COLOR_BUFFER_BIT + $GL_DEPTH_BUFFER_BIT

GLinsert_i 1
gtTex init 0


        instr 1
        endin



;///////////////////////////////////////////////////
        instr 100
;///////////////////////////////////////////////////



kmid, kchan, kdata1, kdata2 midiin
;kdata = (kdata1 == 61 ? 1:0)
kmid = (kmid == 144) ? 1:0

printk2 kmid


;kmid metro 1/100
kmid init 0
        schedk kmid, 0, 2, 0, 5


        endin


;//////////////////////////////////////////////
        instr 2
;//////////////////////////////////////////////
a1 oscili 1000, 440, 1
        outs a1,a1

        glMatrixMode $GL_MODELVIEW
        glLoadIdentity

;tframes init 150
tframe GLphasor 600
gtTex GLvideo2tex giVidHand, tframe * 300
tscale init rnd(1)
       
        glBindTexture gtTex
        glTranslate .3,.45,-3
       
        glColor 1.5, 1.5, 1.5, 1.2
        GLtexSquare tscale, 0,0, 1,0, 1,1, 0,1

GLinsert 1.05
        endin






</CsInstruments>
<CsScore>
f0 3600
f1 0 1024 10 1

i100 0 3600


</CsScore>
</CsoundSynthesizer>
Loading...