For background information on sequencers and synthesizers see: * http://en.wikipedia.org/wiki/Electronic_musical_instrument -- WikiPedia entry on Eletronic Musical Instruments * http://www.geocities.com/tablizer/foxmusic.htm -- A Sequencer written in FoxPro for Windows 2.6 ----- '''Criteria used to create sounds on the synthesizer (how a sound is created)''' ----- '''Definition of a sequencer''' A sequencer is a device that causes one or more synthesizer to produce sounds at specific times. Most modern synthesizers use MIDI (a binary format), which allows them to define when a note starts, when it stops, its velocity and other control parameters. There are also analog sequencers that use "control voltage" (CV) to achieve similar results. They say perforated music sheets fed in organs were the ancestors of the sequencer the same way perforated cards are the ancestors of our computer files. Since synthetizers can emulate any sound and any instrument of music it is therefore very easy to produce a song. In fact no musicians are needed! Just an excellent techncian. We'll examine how a sequencer program works. ''We will? The program described below is a sequence file editor, not a sequencer.'' ---- Sequencing has become less popular with the arrival of inexpensive digital audio editing systems. Racks of synthesizers and effects controlled via MIDI are being replaced by software and sound cards that run on consumer grade PCs. ----- Re: FoxPro version (Note that FoxPro version 2.5 and 2.6 had a GUI, but it was before "Visual" was added to the name. The Visual version changed the GUI entirely.) Do you want to know more about the internals, or the song structuring? I store intermediate MIDI data itself in a structure that looks like this: Table: MIDI ----------- Beat // (real number) LenB // Number of bytes in MIDI message (up to 4?) Byte3 // Midi data byte #3 (integer) Byte4 // Midi data byte #4 Byte5 // Midi data byte #5 Why it goes up to 5 bytes when there are supposed to 4 I don't know. It may depend on whether the "timing byte" is counted or not. It has been a while since I had to look this deep, so a lot of details are fuzzy. This structure is converted to text and fed to a utility that I picked up called T2MF.EXE that converts text into a binary MIDI file. IIRC the Beat number has to be converted to "tics", a special MIDI delta timing byte notation. The binary file is then fed to a regular MIDI file player(s) program which sends out MIDI info to a music synthesizer through a MIDI port (I installed a card on my PC). This is how FoxPro talks to MIDI players. It may seem like a lot of steps, but it happend pretty quickly. Reading MIDI from a music device (such as a music keyboard) is a bit trickier, as I had to change that portion twice. But the actual songs are not stored in this somewhat raw format, but in various tables instead. Most of them can be seen in the screen prints in the link. These tables do not have to concern themselves with MIDI specifics more or less, other than following the "track" convention and special controller numbers. ''You haven't written a sequencer. You've written a sequence file editor. T2MF converts ASCII files to SMF. What do you use to play the SMF? That's the actual sequencer, and I doubt it's written in FoxPro. Can you do things like change tempo while a sequence is playing?'' I always thought that was a "midi file player". Nor do I consider my FoxPro tool a "midi file editor", because it operates on a higher-level abstraction, the "song". My understanding of the term "sequencer" seems to vary from yours. ''A "midi file player" is a sequencer. It sequences the stream of MIDI events sent to the devices. It doesn't matter what level of abstraction it operates on.'' What would you call the "song editor" then? I had to divorce the song editing from the playing/recording more or less because devices kept changing on me. ''A sequence file editor. Did you ever write MIDI data to the wire from FoxPro? If so, how did you synchronize it?'' I don't think "sequence file editor" distinquishes it from a "byte diddler" kind of application, sort of a DOS DEBUG that recognizes MIDI messages. I have seen tools like that, and my tool is nothing like it. Anyhow, I don't really do synchronization anymore. I experimented with it in the past, but gave up on it as I did not really need it. It is hard to play music and watch a computer screen at the same time anyhow, at least for me. Synchonization between playing and recording is done via a Visual Basic component that I purchased, but it does not work on newer machines. ''It's a sequence file editor because it edits sequence files. That has nothing to do with "byte diddling" or DOS debugging. "Synchronization" refers to the real time scheduling of MIDI events. I was curious how you did that in FoxPro, but I see that you didn't.'' How about "music composition editor"? However, that suggests a sheet-music editor, which it wasn't. Never mind, it is what it is. -t ----- '''The song schemas''' Here is a simplified version of the song schemas (names vary a bit from actual): Table: Songs ---------- songID songTitle .... Table: Sequence''''''Info -------------------- sequenceRef // see note songRef order // playing sequence phraseRef altNumber // phrase alternative setting number Table: Phrase ----------------- phraseID songRef phraseDescript span // duration in beats Table: Track --------------- phraseRef altNumber // if selecting alternative values track // track letter comment .... Table: Notes ------------- noteID trackRef // track letter phraseRef noteNumber // Midi note number velocity // Midi velocity (int) beginBeat // beginning beat number (offset from phrase start) lengthBeat // length of notes in beats ..... Ideally, there would be a "Sequence" table also to give a sequence name, but I just used a number so I didn't really need it. I could put a description in a record of the "sequenceInfo" table if I wanted a comment. A blank "altNumber" in the Track table is generally the the first one played, and thus is considered the "initializer" or default version of the track. It is roughly analogous to the parent class in OOP inheritance in which various items can be selectively "overridden" for the alt's by putting a value in "altNumber". One implementation approach is to simply "execute" the blank-alt track when encountered (first by convention), or play all the blank-alt tracks at the beginning to initialize the synthesizer. I settled on the latter. ------ I discovered a nifty tool that in some ways resembles mine. It's chord-based and has little or no control over melodies, but the phrase referencing and gluing structure is similar. -t http://www.chordpulse.com/ ---- CategoryMusic