Skip to content
Recording midi even...
 
Notifications
Clear all

Recording midi events and messages

10 Posts
2 Users
0 Likes
6,044 Views
(@kingpatzer)
Noble Member
Joined: 19 years ago
Posts: 2171
Topic starter  

Your question makes no sense.

First, a hard drive is a hard drive. Midi has nothing to do with that.

Second, Midi is nothing but data of Midi events.

Lastly, Midi files are usually saved in SMF (standard midi format) which includes some header information about which voices are assigned to which channels, and then events, which are note on and note off timings along with information about the note being played and the instrument or channel it's played on.

There's also stuff like control change messages, which tell a device to change it's phyiscal status, rather than to play a note. Such as "Synth 1, turn up your volume to 5 and turn on the chorus effect;" and system messages which effect every instrument in the chain.

As to how to record Midi data, simple: get some input device, be it a regular computer keyboard or a Kurzweil K2600 or something inbetween; get a midi program of some kind that will accept the midi input; hood the device up to the computer via an appropriate cable, input the midi data you want save.

"The music business is a cruel and shallow money trench, a long plastic hallway where thieves and pimps run free, and good men die like dogs. There's also a negative side." -- HST


   
Quote
(@noteboat)
Illustrious Member
Joined: 21 years ago
Posts: 4921
 

MIDI is entirely made up of messages. There's no master header file that tells you which patch gets assigned to each voice.

Think of SMF files like ASCII (text) files, but with binary musical information instead of words. When you see words - like this post - the nouns aren't grouped into one section for nouns... they come buried in the stream. Notes in MIDI are like nouns in sentences.

As data gets sent to your MIDI device, it looks for certain things - if the byte that's sent begins with 0xC, that's a 'program' message. The bit following the C indicates which channel will be affected, and the next byte is the program number (your MIDI voice).

Since a voice can be changed at any time, these are sent in sequence with the other data bytes. If you're changing the voice on channel 1, the bytes before the voice change will all be the 'old' voice, and the bytes after it will be the 'new' voice for that channel. Think of those like verbs in sentances - they can also happen anywhere.

I don't know of any way to delete note information all at once for a file. There probably isn't any - because a note isn't one MIDI message - it's a whole series of events. It's a message to start the note, which is followed by one byte for pitch and a second byte for velocity (the attack of the note). Other messages are sent to simulate piano pedals, tremolo affects, etc. Still more messages can be sent to call algorhythms for timbre, variations like volume swells or pitch wheel changes, and so on. Finally, a separate message is sent to end the note. So now you've not only got 'nouns' to try to erase, but also all the adjectives that affect those nouns.

In the middle of all that, you might be sending messages to start/stop/change notes in other channels, or messages to pan the output. So even a single note 'event' has no clean start and stop points... unless, of course, you're writing for just one voice on one channel with mono output. Then you can delete everything from the first note to the last, and all that's left will be your 'system' messages.

There are some 'system' bytes sent before the notes begin, to establish the clock etc. - but these 'system' messages can also be sent during the 'data' portion if something (like tempo) changes.

If you really feel like messing around in the guts of MIDI, there's a decent site that documents the standard here

Guitar teacher offering lessons in Plainfield IL


   
ReplyQuote
(@noteboat)
Illustrious Member
Joined: 21 years ago
Posts: 4921
 

I have no idea what you'd need that for... but you might try this:

- Get a 16 channel MIDI graphical interface (like Cakewalk)
- Import the MIDI that you have into a new file in that software
- Set the file parameters for 'General MIDI' (which should add some GM instructions at the beginning of the file, like clock settings and a 'MIDI start' command)
- One by one, manually delete the notes.
- Save the file

Graphical interfaces like Cakewalk import a MIDI file, and then group the instructions together to display events as notes, dynamic marks, etc. on the screen. Deleting a note on the screen should wipe out the associated start/stop/pitch/velocity/etc. messages associated with it.

In theory, at least, this would leave you with 'non-note' messages intact.

I'd delete the notes one by one, though - highlighting a measure at a time might delete all the events between the time stamps for that measure.

Guitar teacher offering lessons in Plainfield IL


   
ReplyQuote
(@noteboat)
Illustrious Member
Joined: 21 years ago
Posts: 4921
 

I haven't used Cakewalk in years - I switched to more powerful programs like Finale. So any specific instructions I could give you probably won't match your version... mine's pretty dated. But even in the older versions, yes, you can delete events in the event editor.

Pull down your help menu.
Go to the Index tab.
Scroll down to 'Events'
Click on 'editing'

In my version, I get a full screen of instructions on viewing, inserting, editing, and deleting events.

When in doubt, read the manual :)

Guitar teacher offering lessons in Plainfield IL


   
ReplyQuote
(@noteboat)
Illustrious Member
Joined: 21 years ago
Posts: 4921
 

If you record straight from your sampler, you get ALL the messages generated by the sampler (or any other direct input). You could then edit out the note events if you want to.

But what channel a message gets sent to is encoded as part of the byte sent. MIDI interfaces are serial - they send one single bit of information at a time, and then they're assembled on playback. Whatever the bits for channel work out to... some value between 0 and 15... determines the channel it's sent to when you play it back.

MIDI isn't like analog tape, where each channel is physically separate entity. All events are the same - it's the two bits in a specific place that identify a logical channel.

MIDI channels are virtual tracks, not separate places like on analog tape. If you capture a program change for the instrument in track 15, that code begins with 0xCE. If you try to 'store' it in track 11, that will change the code to start with 0xCA. Now it will 'be' in track 11.... but it will never again control any track 15 event unless you manually change it back to 0xCE - which moves it 'out' of track 11 and back to track 15. The channel is part of the event, not a place it's physically stored!

