Skip to content
Search
mxm, IT's mad science
Sections
Welcome
News
Search
Replies
Personal tools
You are not logged in
Log in
You are here:
Home
»
Products
»
Open Source
»
Python Midi Package
»
Using Python Midi package
Navigation
Home
Papers
Products
Open Source
mxmContacts
Python Midi Package
Downloads
You can download mxm products
here
.
Due to it's technical and international nature, this section is in english.
Max M Has a blog too.
og er glad for mad
Comment
Above in this comment thread:
Python Midi Package
Using Python Midi package
Posted by
Anonymous User
at
2004-03-15 02:47 PM
Hello, Max.
I'm playing with your beatiful module. It is what I'm looking for.
I have a doubt: how I can write chords in a track?
I've tried to write three notes simultaneously:
m.start_of_track(1)
m.sequence_name('Piano')
m.instrument_name('Piano')
m.update_time(0)
m.note_on(channel=1, note=0x3C)
m.note_on(channel=1, note=0x3E)
m.note_on(channel=1, note=0x43)
m.update_time(96)
m.note_off(channel=1, note=0x3C)
m.note_off(channel=1, note=0x3E)
m.note_off(channel=1, note=0x43)
m.end_of_track()
but it generates some strange note durations in my sequencer: each note has a different duration.
(I've used different sequencers: AnvilStudio (win32), Jazz++, Muse and Rosegarden).
How can I solve it?
I thank your time and work.
Regards.
David
You need to set the time before each event
Posted by
maxm
at
2004-03-17 01:35 AM
m.start_of_track(1)
m.sequence_name('Piano')
m.instrument_name('Piano')
m.update_time(0)
m.note_on(channel=1, note=0x3C)
m.update_time(0)
m.note_on(channel=1, note=0x3E)
m.update_time(0)
m.note_on(channel=1, note=0x43)
m.update_time(96)
m.note_off(channel=1, note=0x3C)
m.update_time(0)
m.note_off(channel=1, note=0x3E)
m.update_time(0)
m.note_off(channel=1, note=0x43)
m.update_time(0)
m.end_of_track()
The update_time() is allways implied. If you don't set it manually, it
will use the previous.
So in your case you will have 96 clicks between the note_off's in your
file.
To the midi file it will look like:
m.update_time(96)
m.note_off(channel=1, note=0x3C)
m.update_time(96)
m.note_off(channel=1, note=0x3E)
m.update_time(96)
m.note_off(channel=1, note=0x43)
m.update_time(96)
m.end_of_track()
That can seem as an odd behavious at first. But there is a very good
technical reason. Though it is rather long-vinded.
It has to do with using the same api for doing midi-file and realtime
processing.
For a delta time of 0 you can get away with only setting the first 0 value update_time
though.
m.start_of_track(1)
m.sequence_name('Piano')
m.instrument_name('Piano')
m.update_time(0)
m.note_on(channel=1, note=0x3C)
m.note_on(channel=1, note=0x3E)
m.note_on(channel=1, note=0x43)
m.update_time(96)
m.note_off(channel=1, note=0x3C)
m.update_time(0) ####### 0 clicks until next event.
m.note_off(channel=1, note=0x3E)
m.note_off(channel=1, note=0x43)
m.end_of_track()
Replies to this comment
My chords soudns OK now (
Posted by
Anonymous User
at
2004-03-23 10:28 AM)
Feel free (
Posted by
maxm
at
2004-03-28 04:30 PM)
Status
Posted by
Anonymous User
at
2004-04-08 02:42 PM
What's the status of this project? Has any more work been done on this? It looks great and I plan on using it.
Thanks! Jeremy
Replies to this comment
It is stable & maintained (
Posted by
maxm
at
2004-04-10 01:22 PM)
python midi
Posted by
Anonymous User
at
2004-06-09 07:09 PM
Hi Nice work !!!
can i put lyrics to each note ???
thnx
Replies to this comment
Yes (
Posted by
maxm
at
2004-06-10 11:18 AM)
Lyrics again.... (
Posted by
Anonymous User
at
2004-06-12 03:30 PM)
the midi standard does not define that (
Posted by
maxm
at
2004-06-21 03:23 PM)
expression controller
Posted by
Anonymous User
at
2004-08-10 06:46 PM
Hi,
I'm new to python.
How would I add expression contoller messages to notes?
Thanks
Calvin 79
Replies to this comment
expression control (
Posted by
Anonymous User
at
2004-08-10 09:33 PM)
You cannot play it from the midi module as it is now (
Posted by
maxm
at
2004-10-05 08:47 AM)
how do i put to parallel tracks in one midi file? (
Posted by
Anonymous User
at
2004-10-22 10:20 PM)
I'm playing with your beatiful module. It is what I'm looking for.
I have a doubt: how I can write chords in a track?
I've tried to write three notes simultaneously:
m.start_of_track(1)
m.sequence_name('Piano')
m.instrument_name('Piano')
m.update_time(0)
m.note_on(channel=1, note=0x3C)
m.note_on(channel=1, note=0x3E)
m.note_on(channel=1, note=0x43)
m.update_time(96)
m.note_off(channel=1, note=0x3C)
m.note_off(channel=1, note=0x3E)
m.note_off(channel=1, note=0x43)
m.end_of_track()
but it generates some strange note durations in my sequencer: each note has a different duration.
(I've used different sequencers: AnvilStudio (win32), Jazz++, Muse and Rosegarden).
How can I solve it?
I thank your time and work.
Regards.
David
m.sequence_name('Piano')
m.instrument_name('Piano')
m.update_time(0)
m.note_on(channel=1, note=0x3C)
m.update_time(0)
m.note_on(channel=1, note=0x3E)
m.update_time(0)
m.note_on(channel=1, note=0x43)
m.update_time(96)
m.note_off(channel=1, note=0x3C)
m.update_time(0)
m.note_off(channel=1, note=0x3E)
m.update_time(0)
m.note_off(channel=1, note=0x43)
m.update_time(0)
m.end_of_track()
The update_time() is allways implied. If you don't set it manually, it
will use the previous.
So in your case you will have 96 clicks between the note_off's in your
file.
To the midi file it will look like:
m.update_time(96)
m.note_off(channel=1, note=0x3C)
m.update_time(96)
m.note_off(channel=1, note=0x3E)
m.update_time(96)
m.note_off(channel=1, note=0x43)
m.update_time(96)
m.end_of_track()
That can seem as an odd behavious at first. But there is a very good
technical reason. Though it is rather long-vinded.
It has to do with using the same api for doing midi-file and realtime
processing.
For a delta time of 0 you can get away with only setting the first 0 value update_time
though.
m.start_of_track(1)
m.sequence_name('Piano')
m.instrument_name('Piano')
m.update_time(0)
m.note_on(channel=1, note=0x3C)
m.note_on(channel=1, note=0x3E)
m.note_on(channel=1, note=0x43)
m.update_time(96)
m.note_off(channel=1, note=0x3C)
m.update_time(0) ####### 0 clicks until next event.
m.note_off(channel=1, note=0x3E)
m.note_off(channel=1, note=0x43)
m.end_of_track()
Replies to this comment
Thanks! Jeremy
Replies to this comment
can i put lyrics to each note ???
thnx
Replies to this comment
I'm new to python.
How would I add expression contoller messages to notes?
Thanks
Calvin 79
Replies to this comment