Csound Csound-dev Csound-tekno Search About

OSClisten rate

Date2015-10-05 14:52
FromAndreas Bergsland
SubjectOSClisten rate
Attachmentsandreas_bergsland.vcf  None  None  
Hi,
I have been struggeling to get OSClisten to receive data on a higher 
rate than about 10-12 values per second.
I have tried both sending data from Max, from OSCulator and X-OSC. The 
latter is supposed to have a data rate of 200Hz.
Receiving OSC on Max seems to work pretty much as expected, so it seems 
to be related to csound.
Am I missing something, or does anyone have the same problems?
I am on OSX 10.9.5 csound 6.04

(Also, when sending data from another instance of csound it seems to 
drop out after a certain time, often about 10 seconds. )
Test scripts and print out sample below.
Best,
Andreas

Sending:

sr    =    44100
kr    =    44100

instr    1

isendrate     =     200
kval        rand    1
kchg        metro    200
OSCsend    kchg, "localhost", 1234, "/foo", "d", kval

printk    0.05, kval

endin


Receiving:

sr        =        44100
kr        =        44100

giHandle    OSCinit    1234

instr        1
k1    init    0
nxtmsg:
     kk  OSClisten giHandle, "/foo", "d", k1
kchg    changed    k1
if (kchg == 0) goto ex
     printk 0,k1
     kgoto nxtmsg
ex:
endin


giving a printout like this:
  i   1 time     2.43812:     0.50003
  i   1 time     2.53100:    -0.22607
  i   1 time     2.62388:    -0.13263
  i   1 time     2.71676:     0.70871
  i   1 time     2.80964:     0.02820
  i   1 time     2.90252:     0.20303
  i   1 time     2.99540:    -0.67276
  i   1 time     3.08828:    -0.80737
  i   1 time     3.18116:     0.52664
  i   1 time     3.27404:    -0.17532
  i   1 time     3.36692:    -0.79272
  i   1 time     3.45980:     0.41666
  i   1 time     3.55268:    -0.04303
  i   1 time     3.64556:     0.06311
  i   1 time     3.73844:     0.24808
  i   1 time     3.83132:    -0.96649
  i   1 time     3.92420:    -0.42090
  i   1 time     4.01707:     0.44241
  i   1 time     4.10995:    -0.04230
  i   1 time     4.20283:    -0.86975
  i   1 time     4.29571:    -0.75351
  i   1 time     4.38859:     0.10455
  i   1 time     4.48147:     0.31210
  i   1 time     4.57435:    -0.25803
etc...


-- 
Andreas Bergsland,
førsteamanuensis

Musikkteknologiseksjonen
Institutt for musikk
Olavskvartalet
NTNU
7491 Trondheim

Besøksadresse: Fjordgt.1 (3.etg.)
e-post: andreas.bergsland@ntnu.no
Web: http://folk.ntnu.no/andbe
Tlf: 7359 0096
Mob: 4566 3316


