Csound Csound-dev Csound-tekno Search About

[Csnd-dev] possible issue with ALSA midi?

Date2024-11-11 19:48
FromDave Seidel
Subject[Csnd-dev] possible issue with ALSA midi?
I recently acquired a Pi 5, which I've equipped with a Pisound board (like my older Pis). I can build Cs7 without any issues, but I notice that when I query MIDI devices using ALSA as the interface, I get an error:

dave@phonon:~/src/csound/build $ csound -+rtmidi=alsa --midi-devices
rtalsa: Wrong callback.0 MIDI input devices
rtalsa: Wrong callback.rtalsa: Wrong callback.0 MIDI output devices
rtalsa: Wrong callback.            overall amps:      0.0
           overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.001s, CPU: 0.001s

If I specify portmidi, no errors:

dave@phonon:~/src/csound/build $ csound -+rtmidi=portmidi --midi-devices
rtmidi: PortMIDI module enabled
3 MIDI input devices
 0: 0 (Midi Through Port-0)
 1: 1 (pisound MIDI PS-28625BA)
 2: 2 (pisound-ctl)
3 MIDI output devices
 0: 0 (Midi Through Port-0)
 1: 1 (pisound MIDI PS-28625BA)
 2: 2 (pisound-ctl)
                   overall amps:      0.0
           overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.003s, CPU: 0.003s

Same results on my Pi 4 running Cs7. I don't have a Pi running Cs6 for comparison. The Pi 4 is running bullseye; the Pi 5 is running bookworm.

FWIW, I don't really care which interface I use, and I'm fine with using portmidi, but I thought this might indicate an issue.

- Dave

Date2024-11-11 19:52
Fromvlz
SubjectRe: [Csnd-dev] possible issue with ALSA midi?
It could well be. Can you run -odac to it, does it make any sound?


Prof. Victor Lazzarini
Maynooth University
Ireland

On 11 Nov 2024, at 19:48, Dave Seidel <dave.seidel@gmail.com> wrote:


I recently acquired a Pi 5, which I've equipped with a Pisound board (like my older Pis). I can build Cs7 without any issues, but I notice that when I query MIDI devices using ALSA as the interface, I get an error:

dave@phonon:~/src/csound/build $ csound -+rtmidi=alsa --midi-devices
rtalsa: Wrong callback.0 MIDI input devices
rtalsa: Wrong callback.rtalsa: Wrong callback.0 MIDI output devices
rtalsa: Wrong callback.            overall amps:      0.0
           overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.001s, CPU: 0.001s

If I specify portmidi, no errors:

dave@phonon:~/src/csound/build $ csound -+rtmidi=portmidi --midi-devices
rtmidi: PortMIDI module enabled
3 MIDI input devices
 0: 0 (Midi Through Port-0)
 1: 1 (pisound MIDI PS-28625BA)
 2: 2 (pisound-ctl)
3 MIDI output devices
 0: 0 (Midi Through Port-0)
 1: 1 (pisound MIDI PS-28625BA)
 2: 2 (pisound-ctl)
                   overall amps:      0.0
           overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.003s, CPU: 0.003s

Same results on my Pi 4 running Cs7. I don't have a Pi running Cs6 for comparison. The Pi 4 is running bullseye; the Pi 5 is running bookworm.

FWIW, I don't really care which interface I use, and I'm fine with using portmidi, but I thought this might indicate an issue.

- Dave

Date2024-11-11 20:04
FromDave Seidel
SubjectRe: [Csnd-dev] possible issue with ALSA midi?
Yes, -odac is working fine. I went back and checked, and I've been specifying "-+rtmidi=portmidi" for several years now on my Pis, going back to Cs6. So maybe this is an old/existing issue, which might make it low priority. 

On Mon, Nov 11, 2024 at 2:52 PM vlz <viclazzarini@gmail.com> wrote:
It could well be. Can you run -odac to it, does it make any sound?


Prof. Victor Lazzarini
Maynooth University
Ireland

On 11 Nov 2024, at 19:48, Dave Seidel <dave.seidel@gmail.com> wrote:


I recently acquired a Pi 5, which I've equipped with a Pisound board (like my older Pis). I can build Cs7 without any issues, but I notice that when I query MIDI devices using ALSA as the interface, I get an error:

dave@phonon:~/src/csound/build $ csound -+rtmidi=alsa --midi-devices
rtalsa: Wrong callback.0 MIDI input devices
rtalsa: Wrong callback.rtalsa: Wrong callback.0 MIDI output devices
rtalsa: Wrong callback.            overall amps:      0.0
           overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.001s, CPU: 0.001s

If I specify portmidi, no errors:

dave@phonon:~/src/csound/build $ csound -+rtmidi=portmidi --midi-devices
rtmidi: PortMIDI module enabled
3 MIDI input devices
 0: 0 (Midi Through Port-0)
 1: 1 (pisound MIDI PS-28625BA)
 2: 2 (pisound-ctl)