What you're trying to do makes absolutely no sense to me - what good will all these system messages do if they don't apply to anything? And why organize all track messages of one type into a single track - that's putting them through a meat grinder; it's really hard to reassemble anything that looks like a cow after that happens.

Guitar teacher offering lessons in Plainfield IL


   
ReplyQuote
(@noteboat)
Illustrious Member
Joined: 21 years ago
Posts: 4921
 

That makes a little more sense now. You want to create soundfonts.

My advice: this is not a do-it-yourself project. It's pretty clear from your questions that you really don't know how synths (or digital music storage) works... it's like you've seen a picture of a space shuttle and decided to build your own from spare parts.

You're going to run into two types of problems: first, your technical limitations... I get the sense you're looking for a really quick and easy way to get this done, but without doing your homework and really understanding the file formats and device communication your chances of building your own are next to none. I've been messing around with MIDI since the mid 80s, and I wouldn't attempt it!

Second, if you should figure it all out and create your automation, it's not going to work on any synth anyway. When the MIDI standard first came out in 1983, there were lots of gray areas. Not all hardware manufacturers mapped things the same way, even though they all conformed to the standard, so synth voices (and even key pitches!) didn't line up from one instrument to another. I recommeded you use the GM format in an earlier post on this thread because that avoids some of those problems... but manufacturers still make 'extensions' that are not standard (Yamaha's GM extension is the 'XG format', Roland's is the 'GS' etc.)

Instead, you should be looking at soundfont software. These programs will allow you to manipulate the characteristics of your samples, including envelope shape, filtering, key mapping, panning, etc. and store those in a separate file. Like MIDI, there are several formats in use - Akai, Korg, Casio, Yamaha, Roland and others have ALL developed their own - but teams of programmers have created a couple of somewhat portable formats that will work with most synths: *.sf2 (SoundFont 2.0, developed by Creative Labs) and *.dls (download sounds).

You'll still need to learn how to import *.sf2 or *.dls files into each synth you end up using. This area is a few years away from being plug-and-play.

Guitar teacher offering lessons in Plainfield IL


   
ReplyQuote
(@kingpatzer)
Noble Member
Joined: 19 years ago
Posts: 2171
Topic starter  

MIDI is entirely made up of messages. There's no master header file that tells you which patch gets assigned to each voice.

There's no master header file but there is a header in the SMF that tells you a bit about the file.

It tells you, for example, if thefile contains a single multi-channel track or the file contains one or more simultaneous tracks (for MIDIoutputs) of a sequence or the file contains one or more sequentially independent single-track patterns. The header chunk is required as far as I know.

Then there is USUALLY a section of meta-events which need not be supported by any particular device, but which include a whole host of things like sequence number, instrument name, copyright notice, etc. These are all optional, but most devices will put out one or more of these.

"The music business is a cruel and shallow money trench, a long plastic hallway where thieves and pimps run free, and good men die like dogs. There's also a negative side." -- HST


   
ReplyQuote
(@noteboat)
Illustrious Member
Joined: 21 years ago
Posts: 4921
 

Well, yes, King - there is a required header. It's pretty short (48 bits), and contains only:

1. the length of the file
2. whether it's single track, multi-track, or independent single tracks (because you can actually have more than one song in a single MIDI file.
3. the number of tracks
4. the time division - i.e. the smallest possible resolution of events

The meta events like copyright etc. are optional. If they're included, they're actually part of the first track 1 chunk... the ones used most often are for key signature and tempo - but even that's optional; if you leave it out, you get 4/4 at 120bpm

Guitar teacher offering lessons in Plainfield IL


   
ReplyQuote
(@kingpatzer)
Noble Member
Joined: 19 years ago
Posts: 2171
Topic starter  

I ddin't realize the meta events where part of chunk1 track1. I thought they were part of the header. Learn something new everyday I guess :)

"The music business is a cruel and shallow money trench, a long plastic hallway where thieves and pimps run free, and good men die like dogs. There's also a negative side." -- HST


   
ReplyQuote
(@noteboat)
Illustrious Member
Joined: 21 years ago
Posts: 4921
 

Here's the 15 defined meta events defined right now by the International MIDI Association, and where they should fall:

1. Text event - if it's a track name, orchestration notes, etc., the front of the track (i.e., with delta time 0, before any data events) is recommended. Other text events, like lyrics can fall anywhere in track data... and you can use text event tags instead of other specified text events (like copyright, lyric, instrument name, etc.) if that turns you on.

2. Copyright - the first entry in track 0 is the recommended location - that keeps it right up by the front of the file.

3. Sequence/track name - the front of the track

4. Instrument name - front of the track and/or at instrument changes

5. Lyric - anywhere. If you use the lyric event instead of a text event, the convention is to use one event for each syllable.

6. Text marker - usually used for rehearsal marks, like 'section B'. If you use these, it's recommended you have one at the front of the track.

7. Cue point - anywhere. These are used to synch MIDI to video with events like "car door slams"

8. Channel prefix - assigns the following events to a specific channel; occurs anywhere.

9. Port prefix - just like channel prefix

10. End of track - this is the only one actually required by the standard. It happens at the end of track data - which may not be the end of the file, if there's more than one track, or if you have loops that concatenate to another track later on.

11. Set tempo - changes the clock count. Can occur anywhere.

12. SMPTE offset - at the front of the track. If you use this one, there's other required stuff that goes with it... it has to be with the tempo map, etc.

13. Time signature - at the front of the track if not 4/4; it can also occur anywhere you change signatures

14. Key signature - same as time signature

15. Sequencer specific events - this one also has a lot of required stuff if it's used (like the manufacturer's ID)... and manufacturers who use these events are supposed to publish what they're for.

Guitar teacher offering lessons in Plainfield IL


   
ReplyQuote