Date2015-10-05 16:59
FromVictor Lazzarini
SubjectRe: OSClisten rate
you need to check the OSCListen output (kk) otherwise you will drop messages. See the manual page

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 5 Oct 2015, at 14:52, Andreas Bergsland  wrote:
> 
> Hi,
> I have been struggeling to get OSClisten to receive data on a higher rate than about 10-12 values per second.
> I have tried both sending data from Max, from OSCulator and X-OSC. The latter is supposed to have a data rate of 200Hz.
> Receiving OSC on Max seems to work pretty much as expected, so it seems to be related to csound.
> Am I missing something, or does anyone have the same problems?
> I am on OSX 10.9.5 csound 6.04
> 
> (Also, when sending data from another instance of csound it seems to drop out after a certain time, often about 10 seconds. )
> Test scripts and print out sample below.
> Best,
> Andreas
> 
> Sending:
> 
> sr    =    44100
> kr    =    44100
> 
> instr    1
> 
> isendrate     =     200
> kval        rand    1
> kchg        metro    200
> OSCsend    kchg, "localhost", 1234, "/foo", "d", kval
> 
> printk    0.05, kval
> 
> endin
> 
> 
> Receiving:
> 
> sr        =        44100
> kr        =        44100
> 
> giHandle    OSCinit    1234
> 
> instr        1
> k1    init    0
> nxtmsg:
>    kk  OSClisten giHandle, "/foo", "d", k1
> kchg    changed    k1
> if (kchg == 0) goto ex
>    printk 0,k1
>    kgoto nxtmsg
> ex:
> endin
> 
> 
> giving a printout like this:
> i   1 time     2.43812:     0.50003
> i   1 time     2.53100:    -0.22607
> i   1 time     2.62388:    -0.13263
> i   1 time     2.71676:     0.70871
> i   1 time     2.80964:     0.02820
> i   1 time     2.90252:     0.20303
> i   1 time     2.99540:    -0.67276
> i   1 time     3.08828:    -0.80737
> i   1 time     3.18116:     0.52664
> i   1 time     3.27404:    -0.17532
> i   1 time     3.36692:    -0.79272
> i   1 time     3.45980:     0.41666
> i   1 time     3.55268:    -0.04303
> i   1 time     3.64556:     0.06311
> i   1 time     3.73844:     0.24808
> i   1 time     3.83132:    -0.96649
> i   1 time     3.92420:    -0.42090
> i   1 time     4.01707:     0.44241
> i   1 time     4.10995:    -0.04230
> i   1 time     4.20283:    -0.86975
> i   1 time     4.29571:    -0.75351
> i   1 time     4.38859:     0.10455
> i   1 time     4.48147:     0.31210
> i   1 time     4.57435:    -0.25803
> etc...
> 
> 
> -- 
> Andreas Bergsland,
> førsteamanuensis
> 
> Musikkteknologiseksjonen
> Institutt for musikk
> Olavskvartalet
> NTNU
> 7491 Trondheim
> 
> Besøksadresse: Fjordgt.1 (3.etg.)
> e-post: andreas.bergsland@ntnu.no
> Web: http://folk.ntnu.no/andbe
> Tlf: 7359 0096
> Mob: 4566 3316
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-users mailing list
> Csound-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-users
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2015-10-05 21:16
FromTarmo Johannes
SubjectRe: OSClisten rate
AttachmentsNone  None  

yes,

 

it might be that the if-statement in instr 1 make the problem, it is hard to believe that Csound could accept just 10-12 messages per second. As Victor suggested, perhaps something like:

 

instr 1

k1 init 0

 

kk OSClisten giHandle, "/foo", "d", k1

 

if (kk==1) then

printk2 k1

; and you your other stuff

endif

endin

 

Might be that just printing the messages is bottleneck, pehaps you could just count the incoming messages?

 

kcount init 0

if (kk==1) then

kcount +=1

endif

 

if (release()==1) then ; in the end of sintrument run print out the result

printk2 kcount

endif

 

 

Hope it helps. Please let us know, how far can you get? I would expect that thousands of OSC messages get through in one second...

 

BEst!

tarmo

 

On Monday 05 October 2015 16:59:56 Victor Lazzarini wrote:

> you need to check the OSCListen output (kk) otherwise you will drop

> messages. See the manual page

>

> Victor Lazzarini

> Dean of Arts, Celtic Studies, and Philosophy

> Maynooth University

> Ireland

>

> > On 5 Oct 2015, at 14:52, Andreas Bergsland <andreas.bergsland@ntnu.no>

> > wrote:

> >

> > Hi,

> > I have been struggeling to get OSClisten to receive data on a higher rate

> > than about 10-12 values per second. I have tried both sending data from

> > Max, from OSCulator and X-OSC. The latter is supposed to have a data rate

> > of 200Hz. Receiving OSC on Max seems to work pretty much as expected, so

> > it seems to be related to csound. Am I missing something, or does anyone

> > have the same problems?

> > I am on OSX 10.9.5 csound 6.04

> >