3 MIDI output devices
 0: 0 (Midi Through Port-0)
 1: 1 (pisound MIDI PS-28625BA)
 2: 2 (pisound-ctl)
                   overall amps:      0.0
           overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.003s, CPU: 0.003s

Same results on my Pi 4 running Cs7. I don't have a Pi running Cs6 for comparison. The Pi 4 is running bullseye; the Pi 5 is running bookworm.

FWIW, I don't really care which interface I use, and I'm fine with using portmidi, but I thought this might indicate an issue.

- Dave

Date2024-11-11 20:12
Fromvlz
SubjectRe: [Csnd-dev] possible issue with ALSA midi?
I checked and this error message comes from the MIDI side of things in the alsa module

static int32_t listDevicesM(CSOUND *csound, CS_MIDIDEVICE *list, int32_t isOutput){
    int32_t count = 0;
    char *s;
    s = (char*) csound->QueryGlobalVariable(csound, "_RTMIDI");
    if (strncmp(s, "alsaraw", 8) == 0) { /* ALSA Raw MIDI */
      count = listRawMidi(csound, list, isOutput);
    } else if (strncmp(s, "alsaseq", 8) == 0) {/* ALSA Sequencer */
      count = listAlsaSeq(csound, list, isOutput);
    } else if (strncmp(s, "devfile", 8) == 0) {

    } else {
      csound->ErrorMsg(csound, Str("rtalsa: Wrong callback."));
    }
    return count;
}

So maybe you can try one of the options: alsaraw, alsaseq or devfile (from the code, it’s raw midi, alsa sequencer midi or
midi file). These are the three options for listing but I guess “alsaraw” should have also been the same as “alsa” but
currently is not there.



> On 11 Nov 2024, at 20:04, Dave Seidel  wrote:
> 
> Yes, -odac is working fine. I went back and checked, and I've been specifying "-+rtmidi=portmidi" for several years now on my Pis, going back to Cs6. So maybe this is an old/existing issue, which might make it low priority. 
> 
> On Mon, Nov 11, 2024 at 2:52 PM vlz  wrote:
> It could well be. Can you run -odac to it, does it make any sound?
> 
> 
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
> 
>> On 11 Nov 2024, at 19:48, Dave Seidel  wrote:
>> 
>> I recently acquired a Pi 5, which I've equipped with a Pisound board (like my older Pis). I can build Cs7 without any issues, but I notice that when I query MIDI devices using ALSA as the interface, I get an error:
>> 
>> dave@phonon:~/src/csound/build $ csound -+rtmidi=alsa --midi-devices
>> rtalsa: Wrong callback.0 MIDI input devices
>> rtalsa: Wrong callback.rtalsa: Wrong callback.0 MIDI output devices
>> rtalsa: Wrong callback.            overall amps:      0.0
>>            overall samples out of range:        0
>> 0 errors in performance
>> Elapsed time at end of performance: real: 0.001s, CPU: 0.001s
>> 
>> If I specify portmidi, no errors:
>> 
>> dave@phonon:~/src/csound/build $ csound -+rtmidi=portmidi --midi-devices
>> rtmidi: PortMIDI module enabled
>> 3 MIDI input devices
>>  0: 0 (Midi Through Port-0)
>>  1: 1 (pisound MIDI PS-28625BA)
>>  2: 2 (pisound-ctl)
>> 3 MIDI output devices
>>  0: 0 (Midi Through Port-0)
>>  1: 1 (pisound MIDI PS-28625BA)
>>  2: 2 (pisound-ctl)
>>                    overall amps:      0.0
>>            overall samples out of range:        0
>> 0 errors in performance
>> Elapsed time at end of performance: real: 0.003s, CPU: 0.003s
>> 
>> Same results on my Pi 4 running Cs7. I don't have a Pi running Cs6 for comparison. The Pi 4 is running bullseye; the Pi 5 is running bookworm.
>> 
>> FWIW, I don't really care which interface I use, and I'm fine with using portmidi, but I thought this might indicate an issue.
>> 
>> - Dave

Date2024-11-11 20:34
FromDave Seidel
SubjectRe: [Csnd-dev] possible issue with ALSA midi?
aha, interesting! Yes, that works. We should probably document this.

dave@phonon:~ $ csound -+rtmidi=alsaseq --midi-devices
5 MIDI input devices
 0: hw:0,0 (Timer)
 1: hw:0,1 (Announce)
 2: hw:14,0 (Midi Through Port-0)
 3: hw:24,0 (pisound MIDI PS-28625BA)
 4: hw:128,0 (pisound-ctl)
