1
1
mirror of https://github.com/wader/fq.git synced 2024-11-25 05:55:43 +03:00
fq/format/midi/midi.md
twystd 9c7f7f961a midi: fixes for PR comments:
- Renamed 'tracks' section to 'content' (cf. https://github.com/wader/fq/pull/1004#discussion_r1746651234)
- Removed 'validation only' errors (cf. https://github.com/wader/fq/pull/1004#issuecomment-2333464662)
- Decoded MThd divisions field with SMPTE timecode
2024-09-06 15:41:57 -07:00

1.1 KiB

Notes

  1. Only supports the MIDI 1.0 MIDI file specification.
  2. Only supports MThd and MTrk chunks.
  3. Does only basic validation on the MIDI data.

Sample queries

  1. Extract the track names from a MIDI file
fq -d midi -d midi '.. | select(.event=="track_name")? | "\(.track_name)"' midi/twinkle.mid 
  1. Extract the tempo changes from a MIDI file
fq -d midi '.. | select(.event=="tempo")?.tempo' midi/twinkle.mid
  1. Extract the key changes from a MIDI file
fq -d midi '.. | select(.event=="key_signature")?.key_signature' midi/twinkle.mid
  1. Extract NoteOn events:
fq -d midi 'grep_by(.event=="note_on") | [.time.tick, .note_on.note] | join(" ")' midi/twinkle.mid

Authors

References

  1. The Complete MIDI 1.0 Detailed Specification
  2. Standard MIDI Files
  3. Standard MIDI File (SMF) Format
  4. MIDI Files Specification