> > (Also, when sending data from another instance of csound it seems to drop

> > out after a certain time, often about 10 seconds. ) Test scripts and

> > print out sample below.

> > Best,

> > Andreas

> >

> > Sending:

> > <CsInstruments>

> > sr = 44100

> > kr = 44100

> >

> > instr 1

> >

> > isendrate = 200

> > kval rand 1

> > kchg metro 200

> > OSCsend kchg, "localhost", 1234, "/foo", "d", kval

> >

> > printk 0.05, kval

> >

> > endin

> > </CsInstruments>

> >

> > Receiving:

> > <CsInstruments>

> > sr = 44100

> > kr = 44100

> >

> > giHandle OSCinit 1234

> >

> > instr 1

> > k1 init 0

> >

> > nxtmsg:

> > kk OSClisten giHandle, "/foo", "d", k1

> >

> > kchg changed k1

> > if (kchg == 0) goto ex

> >

> > printk 0,k1

> > kgoto nxtmsg

> >

> > ex:

> > endin

> > </CsInstruments>

> >

> > giving a printout like this:

> > i 1 time 2.43812: 0.50003

> > i 1 time 2.53100: -0.22607

> > i 1 time 2.62388: -0.13263

> > i 1 time 2.71676: 0.70871

> > i 1 time 2.80964: 0.02820

> > i 1 time 2.90252: 0.20303

> > i 1 time 2.99540: -0.67276

> > i 1 time 3.08828: -0.80737

> > i 1 time 3.18116: 0.52664

> > i 1 time 3.27404: -0.17532

> > i 1 time 3.36692: -0.79272

> > i 1 time 3.45980: 0.41666

> > i 1 time 3.55268: -0.04303

> > i 1 time 3.64556: 0.06311

> > i 1 time 3.73844: 0.24808

> > i 1 time 3.83132: -0.96649

> > i 1 time 3.92420: -0.42090

> > i 1 time 4.01707: 0.44241

> > i 1 time 4.10995: -0.04230

> > i 1 time 4.20283: -0.86975

> > i 1 time 4.29571: -0.75351

> > i 1 time 4.38859: 0.10455

> > i 1 time 4.48147: 0.31210

> > i 1 time 4.57435: -0.25803

> > etc...

>

> ----------------------------------------------------------------------------

> -- _______________________________________________

> Csound-users mailing list

> Csound-users@lists.sourceforge.net

> https://lists.sourceforge.net/lists/listinfo/csound-users

> Send bugs reports to

> https://github.com/csound/csound/issues

> Discussions of bugs and features can be posted here

 


Date2015-10-05 21:23
FromOeyvind Brandtsegg
SubjectRe: OSClisten rate
AttachmentsNone  None  

It might be that the input buffer overflows somehow, due to the lower rate of reading than writing?

5. okt. 2015 22.17 skrev "Tarmo Johannes" <tarmo.johannes@otsakool.edu.ee>:

yes,

 

it might be that the if-statement in instr 1 make the problem, it is hard to believe that Csound could accept just 10-12 messages per second. As Victor suggested, perhaps something like:

 

instr 1

k1 init 0

 

kk OSClisten giHandle, "/foo", "d", k1

 

if (kk==1) then

printk2 k1

; and you your other stuff

endif

endin

 

Might be that just printing the messages is bottleneck, pehaps you could just count the incoming messages?

 

kcount init 0

if (kk==1) then

kcount +=1

endif

 

if (release()==1) then ; in the end of sintrument run print out the result

printk2 kcount

endif

 

 

Hope it helps. Please let us know, how far can you get? I would expect that thousands of OSC messages get through in one second...

 

BEst!

tarmo

 

On Monday 05 October 2015 16:59:56 Victor Lazzarini wrote:

> you need to check the OSCListen output (kk) otherwise you will drop

> messages. See the manual page

>

> Victor Lazzarini

> Dean of Arts, Celtic Studies, and Philosophy

> Maynooth University

> Ireland

>

> > On 5 Oct 2015, at 14:52, Andreas Bergsland <andreas.bergsland@ntnu.no>