3 MIDI output devices
 0: hw:14,0 (Midi Through Port-0)
 1: hw:24,0 (pisound MIDI PS-28625BA)
 2: hw:128,0 (pisound-ctl)
                   overall amps:      0.0
           overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.003s, CPU: 0.003s

dave@phonon:~ $ csound -+rtmidi=alsaraw --midi-devices
1 MIDI input devices
 0: hw:2,0 (pisound MIDI PS-28625BA)
1 MIDI output devices
 0: hw:2,0 (pisound MIDI PS-28625BA)
                   overall amps:      0.0
           overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.004s, CPU: 0.004s

dave@phonon:~ $ csound -+rtmidi=devfile --midi-devices
0 MIDI input devices
0 MIDI output devices
                   overall amps:      0.0
           overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.001s, CPU: 0.001s

On Mon, Nov 11, 2024 at 3:12 PM vlz <viclazzarini@gmail.com> wrote:
I checked and this error message comes from the MIDI side of things in the alsa module

static int32_t listDevicesM(CSOUND *csound, CS_MIDIDEVICE *list, int32_t isOutput){
    int32_t count = 0;
    char *s;
    s = (char*) csound->QueryGlobalVariable(csound, "_RTMIDI");
    if (strncmp(s, "alsaraw", 8) == 0) { /* ALSA Raw MIDI */
      count = listRawMidi(csound, list, isOutput);
    } else if (strncmp(s, "alsaseq", 8) == 0) {/* ALSA Sequencer */
      count = listAlsaSeq(csound, list, isOutput);
    } else if (strncmp(s, "devfile", 8) == 0) {

    } else {
      csound->ErrorMsg(csound, Str("rtalsa: Wrong callback."));
    }
    return count;
}

So maybe you can try one of the options: alsaraw, alsaseq or devfile (from the code, it’s raw midi, alsa sequencer midi or
midi file). These are the three options for listing but I guess “alsaraw” should have also been the same as “alsa” but
currently is not there.



> On 11 Nov 2024, at 20:04, Dave Seidel <dave.seidel@GMAIL.COM> wrote:
>
> Yes, -odac is working fine. I went back and checked, and I've been specifying "-+rtmidi=portmidi" for several years now on my Pis, going back to Cs6. So maybe this is an old/existing issue, which might make it low priority.
>
> On Mon, Nov 11, 2024 at 2:52 PM vlz <viclazzarini@gmail.com> wrote:
> It could well be. Can you run -odac to it, does it make any sound?
>
>
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
>
>> On 11 Nov 2024, at 19:48, Dave Seidel <dave.seidel@gmail.com> wrote:
>>
>> I recently acquired a Pi 5, which I've equipped with a Pisound board (like my older Pis). I can build Cs7 without any issues, but I notice that when I query MIDI devices using ALSA as the interface, I get an error:
>>
>> dave@phonon:~/src/csound/build $ csound -+rtmidi=alsa --midi-devices
>> rtalsa: Wrong callback.0 MIDI input devices
>> rtalsa: Wrong callback.rtalsa: Wrong callback.0 MIDI output devices
>> rtalsa: Wrong callback.            overall amps:      0.0
>>            overall samples out of range:        0
>> 0 errors in performance
>> Elapsed time at end of performance: real: 0.001s, CPU: 0.001s
>>
>> If I specify portmidi, no errors:
>>
>> dave@phonon:~/src/csound/build $ csound -+rtmidi=portmidi --midi-devices
>> rtmidi: PortMIDI module enabled
>> 3 MIDI input devices
>>  0: 0 (Midi Through Port-0)
>>  1: 1 (pisound MIDI PS-28625BA)
>>  2: 2 (pisound-ctl)
>> 3 MIDI output devices
>>  0: 0 (Midi Through Port-0)
>>  1: 1 (pisound MIDI PS-28625BA)
>>  2: 2 (pisound-ctl)
>>                    overall amps:      0.0
>>            overall samples out of range:        0
>> 0 errors in performance
>> Elapsed time at end of performance: real: 0.003s, CPU: 0.003s
>>
>> Same results on my Pi 4 running Cs7. I don't have a Pi running Cs6 for comparison. The Pi 4 is running bullseye; the Pi 5 is running bookworm.
>>
>> FWIW, I don't really care which interface I use, and I'm fine with using portmidi, but I thought this might indicate an issue.
>>
>> - Dave

Date2024-11-11 20:40
Fromvlz
SubjectRe: [Csnd-dev] possible issue with ALSA midi?
I see in the code that although it seems to accept -+rtmidi=alsa to select the alsaraw midi backend, the names of the midi modules are only alsaraw, alsaseq and devfile. Not sure what the intention was but I guess "alsa" should be added too (as an alias of alsaraw). 

Prof. Victor Lazzarini
Maynooth University
Ireland

On 11 Nov 2024, at 20:34, Dave Seidel <dave.seidel@gmail.com> wrote:


