adafruit / adafruit/Adafruit_CircuitPython_MIDI
ProgramChange does not work
- Dominant language
- Python
- Stars
- 56
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
When using the Program Change call it sends 0x0 followed by the patch number.
Example code:-
```python
import usb_midi
import adafruit_midi
from adafruit_midi.note_off import NoteOff
from adafruit_midi.note_on import NoteOn
from adafruit_midi.program_change import ProgramChange
import time
midi = adafruit_midi.MIDI(
midi_in=usb_midi.ports[0], in_channel=0, midi_out=usb_midi.ports[1], out_channel=0 )
midi.send(NoteOn(65,100))
time.sleep(0.6)
midi.send(NoteOff(65,0))
time.sleep(0.6)
midi.send(ProgramChange(0x7))
```
I notice in the unit test test_MIDI_unittests.py this call is not tested despite the import list described as the "full monty".
Is there a temporary fix to send this message? I have been tying to specify the data bytes and sent those, but I keep getting error messages like "AttributeError: 'NoneType' object has no attribute 'channel'".
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the ProgramChange entry point and running test_MIDI_unittests.py, which currently does not cover this call. Compare the emitted packet with the other MIDI message tests and add coverage that verifies the expected Program Change encoding for the supplied patch number; the new test should pass without the reported NoneType error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- audio-video-rtc
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100