> > wrote:

> >

> > Hi,

> > I have been struggeling to get OSClisten to receive data on a higher rate

> > than about 10-12 values per second. I have tried both sending data from

> > Max, from OSCulator and X-OSC. The latter is supposed to have a data rate

> > of 200Hz. Receiving OSC on Max seems to work pretty much as expected, so

> > it seems to be related to csound. Am I missing something, or does anyone

> > have the same problems?

> > I am on OSX 10.9.5 csound 6.04

> >

> > (Also, when sending data from another instance of csound it seems to drop

> > out after a certain time, often about 10 seconds. ) Test scripts and

> > print out sample below.

> > Best,

> > Andreas

> >

> > Sending:

> > <CsInstruments>

> > sr = 44100

> > kr = 44100

> >

> > instr 1

> >

> > isendrate = 200

> > kval rand 1

> > kchg metro 200

> > OSCsend kchg, "localhost", 1234, "/foo", "d", kval

> >

> > printk 0.05, kval

> >

> > endin

> > </CsInstruments>

> >

> > Receiving:

> > <CsInstruments>

> > sr = 44100

> > kr = 44100

> >

> > giHandle OSCinit 1234

> >

> > instr 1

> > k1 init 0

> >

> > nxtmsg:

> > kk OSClisten giHandle, "/foo", "d", k1

> >

> > kchg changed k1

> > if (kchg == 0) goto ex

> >

> > printk 0,k1

> > kgoto nxtmsg

> >

> > ex:

> > endin

> > </CsInstruments>

> >

> > giving a printout like this:

> > i 1 time 2.43812: 0.50003

> > i 1 time 2.53100: -0.22607

> > i 1 time 2.62388: -0.13263

> > i 1 time 2.71676: 0.70871

> > i 1 time 2.80964: 0.02820

> > i 1 time 2.90252: 0.20303

> > i 1 time 2.99540: -0.67276

> > i 1 time 3.08828: -0.80737

> > i 1 time 3.18116: 0.52664

> > i 1 time 3.27404: -0.17532

> > i 1 time 3.36692: -0.79272

> > i 1 time 3.45980: 0.41666

> > i 1 time 3.55268: -0.04303

> > i 1 time 3.64556: 0.06311

> > i 1 time 3.73844: 0.24808

> > i 1 time 3.83132: -0.96649

> > i 1 time 3.92420: -0.42090

> > i 1 time 4.01707: 0.44241

> > i 1 time 4.10995: -0.04230

> > i 1 time 4.20283: -0.86975

> > i 1 time 4.29571: -0.75351

> > i 1 time 4.38859: 0.10455

> > i 1 time 4.48147: 0.31210

> > i 1 time 4.57435: -0.25803

> > etc...

>

> ----------------------------------------------------------------------------

> -- _______________________________________________

> Csound-users mailing list

> Csound-users@lists.sourceforge.net

> https://lists.sourceforge.net/lists/listinfo/csound-users

> Send bugs reports to

> https://github.com/csound/csound/issues

> Discussions of bugs and features can be posted here

 


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

_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here


Date2015-10-05 22:11
FromVictor Lazzarini
SubjectRe: OSClisten rate
AttachmentsNone  None  
I would put in a loop checking that kk is 0, as  you might get more than one message delivered at a time. Again, this is shown in the manual example.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 5 Oct 2015, at 21:23, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote:

It might be that the input buffer overflows somehow, due to the lower rate of reading than writing?

5. okt. 2015 22.17 skrev "Tarmo Johannes" <tarmo.johannes@otsakool.edu.ee>:

yes,

 

it might be that the if-statement in instr 1 make the problem, it is hard to believe that Csound could accept just 10-12 messages per second. As Victor suggested, perhaps something like:

 

instr 1

k1 init 0

 

kk OSClisten giHandle, "/foo", "d", k1

 

if (kk==1) then

printk2 k1

; and you your other stuff

endif

endin

 

