Audio To play audio the PC needs a sound card, usually a 'Sound Blaster compatible' Sound Blaster Live! Sound Blaster PCI128 Sound Blaster PCI64 Ensoniq AudioPCI SoundImpa ct Monster Sound Monster Sound MX200 Monster Sound MX300 DSAC-600 Winner Sound Predator 3D XLerate Montego
A3D Montego II TeraSound A3D PCI Sound Image SonicStorm Apocalypse 5D Sonic Sonic Vortex2 Storm 3D Storm VX Storm Platinum WaveForce 192 3-D
Two major forms of digital music used • MIDI – stored as Midi files • Digital audio – stored as wave files (sound files) MIDI (Musical Instrument Digital Interface): It is a communication protocol: provide seamless communication links for musical instruments, i.e. complex networks of synthesisers of different manufacture and computer. Midi files contain sequences of instructions to play notes. The instructions are sent to some sound module which contains
hardware to convert the instruction into a sound. The sound module can be a soundcard itself or a musical instrument. The sound is then amplified (more hardware) and sent to loudspeakers. The whole system can be on the PC or spread (via the PC) to many different external instruments. Some instruments have the ability to play midi files directly without using the PC. The word MIDI is used as a general name for the system being used and you will hear people say 'the midi interface' meaning all the connections from the PC to the instruments Midi in midi out
CPU sound card software Drive PC
Disc with sound file
Instruments with midi outputs can write midi instruction directly to the PC file.
The MIDI network: It is a serial network, most commonly connected by 5-pin DIN plug. It is not possible to record and playback simultaneous notes through MIDI. The chords are perceived by striking the individual notes nearly simultaneously. To understand this let us consider the following example: MIDI messages are transmitted at a fixed rate of 31,250 bits per second (bps). A MIDI byte consists of 8 bits plus a start and stop bit for a total of 10 bits. At this rate the maximum number of 10 bit words that can be transmitted through a MIDI cable per second is 3,125. Thus the time required for the transmission of a MIDI byte is: 0.32 ms. We can hear time delays of 1-2 ms under optimal conditions. In a musical context we tend to hear time delay of 20-30 ms as being synchronous. A MIDI message containing on average 3 words takes approximately 0.96 ms, which is much higher (by about 10 times) than the threshold of 20-30 ms and therefore appears to be appearing simultaneously. MIDI connections: MIDI messages only travel in one direction. Thus for a synthesizer to have 2-way communication, it is necessary to have 2 MIDI cables connected to the In and Out ports. Set up 1: Basic connection of a master controller keyboard and a slave synthesizer:
MIDI out MIDI in
Set up 2: Connection involving a ‘Thru’ port
MIDI out MIDI in Slave Synthesizer 1 MIDI Thru MIDI in Slave Synthesizer 2
The ‘Thru’ port sends an exact copy of the data that arrives at the ‘In’ port and does not send data on its own. It is used to daisy-chain several MIDI devices together. Q: Can you guess what will happen if ‘Out’ of slave 1 is connected to the ‘In’ of slave 2? A: Nothing. Slave 2 will not receive any message from the master keyboard. The ‘Thru’ port would be the only way to pass along a copy of the data to slave 2. Some synthesizers only provide only In and Out ports. These types of instruments usually need to be instructed whether the Out port is a true Out or a Thru port. Set up 3: Involves multiple sound modules and a controller to a sequencer. Here the modules must be able to respond to both real-time keyboard data as well as playback of sequenced messages. The master keyboard will also need to respond to sequenced messages. Some keyboard controllers do not play any sound. These are only used to control other devices.
MIDI out MIDI interface
MIDI in Sound Module 2
MIDI Thru Sound Module 1
Midi Instructions 8 bit digital codes are generated to describe • the Pitch (or frequency) of a tone, • the duration of a tone, • the velocity (of the key) of a tone, • the sound (voice or patch no) of the tone (eg piano, violin, drum etc) • which instrument to play (channel no) and lots more The byte codes are either Status Bytes or Data bytes A Status byte is a command which describes the next communication setup status A Data byte sends info concerning the pitch and loudness of the tone. Typically a status byte would be followed by 2 data bytes Bit numbers in byte d7 d6 d5
Status byte is always 1xxxxxxx Data byte is always 0xxxxxxx ( x means a 'don't care' value) The codes are 8bit, each combination of bits have different meanings. In Status Byte Bits 6,5,4 ----001 = note on, (key pressed) 000 = note off (key released) 100 = change patch no. etc. Bits 3,2,1,0--0000 = channel 1 1111 = channel 16 (N.B. 0 channel is not used) Example: 10010100 means 'note ON channel 5' 10001111 means 'note OFF channel 16' In Data Byte Two data bytes, first sends tone, second sends velocity (usually interpreted as loudness) Example 1st 00111001 note A2 2nd 01111111 max velocity A Midi 3-byte Instruction Example 10010011 00111001 011111111
STATUS Tone ON Channel 4 In decimal it is
DATA DATA Tone A2 Play tone ( frequency 220Hz) at max velocity 165 57 127 7F
In hex It is 93 39 (much easier to work with)
Generating Midi Code All modern keyboard synthesisers will generate Midi code as they are played. The code generated can be stored in a sequence and editing by music software on the PC. Many different companies produce such softwaree.g. Cakewalk Pro Audio, Evolution Sound Studio, Steinberg Cubase VST, Opcode Vision. A sequencer merely records the midi code as it arrives and then lets you output the code after editing. The editor allows you to change the code, correct mistakes, change the sounds (patches) change the tempo etc. You can also create midi music directly in the editor ( the computer keyboard is used as the instrument) Studio software will let you move and mix recordings on a series of tracks (100s!).
Channels, Patches and GM There are only 16 channels but there are hundreds of patches (or voices) available. The programmer can patch a voice to a particular channel. So that midi files would sound the same on any sound module, the patch numbers in the General Midi Standard (GM) have been defined. (128 of them) eg 0 is an acoustic grand piano 35 is an electric bass Midi Files are small! Since a music sound can be started merely by using a 3 byte code, the amount of code to control 16 sounds at once is not large. Simple midi files operating only on one or two patches can produce many minutes of music in less than 100kB file [Compare this with less than 0.1seconds of CD quality music] Try this:e.g. Look at the midi files on your PC (all new PCs come preloaded with some music files) Use Start/Find/Files or Folders… and type in *.MID (try also *.RMI) When the list appears double-click it. The preloaded mediaplayer software will start to play. Note how long it plays for and then go back and see how big the file is by right-clicking on the file in the list and choose 'properties' .[ I have a 6minute Beethoven's 5th file of 90kB in my machine] Which piece of software is being used as your default player- is it ActiveMovie or Mediaplayer (or another)? Midi Interface
Serial data The binary code sent along a midi cable is serial data, i.e. one pulse at a time. It is important to recognise where the data is in the stream. Message has a start and stop bit + 8 data bits 5v lsb msb 0v 8 data bits Start bit Stop bit
A midi data stream consists of 10bits sent a rate of 31250 bits per second (32k). If a midi message is 2 or 3 of these, then more than 1042 separate music commands per second can be sent. Quite fast enough for all applications. Optical Isolation For safety reasons, midi connections are always optically
isolated from each other, i.e. no electric currents can flow from a faulty device to another device on the midi network. A twisted pair is used on a standard 5-pin DIN plug. Pins 4 and 5 are used (4 to 4, 5 to 5), pins 1 and 3 not used, and pin 2 is connected to the screen (which is NOT connected to the outer
shell of the plug. In this way interference and hums caused by earth loops are prevented Midi Interfaces
Most soundcards have a MIDI in/out socket but this limits you to one MIDI device (although MIDI devices have "Midi thru" sockets allowing a Daisy chain of devices, these can be troublesome as one device may delay transferring the signal to the next device and separate control of each device is more complex) Most sound cards are SoundBlaster compatible and will have a built-in MIDI interface that is accessible through the sound card’s gameport/joystick receptacle. Check the documentation that came with your particular sound card. (It will probably refer to "MPU401" or "MPU401 UART" compatibility. If there is no mention of this, then you most likely won’t be able to use the sound card for your MIDI applications and you will need to purchase a separate MIDI interface.) Even though your sound card may have the built-in MIDI interface, the manufacturer rarely includes the gameport-to-MIDI adapter cable necessary for actually connecting your computer to your MIDI keyboard instrument!
Below is professional multiport MIDI interface with 8 I/O connectors Note that a dedicated MIDI interface does not have any sound capabilities (the sound must come from a sound module on a soundcard or in the instruments connected. Sound from Sounndcards When Midi files are sent to a sound module, the sound you hear is totally dependent on the way the sound is generated on the card. We have Wavetable or FM FM Older cheaper cards have sound synthesis which uses Frequency Modulation techniques, (an FM chip does the work) to attempt to produce different voices. Different frequencies are added together to produce a harmonic sound like the voice required. There is additive synthesis and subtractive synthesis. This is limited but better than nothing. Sounds like an old synthesiser. Wavetable Sound Available on better more expensive soundcards. This is where a digital recording of a real sound is made by sampling (later). The different voices therefore sound exactly like the voices intended. Technical Summary MIDI is an asynchronous serial interface. The baud rate is 31.25 Kbaud (+/- 1%). There is 1 start bit, 8 data bits, and 1 stop bit (ie, 10 bits total), for a period of 320 microseconds per serial byte.
The MIDI circuit is current loop, 5 mA. Logic 0 is current ON. One output drives one (and only one) input. For safety and to avoid grounding loops and subsequent data errors, the input is opto-isolated. More about MIDI Soundcards with a MIDI facility often use the same connector as the Joystick/Game controller. Usually called the Joystick port or the Game port The standard MIDI connector is a 5pin DIN whereas the Joystick connector is a 15 pin D-type (delta) connector
5 pin DIN
15 pin D-type
An adaptor is required to convert one to the other. The midi hardware which controls the transmission and reception of all midi signals used inside all soundcards or standalone midi interfaces is called the MPU-401 UART(this might be integrated into more complex hardware processors) MPU -midi processing unit UART-universal asynchronous receiver/transmitter An asynchronous data link is one, which transmits data without a synchronising clock signal. A clock signal is one, which ticks at an exact rate to indicate when a piece of data is ready (the clock is synchronised with the data)
MIDI Sequencing Software The software sequencer and editor can display MIDI music files as either • 'Piano Roll' • 'Notation' (traditional music stave) • 'Event list' (overview instrument events) • Music Console for mixing different instrument volumes and sound effects This gives (almost) unlimited control over the music content Mistakes can be corrected, timing problems adjusted, instruments sound changed, drum rhythms added, echo and other sound effects (FX) added. Although there is a limit on 16 channels being used simultaneously, each channel can take on different instrument sounds at different times, allowing a musical composition of hundreds of instruments in one midi file. e.g. A channel controlling a trumpet solo, may change to controlling a saxophone, provided that the two instruments do not play together. Midi Clock, Midi Time Code (MTC) and SMPTE MIDI Clock The tempo of a song is set by sending MIDI clock messages, which are timed to the beat of the music. The MIDI clock runs at 24 times the quarter note (crotchet) rate. If the tempo is 90 Beats per minute, the MIDI clock runs at 90x24 = 2160 clocks per minute ( or 36 per second) The position in a song can be referenced to the MIDI clock count, which starts at zero at the start of the song.
MTC and SMPTE If the music needs to to be synchronised with a video or film sequence then an absolute time clock is needed, referenced to real time. This has become a necessity with MIDI sound being used in the film industry. MTC is the MIDI version of the FILM/TV time-stamping technique. SMPTE (pronounced "simpty" was developed by the Society of Motion Picture and Television Engineers. MTC involves sending bytes of data to precisely indicate the time in hours:minutes:seconds:frames (here, the frame number is one of 24, 25 or 30 frames per second used in video and film standards)
Soundcards --what do they look like? A Roland Soundcard is shown here on the left. It has audio input
and output sockets (usually coloured) and standard MIDI IN and OUT sockets. It also has an extra multiway connector which would be connected inside the PC to a daughterboard (an extra add-on card) which contain extra wavetable sounds for the sound module and sound FX.
The SoundBlaster Live (approximately £50) shown above on the right contains a full MIDI interface and a 1024-voice Wavetable and is bundled (usually) with lots of useful music creation software.