Csound Csound-dev Csound-tekno Search About

MIDI Latency

Date2017-03-11 20:52
FromSam Smalley
SubjectMIDI Latency
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
Csound@listserv.heanet.ie
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

Date2017-03-11 20:59
FromTarmo Johannes
SubjectRe: MIDI Latency
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" <ssmalley@berklee.edu>:
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
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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

Date2017-03-11 21:00
FromAaron Krister Johnson
SubjectRe: MIDI Latency
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 <ssmalley@berklee.edu> 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
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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

Date2017-03-11 21:05
FromSamuel Smalley
SubjectRe: MIDI Latency
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 <akjmicro@gmail.com> 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 <ssmalley@berklee.edu> 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
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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 Csound@listserv.heanet.ie 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

Date2017-03-11 21:12
FromRichard van Bemmelen
SubjectRe: MIDI Latency
AttachmentsmidiRecord2.csd  
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 <ssmalley@berklee.edu>:
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
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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

Date2017-03-11 21:13
FromVictor Lazzarini
SubjectRe: MIDI Latency
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  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  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  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
> Csound@listserv.heanet.ie
> 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 Csound@listserv.heanet.ie 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 Csound@listserv.heanet.ie 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
Csound@listserv.heanet.ie
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

Date2017-03-11 21:14
FromSamuel Smalley
SubjectRe: MIDI Latency
I'm on a MacBook Pro running OS X 10.10.5

On Sat, Mar 11, 2017 at 4:12 PM, Richard van Bemmelen <zappfinger@gmail.com> 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 <ssmalley@berklee.edu>:
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
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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 Csound@listserv.heanet.ie 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

Date2017-03-11 21:14
FromVictor Lazzarini
SubjectRe: MIDI Latency
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  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  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  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  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
>> Csound@listserv.heanet.ie
>> 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 Csound@listserv.heanet.ie 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 Csound@listserv.heanet.ie 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
> Csound@listserv.heanet.ie
> 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
Csound@listserv.heanet.ie
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

Date2017-03-13 08:06
FromRichard
SubjectRe: MIDI Latency

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 <zappfinger@gmail.com> 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 <ssmalley@berklee.edu>:
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
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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 Csound@listserv.heanet.ie 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


Date2017-03-13 14:36
FromAaron Krister Johnson
SubjectRe: MIDI Latency
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 <zappfinger@gmail.com> 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 <zappfinger@gmail.com> 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 <ssmalley@berklee.edu>:
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
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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 Csound@listserv.heanet.ie 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 Csound@listserv.heanet.ie 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 Csound@listserv.heanet.ie 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