[Csnd] MIDI Latency

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[Csnd] MIDI Latency

Samuel Smalley
Hi Csounders,

Finally got around to doing MIDI stuff in sound. Is there a reason why the latency is so high between producing a midi message and receiving it and hearing it in Csound? Is it possible to reduce this latency?

Also, wondering if it's possible to record the midi events into Csound (i.e. if I had a score already set up to play a melody from one instrument and I play along with the melody using a MIDI keyboard controlling another instrument and having that save)

Thanks,
Sam

Csound mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] MIDI Latency

Tarmo Johannes-3
Hi,

In my case on Linux using jack audio and alsa or jack misi module the latency is unnoticeable, it is not a Csound thing. What is your platform and realtime audio modules that you are using?
Check also that the buffer sizes -b and -B and ksmps in csd file are not too big.

Tarmo

11.03.2017 22:52 kirjutas kuupäeval "Sam Smalley" <[hidden email]>:
Hi Csounders,

Finally got around to doing MIDI stuff in sound. Is there a reason why the latency is so high between producing a midi message and receiving it and hearing it in Csound? Is it possible to reduce this latency?

Also, wondering if it's possible to record the midi events into Csound (i.e. if I had a score already set up to play a melody from one instrument and I play along with the melody using a MIDI keyboard controlling another instrument and having that save)

Thanks,
Sam

Csound mailing list
[hidden email]
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] MIDI Latency

akjmicro
In reply to this post by Samuel Smalley
What you are probably experiencing is audio latency, and you're noticing it b/c you are triggering the audio via MIDI.

The first thing to do is to experiment with optimizing buffer sizes for your hardware setup. The other piece would be to set a lower 'ksmps' in your header, so that there are more sample blocks being sent per second.

More here:


Aaron Krister Johnson
http://www.untwelve.org

On Sat, Mar 11, 2017 at 2:52 PM, Sam Smalley <[hidden email]> wrote:
Hi Csounders,

Finally got around to doing MIDI stuff in sound. Is there a reason why the latency is so high between producing a midi message and receiving it and hearing it in Csound? Is it possible to reduce this latency?

Also, wondering if it's possible to record the midi events into Csound (i.e. if I had a score already set up to play a melody from one instrument and I play along with the melody using a MIDI keyboard controlling another instrument and having that save)

Thanks,
Sam

Csound mailing list
[hidden email]
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] MIDI Latency

Samuel Smalley
Just looked again. It's definitely audio latency. Tried lowering ksmps but that did not change anything. What would be recommended buffer sizes?

On Sat, Mar 11, 2017 at 4:00 PM, Aaron Krister Johnson <[hidden email]> wrote:
What you are probably experiencing is audio latency, and you're noticing it b/c you are triggering the audio via MIDI.

The first thing to do is to experiment with optimizing buffer sizes for your hardware setup. The other piece would be to set a lower 'ksmps' in your header, so that there are more sample blocks being sent per second.

More here:


Aaron Krister Johnson
http://www.untwelve.org

On Sat, Mar 11, 2017 at 2:52 PM, Sam Smalley <[hidden email]> wrote:
Hi Csounders,

Finally got around to doing MIDI stuff in sound. Is there a reason why the latency is so high between producing a midi message and receiving it and hearing it in Csound? Is it possible to reduce this latency?

Also, wondering if it's possible to record the midi events into Csound (i.e. if I had a score already set up to play a melody from one instrument and I play along with the melody using a MIDI keyboard controlling another instrument and having that save)

Thanks,
Sam

Csound mailing list
[hidden email]
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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] MIDI Latency

zappfinger
In reply to this post by Samuel Smalley
Buffers sizes are important here. What system are you on? It differs per system.

I have attached a csd file I used for recording midi to a text file, while another track is playing, from a previous recorded file. 
It won't work as is, but it might give an impression how it can be done.

Richard

2017-03-11 21:52 GMT+01:00 Sam Smalley <[hidden email]>:
Hi Csounders,

Finally got around to doing MIDI stuff in sound. Is there a reason why the latency is so high between producing a midi message and receiving it and hearing it in Csound? Is it possible to reduce this latency?

