Skip to content

Commit

Permalink
different getnote defaults for different formats
Browse files Browse the repository at this point in the history
Closes #114
  • Loading branch information
Datseris committed Nov 7, 2019
1 parent a9ac7b7 commit c53e4a6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MIDI"
uuid = "f57c4921-e30c-5f49-b073-3f2f2ada663e"
repo = "https://github.com/JuliaMusic/MIDI.jl.git"
version = "1.5.0"
version = "1.5.1"

[deps]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
3 changes: 2 additions & 1 deletion src/midifile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,5 @@ on the beats per minute `bpm` and ticks per quarter note `tpq`.
ms_per_tick(midi::MIDI.MIDIFile, bpm = BPM(midi)) = ms_per_tick(midi.tpq, bpm)
ms_per_tick(tpq, bpm) = (1000*60)/(bpm*tpq)

getnotes(midi::MIDIFile, trackno = 2) = getnotes(midi.tracks[trackno], midi.tpq)
getnotes(midi::MIDIFile, trackno = midi.format == 0 ? 1 : 2) =
getnotes(midi.tracks[trackno], midi.tpq)
9 changes: 5 additions & 4 deletions src/miditrack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,13 @@ end


"""
getnotes(midi::MIDIFile, trackno = 2)
getnotes(midi::MIDIFile [, trackno])
Find all NOTEON and NOTEOFF midi events in the `trackno` track of a `midi`,
Find all NOTEON and NOTEOFF midi events in the `trackno` track of a `midi`
(default 1 or 2),
that correspond to the same note value (pitch) and convert them into
the `Note` datatype. There are special cases where NOTEOFF is actually encoded as NOTEON with 0 velocity.
`getnotes` takes care of this.
the `Note` datatype. There are special cases where NOTEOFF is actually
encoded as NOTEON with 0 velocity, but `getnotes` takes care of this.
Notice that the first track of a `midi` typically doesn't have any notes,
which is why the function defaults to track 2.
Expand Down

2 comments on commit c53e4a6

@Datseris
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/5168

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v1.5.1 -m "<description of version>" c53e4a6f665704ee7bcf254b55a3adbe83870653
git push origin v1.5.1

Please sign in to comment.