Skip to content

Implementation of a parser for MIDI events (messages) and alternative send interface #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 98 commits into from
Apr 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
c1d6760
First implementation of reading MIDI messages using read() against _m…
Feb 27, 2019
4202499
Added a MIDIUnknownEvent to deal with anything the module does not kn…
Feb 27, 2019
d585a51
midi_intest1 - simple loop reading data from MIDI Channel 1 but with …
Feb 27, 2019
0ce8bef
Fixing bug with _STATUS values transposed between NoteOn and NoteOff. #3
Feb 28, 2019
c909587
register_message_type() now inserts in mask order to allow registrati…
Mar 16, 2019
fa3e5d4
Enhancing in_channel setter to accept ALL for a type of OMNI mode and…
Mar 16, 2019
6f8d51c
Missed second arg to from_bytes() for data-less TimingClock which see…
Mar 16, 2019
e1cc85d
Renaming from_bytes() in MIDIMessage to from_message_bytes() as it is…
Mar 16, 2019
fb213ab
Giving PitchBendChange value a proper name - now pitch_bend. #3
Mar 16, 2019
310e28a
Implementing the channel filtering with single input channel or "ALL"…
Mar 17, 2019
83c6b8c
Returning number of skipped bytes in from_message_bytes() which is no…
Mar 17, 2019
39fe07f
Renaming vel to velocity in NoteOn / NoteOff for consistency with oth…
Mar 17, 2019
ba38b08
Some welcome unit tests for increasingly complex adafruit_midi.MIDIMe…
Mar 17, 2019
e389ff0
Adding some tests around SysEx which demonstrate implementation is no…
Mar 18, 2019
0c70680
More consistent naming, self._inbuf now self._in_buf.
Mar 18, 2019
8d10353
Aligning NoteOff naming with recent changes to NoteOn. #3
Mar 21, 2019
4686050
Move the MIDI class in adafruit_midi.py into adafruit_midi/__init__.p…
Mar 21, 2019
7c34ec7
Splitting MIDIMessage child messages into separate files to allow use…
Mar 21, 2019
d6efee7
Adding a send method to MIDI to allow sending of the new MIDIMessage.
Mar 21, 2019
5aa000b
Prefixing all classes for testing with Test_. #3
Mar 21, 2019
4848fa4
Merging from upstream (https://github.com/adafruit/Adafruit_CircuitPy…
Mar 22, 2019
f647a27
Making test_NoteOn_partialandpreotherchannel two tests test_NoteOn_pa…
Mar 22, 2019
55c98ee
Fixing indent level. #3
Mar 22, 2019
64cf79e
Implemented the variable length message parsing to both handle SysEx …
Mar 22, 2019
3100fd4
Correcting and enhancing test_NoteOn_prepartialsysex() to match the c…
Mar 22, 2019
30ccc47
Adding a note_parser() to MIDIMessage allowing NoteOn and NoteOff con…
Mar 24, 2019
67226e7
Splitting out the individual and sequence tests in Test_MIDI. #3
Mar 24, 2019
ba091d4
Unit tests for exception behaviour for MIDIMessage constructed object…
Mar 24, 2019
4dace75
Adding as_bytes() method to all the MIDIMessage children apart from S…
Mar 24, 2019
88b28c4
Duplicating NoteOn constructor tests for NoteOff and tweaking first t…
Mar 24, 2019
17eda5b
Whitespace adjustment. #3
Mar 26, 2019
06247a9
Adding first mocked test using send(), capturing data and feeding it …
Mar 26, 2019
6b4cb0c
Whitespace tabbing correction. #3
Mar 27, 2019
8705e68
Adding range checking to rest of non-dataless MIDI messages following…
Mar 27, 2019
d3b0ece
Making a function out of code to setup the loopback/echo send/receive…
Mar 28, 2019
cc4642f
Added test test_somegood_somemissing_databytes which uses new MIDI_mo…
Mar 28, 2019
f74992f
Added test test_larger_than_buffer_sysex which tests a SystemExclusiv…
Mar 28, 2019
4c68e6e
Adjusting travis script so it runs tests and pylints them and relocat…
Mar 28, 2019
0a4c7d7
Adjusting MIDI channel printing in examples to present the channel nu…
Mar 28, 2019
5a778e4
Showing equivalent of new interface in new examples/midi_simpletest2.…
Mar 29, 2019
47f0a7e
Minor tweak to MIDI_mocked_receive.read() to deal with case of chunk …
Mar 29, 2019
053e9c0
Putting the data into the renamed test_running_status_when_implemente…
Mar 29, 2019
7a37669
New test test_captured_data_one_byte_reads() working from some slight…
Mar 29, 2019
a5e0ced
Renaming MIDI.read_in_port() to receive to match the send method. #3
Mar 30, 2019
6b1509e
Adding test_termination_with_random_data() to ensure that a large ran…
Mar 30, 2019
b8c839a
Finished checks in test_SystemExclusive_NoteOn(). #3
Mar 30, 2019
767451a
Documentation and TODO tidying. #3
Mar 30, 2019
39e72cb
Fixing a bug unrelated to this feature, _generic_3() test against cha…
Mar 30, 2019
6fc5f28
Completing docs for in_channel() and correcting default (from constru…
Mar 30, 2019
44b77e0
Completing docs for MIDI.send(). #3
Mar 30, 2019
f17e89a
Adding another test for 6 bytes of valid but unknown to module MIDI m…
Mar 30, 2019
50f0fcb
Adding an example of input from multiple channels, a little bit of pr…
Mar 30, 2019
caac32d
Renaming test files to match what pytest expects.
Mar 30, 2019
142ab86
Judicious sprinkle of pylint disables in appropriate places in tests …
Mar 30, 2019
804a949
MIDIMessage.from_message_bytes() start return value was always 0 (hig…
Mar 30, 2019
b93dc7c
Fixing a bug with use of ALL_CHANNELS constant.
Mar 30, 2019
ac6b568
More pylint tidying including documenting the two MIDIMessage classes…
Mar 30, 2019
fe674f2
pylint does not like _LENGTH due to access to the value outside of cl…
Mar 31, 2019
6e1257e
pylint does not like _CHANNELMASK due to access to the value outside …
Mar 31, 2019
0ae13ef
Chopping up the unwieldy code in MIDIMessage.from_message_bytes(), so…
Mar 31, 2019
1811478
Adding documentation to each of the MIDI message classes.
Mar 31, 2019
c1740cb
More pylint happiness and minor reST formatting corrections. #3
Mar 31, 2019
0fba8ff
More pylint happiness for examples. #3
Mar 31, 2019
0f96357
Saving a bit of memory by punting frequently used ValueError("Out of …
Mar 31, 2019
5d21aad
Adding all the messages into API docs. #3
Mar 31, 2019
3d6682e
Adding myself to author list. #3
Mar 31, 2019
db01ea7
More pylint merriment. #3
Apr 1, 2019
38fd80e
Merge branch 'master' of dev version.
Apr 1, 2019
4757e5d
Merge branch 'master' of dev version.
Apr 1, 2019
e371617
Merge branch 'master' of dev version.
Apr 1, 2019
944cb4d
pylint does not like the comment on same line. #3
Apr 1, 2019
5b813a3
Cleaning up script lines - I think the strange looking negative direc…
Apr 1, 2019
279345b
Setting the package names correctly in the MIDI messages class files.
Apr 1, 2019
c31d7e0
Merge branch 'master' of dev version.
Apr 1, 2019
9bfbd6c
Missing one correction of the package names in Spinx/reST docs in mid…
Apr 1, 2019
d0af077
Missing one correction of the package names in Spinx/reST docs in mid…
Apr 1, 2019
2f547a2
Merge branch 'master' of dev version.
Apr 1, 2019
27ada48
Correcting a username in comments. #3
Apr 2, 2019
83d3a2a
Adding unit tests specific to note_parser.
Apr 2, 2019
6f2aecb
Going back to previous .travis.yml as it has broken. #3
Apr 2, 2019
6676f9f
Corrected the current example in README.rst. This does not yet show t…
Apr 2, 2019
14d69d3
Correcting pylint inhibition (missing colon!) on a simplifiable-if-st…
Apr 2, 2019
047d1ce
Forcing the channel argument to as_bytes() in MIDIMessage and its chi…
Apr 2, 2019
5d0024d
Renaming PitchBendChange to PitchBend. #3
Apr 2, 2019
e3a9ebe
Renaming pitch_bend_change file to pitch_bend (part II of previous co…
Apr 2, 2019
4ce502c
Correcting the docs on two MIDI properties for channels based on @tan…
Apr 5, 2019
dfb307f
Alternative method of shutting up pylint when instance variables are …
Apr 5, 2019
d78b0f0
Converting to a MIDI message format which stores channel number as a …
Apr 5, 2019
5cd820d
Removing default values in MIDI constructor for midi_in and midi_out …
Apr 6, 2019
a764c70
Replacing MIDI.send() use of bytes(object) with object.__bytes__() du…
Apr 6, 2019
b12f924
Missed update of midi_inoutdemo.py to new MIDI.receive() return value…
Apr 6, 2019
621fded
New example to check memory use. CPX 4.0.0 beta 5 goes from 20128 to …
Apr 6, 2019
146d0fb
midi_intest1.py refresh, needed messages imported. #3
Apr 7, 2019
d04b5c6
pylint tweaks for midi_memorycheck.py. #3
Apr 7, 2019
45a55c4
midi_inoutdemo.py typo fix. #3
Apr 7, 2019
e3dfd0e
midi_memorycheck.py workaround for Travis pylint issue with false no-…
Apr 7, 2019
bb44772
Giving NoteOn and NoteOff some default velocity values as this is use…
Apr 8, 2019
d507b42
Removing old TODO, polishing docs for MIDIMessage.register_message_ty…
Apr 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# See https://github.com/adafruit/circuitpython-build-tools for detailed setup
# instructions.

# CUSTOMISED to run tests
#
dist: xenial
language: python
python:
Expand Down Expand Up @@ -42,7 +44,9 @@ install:
- pip install --force-reinstall pylint==1.9.2

script:
- pylint adafruit_midi.py
- ([[ -d "tests" ]] && py.test)
- pylint adafruit_midi/*.py
- ([[ -d "tests" ]] && pylint --disable=missing-docstring,invalid-name,bad-whitespace,trailing-whitespace,line-too-long,wrong-import-position,unused-import tests/*.py)
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace examples/*.py)
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-midi --library_location .
- cd docs && sphinx-build -E -W -b html . _build/html && cd ..
16 changes: 8 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,21 @@ Usage Example

import time
import random
import usb_midi
import adafruit_midi

midi = adafruit_midi.MIDI(out_channel=0)
midi = adafruit_midi.MIDI(midi_out=usb_midi.ports[1], out_channel=0)

print("Midi test")

print("Default output channel:", midi.out_channel)
print("Listening on input channel:", midi.in_channel)
print("Default output MIDI channel:", midi.out_channel + 1)

while True:
midi.note_on(44, 120)
midi.note_off(44, 120)
midi.control_change(3, 44)
midi.pitch_bend(random.randint(0,16383))
time.sleep(1)
midi.note_on(44, 120)
midi.note_off(44, 120)
midi.control_change(3, 44)
midi.pitch_bend(random.randint(0,16383))
time.sleep(1)


Contributing
Expand Down
143 changes: 0 additions & 143 deletions adafruit_midi.py

This file was deleted.

Loading