Also, wondering if it's possible to record the midi events into Csound (i.e. if I had a score already set up to play a melody from one instrument and I play along with the melody using a MIDI keyboard controlling another instrument and having that save)

Thanks,
Sam

Csound mailing list
[hidden email]
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 [hidden email] 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

midiRecord2.csd (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] MIDI Latency

Victor Lazzarini
In reply to this post by Samuel Smalley
Not ksmps at first. Buffer sizes. Try to go as low as possible. It will depend on the audio backend. On OSX the rtauhal backend can go down to as low as -b 32 -B 128 and
with ksmps >= 32. Portaudio callback mode (pa_cb) maybe -b 64 -B 256. Jack is possibly low as well (depending on the jack settings). On Linux, the alsa backend
is probably the lowest latency.

========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 11 Mar 2017, at 21:05, Samuel Smalley <[hidden email]> wrote:
>
> Just looked again. It's definitely audio latency. Tried lowering ksmps but that did not change anything. What would be recommended buffer sizes?
>
> On Sat, Mar 11, 2017 at 4:00 PM, Aaron Krister Johnson <[hidden email]> wrote:
> What you are probably experiencing is audio latency, and you're noticing it b/c you are triggering the audio via MIDI.
>
> The first thing to do is to experiment with optimizing buffer sizes for your hardware setup. The other piece would be to set a lower 'ksmps' in your header, so that there are more sample blocks being sent per second.
>
> More here:
>
> http://www.csounds.com/manualOLPC/UsingOptimizing.html
>
> Aaron Krister Johnson
> http://www.untwelve.org
>
> On Sat, Mar 11, 2017 at 2:52 PM, Sam Smalley <[hidden email]> wrote:
> Hi Csounders,
>
> Finally got around to doing MIDI stuff in sound. Is there a reason why the latency is so high between producing a midi message and receiving it and hearing it in Csound? Is it possible to reduce this latency?
>
> Also, wondering if it's possible to record the midi events into Csound (i.e. if I had a score already set up to play a melody from one instrument and I play along with the melody using a MIDI keyboard controlling another instrument and having that save)
>
> Thanks,
> Sam
>
> Csound mailing list
> [hidden email]
> 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 [hidden email] 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 [hidden email] 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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] MIDI Latency

Samuel Smalley
In reply to this post by zappfinger
I'm on a MacBook Pro running OS X 10.10.5

On Sat, Mar 11, 2017 at 4:12 PM, Richard van Bemmelen <[hidden email]> wrote:
Buffers sizes are important here. What system are you on? It differs per system.

I have attached a csd file I used for recording midi to a text file, while another track is playing, from a previous recorded file. 
It won't work as is, but it might give an impression how it can be done.

Richard

2017-03-11 21:52 GMT+01:00 Sam Smalley <[hidden email]>:
Hi Csounders,

Finally got around to doing MIDI stuff in sound. Is there a reason why the latency is so high between producing a midi message and receiving it and hearing it in Csound? Is it possible to reduce this latency?

Also, wondering if it's possible to record the midi events into Csound (i.e. if I had a score already set up to play a melody from one instrument and I play along with the melody using a MIDI keyboard controlling another instrument and having that save)

Thanks,
Sam

Csound mailing list
[hidden email]
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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] MIDI Latency

