Csound Csound-dev Csound-tekno Search About

Re: Csound5 OSX MIDI performance

Date2006-02-10 21:12
FromVictor Lazzarini
SubjectRe: Csound5 OSX MIDI performance
What happens if you don't use MIDI input with the
everything else the same (but without the MIDI opcodes)?

Is this with the GUI app or with command-line Csound? I must
confess I have not really tested MIDI extensively on OSX
apart from checking it works. But others, I presume
have (David Akbari?).

I'll check.

Victor
>
>
> First let me say thanks to the all those who work so hard
> to put out   Csound5.
>
> I am trying to use Csound5 with real time MIDI input.  My
> problem is   that there are many glitches in the sound.
> Not a distortion from   samples out of range, rather, the
> sound seems to cut on and off (the   same type of cut out
> that occurs when I change from one window to   another).
> Csound5 reports that I am using PortMIDI.  Is that my only
>   choice on OSX.  If not, what flag would allow me to
> change to a   different realtime MIDI module (like
> CoreAudio).  I've tried -  +rtmidi=coremidi but that does
> not work.
>
> This instrument is simple oscil playing the current MIDI
> note (in   cps) at current volume (using current MIDI
> velocity).  This file is   perfect when run on MacCsound
> 1.2.a5.  The file is below.
>
> I am using the following flags with Csound5:
> -odac -iadc -+rtaudio=coreaudio --midi-device=1 -B128 -b64
>
> This same set of flags works perfectly (with no glitches)
> when   sending an audio signal through a Csound5, so I do
> not believe that I   have a problem with -B128 -b64.
>
> I am using:
> Csound5.00 for OS 10.4
> OS 10.4.4
>
> Thanks in advance,
> Mitch
>
>
>
>
> 
> 
> sr = 44100
> kr = 4410
> ksmps = 10
> nchnls = 2
>
> instr 1
>     ;----------Get a note from the MIDI instrument
>     icps    cpsmidi                ; the note's frequency
>     iamp1    ampmidi    127             ; the note's
> amplitude scaled to a value   between 0 and 127
>     iamp = (iamp1*iamp1)/16129        ; vel 0-127 is
> squared then divided by   16129 to give more realistic vel
> to amp relationship makes kenv range   from 0-1
>
>     ;----------E.G. (MIDI realtime)
>     irise = .1                    ; length of rise portion
> in seconds
>     idec    = .1                    ; length of decay
> portion on seconds
>         ;----test to see if in release time (this block is
> modified version   of that found under opcode "xtratim" in
> Csound Manual 4.23)
>         xtratim idec                    ;extra-time, i.e.
> release dur
>            krel init 0
>            krel release                     ;outputs
> release-stage flag (0 or 1 values)
>            if (krel > .5) kgoto rel             ;if in
> release-stage goto release   section
>         ;----attack decay portion
>         kenvatk linseg 0, irise, iamp, 50, iamp      ; ADD
> IN POINTS FOR   COMPLEX ATTACK PORTION
>         kenv = kenvatk
>         kgoto done
>         ;----release section
>             rel:
>            kenvrel linseg 1, .3*idec, .2, .7*idec, 0    ;
> ADD IN POINTS FOR   COMPLEX DECAY PORTION
>            kenv = kenvatk*kenvrel
>            done:
>
>     ;----------Main Oscilator
>     a1        oscil        5000, icps, 1
>
>     ;----------Output
>     ascl        =    a1*kenv                ; BE SURE TO
> ADD IN THE *kenv SO THAT THE E.G. IS   USED
>     aout    clip    ascl, 0, 32000                ; clip
> anything over 32000 to be sure   nothing is out of range
>     outs aout, aout
> endin
>
>
>
>
>
> 
> 
> f1 0 4096 10 1 ;0 .5 0 .3
>
> ;i#    str    dur
> i1     0         8888        ; make the duration long this
> is 8888 seconds 
>
> 
>
>
>
>

Date2006-02-11 03:47
FromDavid Akbari
SubjectRe: Csound5 OSX MIDI performance
Running the attached file out of the box "as is" results in no errors; 
I'm able to play 5-6 voice polyphony without breakups. On OS 10.3.9 
still, using the Csound commandline built from CVS this morning. (10 
Feb 2006)

Flags used were:
csound -odac:1 -idevaudio:1 -+noninterleaved=1 -+rtaudio=CoreAudio 
-b1024 -B1024 -M0 -d ${FILENAME}

* noninterleaved and explicit buffer-size are because of using digi 
mbox hardware.


-David

On Feb 10, 2006, at 4:12 PM, Victor Lazzarini wrote:

> What happens if you don't use MIDI input with the
> everything else the same (but without the MIDI opcodes)?
>
> Is this with the GUI app or with command-line Csound? I must
> confess I have not really tested MIDI extensively on OSX
> apart from checking it works. But others, I presume
> have (David Akbari?).
>
> I'll check.
>
> Victor


> 
>> 
>> sr = 44100
>> kr = 4410
>> ksmps = 10
>> nchnls = 2
>>
>> instr 1
>>     ;----------Get a note from the MIDI instrument
>>     icps    cpsmidi                ; the note's frequency
>>     iamp1    ampmidi    127             ; the note's
>> amplitude scaled to a value   between 0 and 127
>>     iamp = (iamp1*iamp1)/16129        ; vel 0-127 is
>> squared then divided by   16129 to give more realistic vel
>> to amp relationship makes kenv range   from 0-1
>>
>>     ;----------E.G. (MIDI realtime)
>>     irise = .1                    ; length of rise portion
>> in seconds
>>     idec    = .1                    ; length of decay
>> portion on seconds
>>         ;----test to see if in release time (this block is
>> modified version   of that found under opcode "xtratim" in
>> Csound Manual 4.23)
>>         xtratim idec                    ;extra-time, i.e.
>> release dur
>>            krel init 0
>>            krel release                     ;outputs
>> release-stage flag (0 or 1 values)
>>            if (krel > .5) kgoto rel             ;if in
>> release-stage goto release   section
>>         ;----attack decay portion
>>         kenvatk linseg 0, irise, iamp, 50, iamp      ; ADD
>> IN POINTS FOR   COMPLEX ATTACK PORTION
>>         kenv = kenvatk
>>         kgoto done
>>         ;----release section
>>             rel:
>>            kenvrel linseg 1, .3*idec, .2, .7*idec, 0    ;
>> ADD IN POINTS FOR   COMPLEX DECAY PORTION
>>            kenv = kenvatk*kenvrel
>>            done:
>>
>>     ;----------Main Oscilator
>>     a1        oscil        5000, icps, 1
>>
>>     ;----------Output
>>     ascl        =    a1*kenv                ; BE SURE TO
>> ADD IN THE *kenv SO THAT THE E.G. IS   USED
>>     aout    clip    ascl, 0, 32000                ; clip
>> anything over 32000 to be sure   nothing is out of range
>>     outs aout, aout
>> endin
>>
>>
>>
>>
>>
>> 
>> 
>> f1 0 4096 10 1 ;0 .5 0 .3
>>
>> ;i#    str    dur
>> i1     0         8888        ; make the duration long this
>> is 8888 seconds 
>>
>>