aha, interesting! Yes, that works. We should probably document this.

dave@phonon:~ $ csound -+rtmidi=alsaseq --midi-devices
5 MIDI input devices
 0: hw:0,0 (Timer)
 1: hw:0,1 (Announce)
 2: hw:14,0 (Midi Through Port-0)
 3: hw:24,0 (pisound MIDI PS-28625BA)
 4: hw:128,0 (pisound-ctl)
3 MIDI output devices
 0: hw:14,0 (Midi Through Port-0)
 1: hw:24,0 (pisound MIDI PS-28625BA)
 2: hw:128,0 (pisound-ctl)
                   overall amps:      0.0
           overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.003s, CPU: 0.003s

dave@phonon:~ $ csound -+rtmidi=alsaraw --midi-devices
1 MIDI input devices
 0: hw:2,0 (pisound MIDI PS-28625BA)
1 MIDI output devices
 0: hw:2,0 (pisound MIDI PS-28625BA)
                   overall amps:      0.0
           overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.004s, CPU: 0.004s

dave@phonon:~ $ csound -+rtmidi=devfile --midi-devices
0 MIDI input devices
0 MIDI output devices
                   overall amps:      0.0
           overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.001s, CPU: 0.001s

On Mon, Nov 11, 2024 at 3:12 PM vlz <viclazzarini@gmail.com> wrote:
I checked and this error message comes from the MIDI side of things in the alsa module

static int32_t listDevicesM(CSOUND *csound, CS_MIDIDEVICE *list, int32_t isOutput){
    int32_t count = 0;
    char *s;
    s = (char*) csound->QueryGlobalVariable(csound, "_RTMIDI");
    if (strncmp(s, "alsaraw", 8) == 0) { /* ALSA Raw MIDI */
      count = listRawMidi(csound, list, isOutput);
    } else if (strncmp(s, "alsaseq", 8) == 0) {/* ALSA Sequencer */
      count = listAlsaSeq(csound, list, isOutput);
    } else if (strncmp(s, "devfile", 8) == 0) {

    } else {
      csound->ErrorMsg(csound, Str("rtalsa: Wrong callback."));
    }
    return count;
}

So maybe you can try one of the options: alsaraw, alsaseq or devfile (from the code, it’s raw midi, alsa sequencer midi or
midi file). These are the three options for listing but I guess “alsaraw” should have also been the same as “alsa” but
currently is not there.



> On 11 Nov 2024, at 20:04, Dave Seidel <dave.seidel@GMAIL.COM> wrote:
>
> Yes, -odac is working fine. I went back and checked, and I've been specifying "-+rtmidi=portmidi" for several years now on my Pis, going back to Cs6. So maybe this is an old/existing issue, which might make it low priority.
>
> On Mon, Nov 11, 2024 at 2:52 PM vlz <viclazzarini@gmail.com> wrote:
> It could well be. Can you run -odac to it, does it make any sound?
>
>
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
>
>> On 11 Nov 2024, at 19:48, Dave Seidel <dave.seidel@gmail.com> wrote:
>>
>> I recently acquired a Pi 5, which I've equipped with a Pisound board (like my older Pis). I can build Cs7 without any issues, but I notice that when I query MIDI devices using ALSA as the interface, I get an error:
>>
>> dave@phonon:~/src/csound/build $ csound -+rtmidi=alsa --midi-devices
>> rtalsa: Wrong callback.0 MIDI input devices
>> rtalsa: Wrong callback.rtalsa: Wrong callback.0 MIDI output devices
>> rtalsa: Wrong callback.            overall amps:      0.0
>>            overall samples out of range:        0
>> 0 errors in performance
>> Elapsed time at end of performance: real: 0.001s, CPU: 0.001s
>>
>> If I specify portmidi, no errors:
>>
>> dave@phonon:~/src/csound/build $ csound -+rtmidi=portmidi --midi-devices
>> rtmidi: PortMIDI module enabled
>> 3 MIDI input devices
>>  0: 0 (Midi Through Port-0)
>>  1: 1 (pisound MIDI PS-28625BA)
>>  2: 2 (pisound-ctl)
>> 3 MIDI output devices
>>  0: 0 (Midi Through Port-0)
>>  1: 1 (pisound MIDI PS-28625BA)
>>  2: 2 (pisound-ctl)
>>                    overall amps:      0.0
>>            overall samples out of range:        0
>> 0 errors in performance
>> Elapsed time at end of performance: real: 0.003s, CPU: 0.003s
>>
>> Same results on my Pi 4 running Cs7. I don't have a Pi running Cs6 for comparison. The Pi 4 is running bullseye; the Pi 5 is running bookworm.
>>
>> FWIW, I don't really care which interface I use, and I'm fine with using portmidi, but I thought this might indicate an issue.
>>
>> - Dave