Victor Lazzarini
In reply to this post by Victor Lazzarini
I meant ksmps <= 32!
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 11 Mar 2017, at 21:13, Victor Lazzarini <[hidden email]> wrote:
>
> Not ksmps at first. Buffer sizes. Try to go as low as possible. It will depend on the audio backend. On OSX the rtauhal backend can go down to as low as -b 32 -B 128 and
> with ksmps >= 32. Portaudio callback mode (pa_cb) maybe -b 64 -B 256. Jack is possibly low as well (depending on the jack settings). On Linux, the alsa backend
> is probably the lowest latency.
>
> ========================
> Prof. Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy,
> Maynooth University,
> Maynooth, Co Kildare, Ireland
> Tel: 00 353 7086936
> Fax: 00 353 1 7086952
>
>> On 11 Mar 2017, at 21:05, Samuel Smalley <[hidden email]> wrote:
>>
>> Just looked again. It's definitely audio latency. Tried lowering ksmps but that did not change anything. What would be recommended buffer sizes?
>>
>> On Sat, Mar 11, 2017 at 4:00 PM, Aaron Krister Johnson <[hidden email]> wrote:
>> What you are probably experiencing is audio latency, and you're noticing it b/c you are triggering the audio via MIDI.
>>
>> The first thing to do is to experiment with optimizing buffer sizes for your hardware setup. The other piece would be to set a lower 'ksmps' in your header, so that there are more sample blocks being sent per second.
>>
>> More here:
>>
>> http://www.csounds.com/manualOLPC/UsingOptimizing.html
>>
>> Aaron Krister Johnson
>> http://www.untwelve.org
>>
>> On Sat, Mar 11, 2017 at 2:52 PM, Sam Smalley <[hidden email]> wrote:
>> Hi Csounders,
>>
>> Finally got around to doing MIDI stuff in sound. Is there a reason why the latency is so high between producing a midi message and receiving it and hearing it in Csound? Is it possible to reduce this latency?
>>
>> Also, wondering if it's possible to record the midi events into Csound (i.e. if I had a score already set up to play a melody from one instrument and I play along with the melody using a MIDI keyboard controlling another instrument and having that save)
>>
>> Thanks,
>> Sam
>>
>> Csound mailing list
>> [hidden email]
>> 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 [hidden email] 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 [hidden email] 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
> [hidden email]
> 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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] MIDI Latency

zappfinger
In reply to this post by Samuel Smalley

On OS X I use : -B1024 -b256

Richard


On 11/03/17 22:14, Samuel Smalley wrote:
I'm on a MacBook Pro running OS X 10.10.5

On Sat, Mar 11, 2017 at 4:12 PM, Richard van Bemmelen <[hidden email]> wrote:
Buffers sizes are important here. What system are you on? It differs per system.

I have attached a csd file I used for recording midi to a text file, while another track is playing, from a previous recorded file. 
It won't work as is, but it might give an impression how it can be done.

Richard

2017-03-11 21:52 GMT+01:00 Sam Smalley <[hidden email]>:
Hi Csounders,

Finally got around to doing MIDI stuff in sound. Is there a reason why the latency is so high between producing a midi message and receiving it and hearing it in Csound? Is it possible to reduce this latency?

Also, wondering if it's possible to record the midi events into Csound (i.e. if I had a score already set up to play a melody from one instrument and I play along with the melody using a MIDI keyboard controlling another instrument and having that save)

Thanks,
Sam

Csound mailing list
[hidden email]
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 [hidden email] 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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] MIDI Latency

akjmicro
Richard, in my experience, that might be a setting that doesn't give xruns, but it may not be snappy/responsive enough for MIDI; that is, if you don't want your performance to sound like the time/swing is terrible. But, YMMV.

Aaron Krister Johnson
http://www.untwelve.org

On Mon, Mar 13, 2017 at 3:06 AM, Richard <[hidden email]> wrote:

On OS X I use : -B1024 -b256

Richard


On 11/03/17 22:14, Samuel Smalley wrote:
I'm on a MacBook Pro running OS X 10.10.5

On Sat, Mar 11, 2017 at 4:12 PM, Richard van Bemmelen <[hidden email]> wrote:
Buffers sizes are important here. What system are you on? It differs per system.

I have attached a csd file I used for recording midi to a text file, while another track is playing, from a previous recorded file. 
It won't work as is, but it might give an impression how it can be done.

Richard

2017-03-11 21:52 GMT+01:00 Sam Smalley <[hidden email]>:
Hi Csounders,

Finally got around to doing MIDI stuff in sound. Is there a reason why the latency is so high between producing a midi message and receiving it and hearing it in Csound? Is it possible to reduce this latency?

Also, wondering if it's possible to record the midi events into Csound (i.e. if I had a score already set up to play a melody from one instrument and I play along with the melody using a MIDI keyboard controlling another instrument and having that save)

Thanks,
Sam

Csound mailing list
[hidden email]
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 [hidden email] 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 [hidden email] 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 [hidden email] 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 [hidden email] 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