Newbie question on new_midi_part

Hi,
sorry this is really a newbie question, but I looked around the documentation and there is still something I can’t figure out.
I just want to send midi signals to my Behringer Crave which is plugged in Ubuntu via USB. The system does detect it as an I/O midi device.
So I try to make scamp tell it to play just a note but I cannot manage to do that. I guess there is something I do not understand in the parameters I have to give to the function.
So here is my code:

from scamp import *

s = Session

print_available_midi_input_devices()
print_available_midi_output_devices()

cra = s.new_midi_part(CRAVE, midi_output_device=1)

cra.play_note(60,1,1)

And here is the output:

MIDI Input Devices Available:
[Port 0]: Midi Through:Midi Through Port-0 14:0
[Port 1]: CRAVE:CRAVE MIDI 1 20:0
MIDI Output Devices Available:
[Port 0]: Midi Through:Midi Through Port-0 14:0
[Port 1]: CRAVE:CRAVE MIDI 1 20:0
Traceback (most recent call last):
File “/home/mbernard/python/test-midi.py”, line 8, in
cra = s.new_midi_part(CRAVE, midi_output_device=1)
NameError: name ‘CRAVE’ is not defined

I also tried to put “CRAVE” instead of CRAVE, and here is what I get as an error message:
Traceback (most recent call last):
File “/home/mbernard/python/test-midi.py”, line 8, in
cra = s.new_midi_part(“CRAVE”, midi_output_device=1)
File “/home/mbernard/.local/lib/python3.10/site-packages/scamp/instruments.py”, line 223, in new_midi_part
name = "Track " + str(len(self._instruments) + 1) if name is None else name
AttributeError: ‘str’ object has no attribute ‘_instruments’

And if don’t put anything before midi_output_device, I get:

Traceback (most recent call last):
File “/home/mbernard/python/test-midi.py”, line 8, in
cra = s.new_midi_part(midi_output_device=1)
TypeError: Ensemble.new_midi_part() missing 1 required positional argument: ‘self’

I guess I don’t really understand what does the ‘name’ parameter mean…
Any help?

Thank you very much

Two things:

  • “CRAVE” does need to be in quotes
  • needs to be Session() not Session

See if that works!

yes it does!
Sorry for bothering it was such a silly mistake!!!
Thank you very much.