Might be that just printing the messages is bottleneck, pehaps you could just count the incoming messages?

 

kcount init 0

if (kk==1) then

kcount +=1

endif

 

if (release()==1) then ; in the end of sintrument run print out the result

printk2 kcount

endif

 

 

Hope it helps. Please let us know, how far can you get? I would expect that thousands of OSC messages get through in one second...

 

BEst!

tarmo

 

On Monday 05 October 2015 16:59:56 Victor Lazzarini wrote:

> you need to check the OSCListen output (kk) otherwise you will drop

> messages. See the manual page

>

> Victor Lazzarini

> Dean of Arts, Celtic Studies, and Philosophy

> Maynooth University

> Ireland

>

> > On 5 Oct 2015, at 14:52, Andreas Bergsland <andreas.bergsland@ntnu.no>

> > wrote:

> >

> > Hi,

> > I have been struggeling to get OSClisten to receive data on a higher rate

> > than about 10-12 values per second. I have tried both sending data from

> > Max, from OSCulator and X-OSC. The latter is supposed to have a data rate

> > of 200Hz. Receiving OSC on Max seems to work pretty much as expected, so

> > it seems to be related to csound. Am I missing something, or does anyone

> > have the same problems?

> > I am on OSX 10.9.5 csound 6.04

> >

> > (Also, when sending data from another instance of csound it seems to drop

> > out after a certain time, often about 10 seconds. ) Test scripts and

> > print out sample below.

> > Best,

> > Andreas

> >

> > Sending:

> > <CsInstruments>

> > sr = 44100

> > kr = 44100

> >

> > instr 1

> >

> > isendrate = 200

> > kval rand 1

> > kchg metro 200

> > OSCsend kchg, "localhost", 1234, "/foo", "d", kval

> >

> > printk 0.05, kval

> >

> > endin

> > </CsInstruments>

> >

> > Receiving:

> > <CsInstruments>

> > sr = 44100

> > kr = 44100

> >

> > giHandle OSCinit 1234

> >

> > instr 1

> > k1 init 0

> >

> > nxtmsg:

> > kk OSClisten giHandle, "/foo", "d", k1

> >

> > kchg changed k1

> > if (kchg == 0) goto ex

> >

> > printk 0,k1

> > kgoto nxtmsg

> >

> > ex:

> > endin

> > </CsInstruments>

> >

> > giving a printout like this:

> > i 1 time 2.43812: 0.50003

> > i 1 time 2.53100: -0.22607

> > i 1 time 2.62388: -0.13263

> > i 1 time 2.71676: 0.70871

> > i 1 time 2.80964: 0.02820

> > i 1 time 2.90252: 0.20303

> > i 1 time 2.99540: -0.67276

> > i 1 time 3.08828: -0.80737

> > i 1 time 3.18116: 0.52664

> > i 1 time 3.27404: -0.17532

> > i 1 time 3.36692: -0.79272

> > i 1 time 3.45980: 0.41666

> > i 1 time 3.55268: -0.04303

> > i 1 time 3.64556: 0.06311

> > i 1 time 3.73844: 0.24808

> > i 1 time 3.83132: -0.96649

> > i 1 time 3.92420: -0.42090

> > i 1 time 4.01707: 0.44241

> > i 1 time 4.10995: -0.04230

> > i 1 time 4.20283: -0.86975

> > i 1 time 4.29571: -0.75351

> > i 1 time 4.38859: 0.10455

> > i 1 time 4.48147: 0.31210

> > i 1 time 4.57435: -0.25803

> > etc...

>

> ----------------------------------------------------------------------------

> -- _______________________________________________

> Csound-users mailing list

> Csound-users@lists.sourceforge.net

> https://lists.sourceforge.net/lists/listinfo/csound-users

> Send bugs reports to

> https://github.com/csound/csound/issues

> Discussions of bugs and features can be posted here

 


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

_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

------------------------------------------------------------------------------
_______________________________________________
Csound-users mailing list
Csound-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-users
Send bugs reports to
       https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here