PROJECT REPORT Audio Signal transmission and Computer interfacing Submitted by :ARS Preface It gives me immense pleasure to present my project that was done at RaneTRW, Power Steering Systems Ltd through this report. The project was conducted in a structured framework under the guidance of engineers working in the Gear Assembly section of (PR & P division). The Gear Assembly section containing six assembly lines that have the capable of simultaneously assembling and testing gear components is at a distance of 70m (approx) from the HR division.
Complaints and queries arising in the Assembly section require to be addressed to the HR division as soon as possible. In order to do that, a transmitter and receiver set up required to be created. This enables the transmission of complaints in the form of audio signals which is to be recorded at the reception end for later retrieval. The report gives a detailed description of the steps involved in choice of mode of transmission, creation of a transmitter and receiver set up and computer interfacing done at the HR division.
With this report, I intend to share the knowledge that I acquired during my project work. I have made a sincere attempt to make this report a simple, informative and useful one. I thank one and all for making this project a successful endeavor. CONTENTS Preface Acknowledgement • Aim • Introduction • Modes of transmission • Mode selection • The Design in stages • Working model analysis • Scope for improvement Aim of the project To create a transmitter and receiver set up which enables transmission of a complaint in the form of an audio signal over a distance of 80 m.
The signal obtained at the receiver end must be interfaced with the help of a computer so as to facilitate the storage and later retrieval of the transmitted data. Introduction to the communication process Communication is the process of sending information to oneself or another entity. Specialized fields focus on various aspects of communication, and include Mass Communication, Communication Studies, Organizational Communication, Sociolinguistics, Conversation Analysis, Cognitive Linguistics, Linguistics, Pragmatics, Semiotics, and Discourse Analysis.
The wide range of theories about communication makes summarization difficult. However, a basic model of communication describes communication as a five-step output-input process that entails a sender’s creation (or encoding) of a message, and the message’s transmission through a channel or medium. This message is received and then interpreted. Finally this message is responded to, which completes the process of communication. This model is based on a model of signal transmission known as the Shannon-Weaver model.
A related model can be seen in the work of Roman Jacobson. Communication mediums can be broadly classified into two. Analog telecommunications include traditional Telephony, radio, and TV broadcasts whereas digital telecommunications allow for computer-mediated communication, telegraphy, and computer networks. Modes of transmission of audio signals In the following given case, complaints are said to be registered in the form of audio signals. The transmission, storage and handling of these audio signals is also known as Audio signal processing.
Audio signal processing, sometimes referred to as audio processing, is the processing of a representation of auditory signals, or sound. The representation can be digital or analog. An analog representation is usually electrical. A voltage level represents the air pressure waveform of the sound. Similarly, a digital representation expresses the pressure wave-form as a sequence of symbols, usually binary numbers, which permits digital signal processing. The focus in audio signal processing is most typically a mathematical analysis of which parts of the signal are audible.
For example, a signal can be modified for different purposes such that the modification is controlled in the auditory domain. Which parts of the signal are heard and which are not, is not decided merely by physiology of the human hearing system, but very much by psychological properties. Classification of modes of transmission Transmission modes are classified as follows: 1. Wireless transmission a. Radio frequency transmission b. Walkie talkie systems c. Cell phone networks d. Blue tooth technique 2.
Transmission via cables a. Local area network(LAN) b. Telephone connections Following is a brief description of each of the above-mentioned modes of audio signal transmission. 1 a Radio frequency transmission Radio frequency, or RF, refers to that portion of the electromagnetic spectrum in which electromagnetic waves can be generated by alternating current fed to an antenna. Such frequencies account for the following parts of the spectrum shown in the table below. Radio frequency spectrum Band name |Abbr |ITU band |Frequency |Example uses | | | | |Wavelength | | | | | |< 3 Hz | | | | | |> 100,000 km | | |Extremely low |ELF |1 |3–30 Hz |Communication with submarines | |frequency | | |100,000 km – 10,000 km | | |Super low frequency |SLF |2 |30–300 Hz |Communication with submarines | | | | |10,000 km – 1000 km | | |Ultra low frequency |ULF |3 |300–3000 Hz |Communication within mines | | | | |1000 km – 100 km | | |Very low frequency |VLF |4 |3–30 kHz |Submarine communication, avalanche beacons, wireless | | | | |100 km – 10 km |heart rate monitors | |Low frequency |LF |5 |30–300 kHz |Navigation, time signals, AM long wave broadcasting | | | | |10 km – 1 km | | |Medium frequency |MF |6 |300–3000 kHz |AM (Medium-wave) broadcasts | | | | |1 km – 100 m | | |High frequency |HF |7 |3–30 MHz Shortwave broadcasts and amateur radio | | | | |100 m – 10 m | | |Very high frequency |VHF |8 |30–300 MHz |FM and television broadcasts | | | | |10 m – 1 m | | |Ultra high frequency |UHF |9 |300–3000 MHz |television broadcasts, mobile phones, wireless LAN, | | | | |1 m – 100 mm |ground-to-air and air-to-air communications | |Super high frequency |SHF |10 |3–30 GHz |microwave devices, mobile phones (W-CDMA), WLAN, most | | | | |100 mm – 10 mm |modern Radars | |Extremely high |EHF |11 |30–300 GHz |Radio astronomy, high-speed microwave radio relay | |frequency | | |10 mm – 1 mm | | | | | |Above 300 GHz |Night vision | | | | |< 1 mm | |
Above 300 GHz, the absorption of electromagnetic radiation by Earth’s atmosphere is so great that the atmosphere is effectively opaque to higher frequencies of electromagnetic radiation, until the atmosphere becomes transparent again in the so-called infrared and optical window frequency ranges. The ELF, SLF, ULF, and VLF bands overlap the AF (audio frequency) spectrum, which is approximately 20–20,000 Hz. However, sounds are transmitted by atmospheric compression and expansion, and not by electromagnetic energy. The SHF and EHF bands are often considered to be not part of the radio spectrum and form their own microwave spectrum. Named frequency bands General Broadcast Frequencies: AM Radio = 535kHz – 1605kHz (MF) TV Band I (Channels 2 – 6) = 54MHz – 88MHz (VHF)
FM Radio Band II = 88MHz – 108MHz (VHF) TV Band III (Channels 7 – 13) = 174MHz – 216MHz (VHF) TV Bands IV & V (Channels 14 – 69) = 512MHz – 806MHz (UHF) Amateur radio frequencies The range of allowed frequencies vary between countries. These are just some of the more common bands. In the article about amateur radio is another list. |Band |Frequency range | |160 m |1. 815 to 1. 89 MHz | |80 m |3. 5 to 3. 8 MHz | |40 m |7 to 7. 1 MHz | |30 m |10. 1 to 10. 15 MHz | |20 m |14 to 14. 35 MHz | |15 m |21 to 21. 45 MHz | |12 m |24. 89 to 24. 99 MHz | 10 m |28. 0 to 29. 7 MHz | |6 m |50. 08 to 51 MHz | |2 m |144 to 148 MHz | |70 cm |430 to 440 MHz | |23 cm |1240 to 1300 MHz | 1 b Walkie-talkie systems A walkie-talkie is a portable, bi-directional radio transceiver, first developed for military use. Major characteristics include a half-duplex (only one can receive and transmit at a time) channel and a push-to-talk switch that starts transmission. The typical physical format looks somewhat like a telephone handset, possibly slightly larger but still a single unit, with an antenna sticking out of the top.
Where a phone’s earpiece is only loud enough to be heard by the user, a walkie-talkie’s built-in speaker can be heard by the user and those in his immediate vicinity. Hand-held transceivers became valuable communication tools for police, emergency services, and industrial and commercial users, using frequencies assigned for these services. Low-power versions, exempt from license requirements, are also popular children’s toys. Prior to the change of CB radio from licensed to un-licensed status, the typical toy walkie-talkie available in retail stores in North America was limited to 100 milli watts of power on transmit and the 27 MHz citizens’ band channels.
Other toy walkie-talkies operate in the 49 MHz band shared with cordless phones and baby monitors; typically these devices are very crude electronically and may lack even a volume control, though they may have elaborate packaging. Unlike telephones, low-cost toy walkie-talkies do not have separate microphones and speakers; the speaker is typically used as a microphone while in transmit mode. The first radio receiver/transmitter to be nick-named “Walkie-Talkie” was the backpacked Motorola SCR-300, created by an engineering team in 1940 at the Galvin Manufacturing Company consisting of Dan Noble, who conceived of the design using FM technology, Henryk Magnuski who was the principal RF engineer, Marion Bond, Lloyd Morris, and Bill Vogel. Motorola also produced the hand-held AM SCR-536 radio during the war, and it was called the “Handie-Talkie” (HT).
Canadian Al Gross also worked on the early technology behind the walkie-talkie between 1934 and 1941, and is sometimes said to actually have invented it. The personal walkie-talkie has now become popular again with the Family Radio Service. FRS operates in the GMRS band, which is also used for business walkie-talkies and mobile radios. While FRS walkie-talkies are popular toys, they are also a useful communication tool for business and personal use. 1 c Mobile phones A mobile phone or cellular (cell) phone is an electronic telecommunications device. Most current mobile phones connect to a cellular network of base stations (cell sites), which is in turn interconnected to the public switched telephone network (PSTN) (the exception are satellite phones).
Cellular networks were first introduced in the early to mid 1980s (the 1G generation). Prior mobile phones operating without a cellular network (the so-called 0G generation), such as Mobile Telephone Service, date back to 1946. Until the mid to late 1980s, most mobile phones were sufficiently large that they were often permanently installed in vehicles as car phones. With the advance of miniaturization, currently the vast majority of mobile phones are handheld. In addition to the standard voice function of a telephone, a mobile phone can support many additional services such as SMS for text messaging, packet switching for access to the Internet, and MMS for sending and receiving photos and video.
Some of the world’s largest mobile phone companies include Alcatel, Audiovox, BenQ-Siemens, Dopod, Fujitsu, Kyocera, LG, Motorola, NEC, Nokia, Panasonic (Matsushita Electric), Pantech Curitel, Philips, Sagem, Samsung, Sanyo, Sharp, SK Teletech, Sony Ericsson, and Toshiba. The mobile phone has become ubiquitous because of the interoperability of mobile phones across different networks and countries. This is due to the equipment manufacturers working to meet one of a few standards, particularly the GSM standard which was designed for Europe-wide interoperability. All European nations and most Asian and African nations adopted it as their sole standard. In other countries, such as the United States, Japan, and South Korea, legislation does not require any particular standard, and GSM coexists with other standards, such as CDMA and iDen. Technology:
Mobile phones and the network they operate under vary significantly from provider to provider, and even from nation to nation. However, all of them communicate through electromagnetic radio waves with a cell site base station, the antennas of which are usually mounted on a tower, pole, or building. The phones have a low-power transceiver that transmits voice and data to the nearest cell sites, usually . 5 to 8 miles (0. 8 to 13 kilometres) away. When the cellular phone or data device is turned on, it registers with the mobile telephone exchange, or switch, with its unique identifiers, and will then be alerted by the mobile switch when there is an incoming telephone call.
The handset constantly listens for the strongest signal being received from the surrounding base stations. As the user moves around the network, the mobile device will “handoff” to new cell sites. Cell sites have relatively low-power (often only one or two watts) radio transmitters which broadcast their presence and relay communications between the mobile handsets and the switch. The switch in turn connects the call to another subscriber of the same wireless service provider or to the public telephone network, which includes the networks of other wireless carriers. Security concerns: Early mobile phones were limited in their security features.
Some problems with these models were “cloning”, a variant of identity theft, and “scanning” whereby third parties in the local area could intercept and eavesdrop in on calls. Analogue phones could also be listened to on some radio scanners. Although more recent digital systems (such as GSM) have attempted to address these fundamental issues, security problems continue to persist. Vulnerabilities (such as SMS spoofing) have been found in many current protocols that continue to allow the possibility of eavesdropping or cloning. 1 d Blue tooth technique Blue tooth is an industrial specification for wireless personal area networks (PANs), also known as IEEE 802. 15. 1.
Bluetooth provides a way to connect and exchange information between devices like personal digital assistants (PDAs), mobile phones, laptops, PCs, printers and digital cameras via a secure, low-cost, globally available short range radio frequency. The name Bluetooth was born from the 10th century king of Denmark, King Harold Bluetooth (whose surname is sometimes written as Bluetooh), who engaged in diplomacy which led warring parties to negotiate with each other. The inventors of the Bluetooth technology thought this a fitting name for their technology which allowed different devices to talk to each other. Bluetooth is a radio standard primarily designed for low power consumption, with a short range (power class dependent: 1 meter, 10 meters, 100 meters) and with a low-cost transceiver microchip in each device.
Bluetooth lets these devices communicate with each other when they come in range, even if they are not in the same room, as long as they are within up to 100 meters of each other, dependent on the power class of the product. Products are available in one of three power classes: |Class |Power |Power |Range | | |(mW) |(dBm) |(approximate) | |Class 1 |100 mW |20 dBm |~100 meters | |Class 2 |2. 5 mW |4 dBm |~10 meters | |Class 3 |1 mW |0 dBm |~1 meter | Communication & connection A Bluetooth device playing the role of the “master” can communicate with up to 7 devices playing the role of the “slave. This network of “group of up to 8 devices” (1 master + 7 slaves) is called a piconet. At any given time, data can be transferred between the master and 1 slave; but the master switches rapidly from slave to slave in a round-robin fashion. (Simultaneous transmission from the master to multiple slaves is possible, but not used much in practice). Either device may switch the master/slave role at any time. Bluetooth specification allows connecting 2 or more piconets together to form a scatternet, with some devices acting as a bridge by simultaneously playing the master role in one piconet and the slave role in another piconet. These devices have yet to come, though are supposed to appear next year (2007).
Setting up connections Any Bluetooth device will transmit the following sets of information on demand: Device Name Device Class List of services Technical information eg: device features, manufacturer, Bluetooth specification, clock offset Security measures Bluetooth uses the SAFER+ algorithm for authentication and key generation. The E0 stream cipher is used for encrypting packets. This makes eavesdropping on Bluetooth-enabled devices more difficult. 2 a Local area network A local area Network (LAN) is a computer network covering a small local area, like a home, office, or small group of buildings such as a home, office, or college.
Current LANs are most likely to be based on switched Ethernet or Wi-Fi technology running at 10, 100 or 1,000 Mbit/s (1,000 Mbit/s is also known as 1 Gbit/s). The defining characteristics of LANs in contrast to WANs (wide area networks) are: a) much higher data rates, b) smaller geographic range – at most a few kilometers – and c) they do not involve leased telecommunication lines. “LAN” usually does not refer to data running over local analog telephone lines, as on a private branch exchange (PBX). Technical aspects Although switched Ethernet is now most common at the physical layer, and TCP/IP as a protocol, historically many different options have been used (see below) and some continue to be popular in niche areas.
Larger LANs will have redundant links, and routers or switches capable of using spanning tree protocol and similar techniques to recover from failed links. LANs will have connections to other LANs via routers and leased lines to create a WAN. Most will also have connections to the large public network known as the Internet, and links to other LANs can be ‘tunnelled’ across this using VPN technologies. Roots In the days before personal computers, a site might have just one central computer, with users accessing this via computer terminals over simple low-speed cabling. Networks such as IBM’s SNA (Systems Network Architecture) were aimed at linking terminals or other mainframes at remote sites over leased lines—hence these were wide area networks.
The first LANs were created in the late 1970s and used to create high-speed links between several large central computers at one site. Of many competing systems created at this time, Ethernet and ARCNET were the most popular. In reality the concept was marred by proliferation of incompatible physical layer and network protocol implementations, and confusion over how best to share resources. Typically each vendor would have their own type of network card, cabling, protocol, and network operating system. A solution appeared with the advent of Novell NetWare which gave: (a) even-handed support for the 40 or so competing card/cable types, and (b) a much more sophisticated operating system than most of its competitors.
NetWare dominated the personal computer LAN business from early after its introduction in 1983 until the mid 1990s when Microsoft introduced Windows NT Advanced Server and Windows for Workgroups. Of the competitors to NetWare, only Banyan Vines had comparable technical strengths, but Banyan never gained a secure base. Microsoft and 3Com worked together to create a simple network operating system which formed the base of 3Com’s 3+Share, Microsoft’s LAN Manager and IBM’s LAN Server. None of these was particularly successful. In this same timeframe Unix computer workstation from vendors such as Sun Microsystems, Hewlett-Packard, Silicon Graphics, Intergraph, NeXT and Apollo were using TCP/IP based networking.
Although this market segment is now much reduced, the technologies developed in this area continue to be influential on the Internet and in both Linux and Apple Mac OS X networking. The TCP/IP protocol has now almost completely replaced IPX, AppleTalk, NETBEUI and other protocols used by early PC LANs. 2 b Communication via telephones The telephone or phone is a telecommunications device which is used to transmit and receive sound (most commonly voice and speech) across distance. Most telephones operate through transmission of electric signals over a complex telephone network which allows almost any phone user to communicate with almost any other.
An elementary telephone system would consist of three elements: the equipment located at each subscriber which converts sound to electrical signals and back, and which allows the subscriber to answer or initiate a call, a central switching facility which interconnects all the subscribers wiring or other means to connect the subscriber to the central switching facility. There are three principal ways a subscriber may be connected to the telephone network: Historically, and still very commonly, by dedicated physical wire connections run in overhead or underground cables; By radio, as in a cordless, cellular, satellite or radiotelephone and By voice over internet protocol (VoIP) telephones, which use broadband internet connections.
Between end users, transmissions across a network may be carried by fiber optic cable, land line cable, point to point microwave or satellite relay. Until relatively recently, a “telephone” generally referred only to landlines. Cordless and mobile phones are now common in many places around the world, with mobile phones expected to gradually displace the conventional landline telephone. Unlike a mobile phone, a cordless telephone is considered to be landline because it is only useable within a short distance of a small personal or domestic base station connected to a fixed phone line. Digital Telephony The Public Switched Telephone Network (PSTN) has gradually evolved towards digital telephony which has improved the capacity and quality of the network.
End-to-end analog telephone networks were first modified in the 1970s by upgrading long-haul transmission networks with SONET technology and fiber optic transmission methods. Digital transmission made it possible to carry multiple digitized switched circuits on a single transmission medium (known as multiplexing). While today the end instrument remains analog, the analog signals reaching the aggregation point (Serving Area Interface (SAI) or the central office (CO) ) are typically converted to digital signals. Digital loop carriers (DLC) are often used, placing the digital network ever closer to the customer premises, relegating the analog local loop to legacy status. Wireless phone systems
While the term “wireless” means radio and can refer to any telephone that uses radio waves, it is primarily used for cell phones. In the United States wireless companies tend to use the term wireless to refer to a wide range of services while the cell phone itself is called a mobile phone, mobile, PCS phone, cell phone or simply cell with the trend now moving towards mobile. The changes in terminology is partially due to providers using different terms in marketing to differentiate newer digital services from older analog systems and services of one company from another. Cordless telephones Cordless telephones, first invented by Teri Pall in 1965, consist of a base unit that connects to the land-line system and also communicates with remote handsets by low power radio.
This permits use of the handset from any location within range of the base. Because of the power required to transmit to the handset, the base station is powered with an electronic power supply. Thus, cordless phones typically do not function during power outages. Initially, cordless phones used the 1. 7 MHz frequency range to communicate between base and handset. Because of quality and range problems, these units were soon superseded by systems that used frequency modulation (FM) at higher frequency ranges (49 MHz, 900 MHz, 2. 4 GHz, and 5. 8 GHz). The 2. 4 GHz cordless phones can interfere with certain wireless LAN protocols (802. 11b/g) due to the usage of the same frequencies. On the 2. GHz band, several “channels” are utilized in an attempt to guard against degradation in the quality of the voice signal due to crowding. The range of modern cordless phones is normally on the order of a few hundred meters. Selection of an appropriate mode of transmission: Selection of mode of transmission has to be done based on the following considerations: • Clarity • Noise interference • Security • Cost • Range of implementation • Ease of interfacing Clear and uninterrupted transmission is the most important pre-requisite for communication. Clarity in the signal being transmitted is important as well. Signal to noise ratio is to be maintained high while transmitting the audio signal.
In case of data transmission data compression rates and baud rates are to be taken into consideration. Information being transmitted must not be accesible to anyone other than the licensed transmitter and the chosen receiver. These requirements eliminate AM and telephone line transmissions right away, as these are least secure. The project required creating a setup that transmits audio signals upto max 100m. Taking the above factors into consideration Radio frequency method of wireless transmission was chosen. Though a walkie talkie system is secure and effective , it was not chosen due to cost consideration and interfacing problems . The Design in Stages [pic]
Stage 1: Stage one is the transmission stage where in complaints In the form of audio signals must be converted to a particular frequency in the radio frequency range. The frequency of transmission selected must not over lap with the frequency of a radio channel. Frequency of transmission can be varied by varying the inductor value in the transmittor circuit, untill the required conditions are met and transmission is smooth and uninterrupted. Stage 2: Stage 2 is the audio signal reception stage.
This involves creation Of a receiver setup that receives the transmitted signals Efficiently. The reciever required in this case need not work over a wide range of frequencies. It is however necessary to keep it tuned at the transmitting frequency. In the absence of repeaters during transmission the receiver must contain appropriate amplifiers to work with the attenuated incoming signals. Stage 3: In the interfacing stage the amplified signals from the receiver are fed into a computer using either a USB port or a socket fixed in the audio in pin.
A Visual Basic code monitors the recording and storage of these audio signals. Stage 1 Short range low power RF transmitter It is designed to use an input from a sound source (microphone), and transmits on the commercial FM band – it is quite powerful, hence should not be used to transmit anything sensitive – it could easily be picked up from several hundred meters away. The FM band is 88 to 108MHz, and although it is getting fairly crowded nearly everywhere, you should still be able to find a blank spot on the dial. The following given circuit works anywhere in the commercial range but is tuned to transmit at a particular frequency only. Circuit Description
In the circuit shown in the next page the first stage is the oscillator, and is tuned with the variable capacitor. An unused frequency 104. 8 is selected by carefully adjusting C3 until the background noise stops. (FM receiver’s mute circuit is disabled to hear this). Because the trimmer cap is very sensitive, final frequency adjustment is made on the receiver. The rotor of C3 is ensured to be connected to the +9V supply while assembling the circuit,. This ensures that there will be minimal frequency disturbance when the screwdriver touches the adjustment shaft. A small piece of non copper-clad circuit board can be used to make a screwdriver – this will not alter the frequency.
The frequency stability is improved considerably by adding a capacitor from the base of Q1 to ground. This ensures that the transistor operates in true common base at RF. A value of 1nF (ceramic) as shown is suitable, and will also limit the HF response to 15 kHz – this is a benefit for a simple circuit like this, and even commercial FM is usually limited to a 15 kHz bandwidth Circuit [pic] Capacitors All capacitors must be ceramic (with the exception of C1), with C2 and C6 preferably being N750 (Negative temperature coefficient, 750 parts per million per degree Celsius). The others should be NPO types, since temperature correction is not needed (nor is it desirable).
The frequency stability of the circuit is similar to that with all simple transmitters. Inductors The inductors are nominally 10 turns (actually 9. 5) of 1mm diameter enameled copper wire. They are close wound on a 3mm diameter former, which is removed after the coils are wound. The enamel where the coil ends that will go through the board is carefully scraped- all the enamel must be removed to ensure good contact. Figure 2 shows a detail drawing of a coil. The coils should be mounted about 2mm above the board. The inductors are critical, and must be wound exactly as described, or the frequency will be wrong. [pic] Figure 2 – Detail of L1 and L2
The nominal (and very approximate) inductance for the coils is about 130nH. This is calculated according to the formula L = N? * r? / (228r + 254l) Where L = inductance in micro henries (uH), N = number of turns, r = average coil radius (2. 0mm for the coil as shown), and l = coil length. All dimensions are in millimeters. Working Q1 is the oscillator, and is a conventional Colpitts design. L1 and C3 (in parallel with C2) tune the circuit to the desired frequency, and the output (from the emitter of Q1) is fed to the buffer and amplifier Q2. This isolates the antenna from the oscillator giving much better frequency stability, as well as providing considerable extra gain.
L2 and C6 form a tuned collector load, and C7 helps to further isolate the circuit from the antenna, as well as preventing any possibility of short circuits should the antenna contact the grounded metal case that would normally be used for the complete transmitter. The audio signal applied to the base of Q1 causes the frequency to change, as the transistor’s collector current is modulated by the audio. This provides the frequency modulation (FM) that can be received on any standard FM band receiver. The audio input must be kept to a maximum of about 100mV, although this will vary somewhat from one unit to the next. Higher levels will cause the deviation (the maximum frequency shift) to exceed the limits in the receiver – usually ±75kHz.
With the value shown for C1, limits the lower frequency response to about 50Hz (based only on R1, which is somewhat pessimistic) – if you need to go lower than this, then use a 1uF cap instead, which will allow a response down to at least 15Hz. C1 may be polyester or Mylar, or a 1uF electrolytic may be used, either bipolar or polarized. If polarized, the positive terminal must connect to the 10k resistor. The drawback of the circuit, is not knowing if the frequency is oscillating, since the frequency is outside the range of most simple oscilloscopes. A simple RF probe can indicate a useful signal at the antenna. If so, then you know it oscillates, and just have to find out at what frequency.
This may require the use of an RF frequency counter if the FM band cannot be located directly. PreEmphasis and deemphasis circuits There are two standards for it. Time constant of 50us is used. This represents a frequency of 3183Hz. This is the 3dB point of a simple filter that boosts the high frequencies on transmission and cuts the same highs again on reception, restoring the frequency response to normal, and reducing noise. The simple transmitter above does not have this built in, so it can be added to the microphone preamp or line stage buffer circuit. These are both shown in Figure 3(below), and are of much higher quality than the standard offerings in most other designs.
Rather than a simple single transistor amp, using a TL061 opamp gives much better distortion figures and more predictable output impedance to the transmitter. The gain control (for either circuit) can be an internal preset, or a normal pot to allow adjustment to the maximum level without distortion with different signal sources. The 100nF bypass capacitors must be ceramic types, because of the frequency. The mic preamp has a maximum gain of 22, giving a microphone sensitivity of around 5mV. The line preamp has a gain of unity, so maximum input sensitivity is 100mV. Appropriate capacitor value for pre-emphasis is selected depending on the location.
The pre-emphasis is quite good enough for the uses that a low power FM transmitter will be put to. PreEmphasis circuit: [pic] DeEmphasis circuit: [pic] Microphone for audio input: An electrical micro phone powered by 1. 5V cell is used . The micro is not uncalibrated , however it can still be used to great effect as a measurement mic with any loudspeaker for very high quality recordings. Wires soldered along with the microphones are used as leads that are connected one to the input the other to the ground. These connections too are made by using the solder and an iron. Stage 2 Stage 2 required a long distance receiver set up. Since the transmission was done in radio frequency range (at 104. Hz) a simple fm receiver served the purpose. A radio receiver has built in amplifiers that amplify the weak signal received from the transmission station 80 meters away. Noise in and around the set up affects signal reception. Hence the location of the receiver must be carefully chosen. Signal reception depends on the following: • Signal to noise ratio • Positioning of receiver • Power of antenna • Integration • Accumulator attenuation • Enhancement Signal to noise ratio: A microphone is taken and connected to an oscilloscope (or PC with a sound card and a sound recording program (which acts as a receiver temporarily)). This is put a few centimeters away from the microphone.
When the emitter is switched off, the oscilloscope will show a straight line, no signal: When the emitter is switched on, the oscilloscope will shows a sine wave. When the emitter is placed two times further from the microphone, the signal shown by the oscilloscope will be two times weaker: In order to still see the signal clearly, amplification of the signal in oscilloscope maybe required. Thus as we keep increasing the distance and making the oscilloscope amplify the signal the signal remains clearly visible, whatever the distance. This is the ideal case but once we put the emitter, say 5 meters away from the microphone and the amplification has become relatively important, we see the noise appear. Hence even when the emitter is off we see a distorted signal appearing in the oscilloscope.
And this is what it shows when the emitter is on a distorted sine wave appears. The emitter may be on or off, it makes no difference. The noise remains the same. When the emitter is on, the sine wave simply adds itself to the noise. Noise cannot be avoided. It is always present but in some cases it is very weak, and hence appears as if it is not there. It becomes visible once we amplify it. The key is the intensity of the signal versus the intensity of the noise. That’s why we use the concept of signal/noise ratio. The signal/noise ratio is a number. You obtain this number by dividing the number of the measure of the intensity of the signal by the number of the measure of the intensity of the noise.
For example when the emitter was at a distance of 40 meters, the intensity of the signal was 0. 25 and the intensity of the noise was 1. The signal/noise ratio was thus 0. 25. Using amplifiers and signal repeaters clearer signal is obtained. Positioning of receiver In a noisy environment even if the receiver is placed close enough we may not be able to hear the sound of the emitter. But, if the immediate environment is less noisy then we may be able to easily increase the range of transmission. There is only one drawback on increasing ranges of transmission may be the slowing down of communication. Thus the receiver must be kept at an optimum distance so as to receive quickly and effectively. Integration
To determine the presence of the signal when the signal/noise ratio is a lot less than it is required to cut what is received in exact pieces and make the sum of those pieces. For example there are 4 periods of sine wave, each of these 4 periods are cut away from each other. They are then superimposed on each other. Finally the result is divided by four. This technique weakens the noise by 4 times. In the process signal/noise ratio has been increases by two. When we make the sum of n periods, the signal/noise ratio is increased by a factor n. A sum of periods is a very important object. It tells us if the sine wave was there or if it was not there. That allows us for example to transmit Morse code.
Here are the results of 27 successive results of sums calculated by a receiver. Accumulator attenuation At the beginning of a series of transmission periods, an accumulator is set to null. Then, each period received is added to the accumulator. Ones n periods have been received and added, the content of the accumulator is looked at. If it draws a sine period, we state the signal was on. If it draws pure noise, we state there was no signal. (Or we measure the size of the sine. ) Commonly used method to implement this is as follows. The accumulator is never set to null. Each period received is added to it, then the content of the accumulator is shrinked a little bit (it is multiplied by 0. 999, say).
The content of the accumulator is looked at continuously. If it draws a sine period, we state the signal is on. If it draws pure noise, or a too little sine period, we state there is no signal. (Or we measure the size of the sine. ) Simple electronic receivers that use a rudimentary LC circuit as their heart work that way naturally. The LC circuit (one capacitor and one self latched together) works as a resonator: if it receives pure noise, it will just oscillate a little bit at low amplitude. But if the noise contains a signal that has the same frequency as the resonance frequency of the circuit then the circuit will begin resonating and will thus oscillate at higher and higher amplitude.
When the amplitude reaches a given threshold a transistor will be triggered to produce output. The LC circuit acts as a memory that sums the oscillations. Enhancement A device is added to the receiver to obtain as much as possible only the signal coming from the direction of the emitter. Instead of using a parabolic antenna several antennas can be used and their signals can be summed up in the end. Bigger the device more the directivity. Enhancement can be done by • Reduction of the internal noise of the receiver • Increase of the emitted power • Increase of the received power Receiver circuit: [pic] Regenerative circuit is employed in the receiver circuit that is used.
This offers selectivity and sensitivity far beyond that available from a crystal radio receiver. The regenerative radio receiver operation is by carefully controlling positive feedback. This also allowed the receiver to oscillate. The regenerative receiver is theoretically as sensitive as any radio can be, however, the adjustments are critical, and must be made carefully. Operating limits: Quality of a receiver is defined by its sensitivity and selectivity. For a single-tank TRF (tuned radio frequency) receiver without regenerative feedback, bandwidth = frequency/Q, where Q is tank “quality” defined as Q=Z/R, Z is reactive impedance, R is resistive loss. Signal voltage at tank is antenna voltage multiplied by Q.
Positive feedback compensates the energy loss caused by R, so we may express it as bringing in some negative R. Quality with feedback is Qreg = Z/(R-Rneg). Regeneration rate is M = Qreg/Q = R/(R-Rneg). M depends on stability of amplification and feedback coefficient, because if R-Rneg is set less than Rneg fluctuation, it will easily overstep the oscillation margin. This problem can be partly solved by “grid leak” or any kind of automatic gain control, but the downside of this is surrendering control over receiver to noises and fading of input signal, which is undesirable. Note that modern semiconductors offer much more stability than vacuum tubes of the 1920s.
The super regenerative receiver uses a quenching oscillator to produce very high positive regeneration of the radio amplifying stage, while quenching or keying the built up regenerative oscillation at an ultrasonic rate. This further improves the gain of the receiver while simplifying adjustment. On the other hand, a super regenerative system has an inherent contradiction limiting its use to relatively free and clear bands. Due to Nyquist’s theorem its quenching frequency must be at least twice the signal bandwidth. Thus the overall bandwidth of super regenerator cannot be less than 4 times that of the quench frequency, assuming the quenching oscillator produces an ideal sine wave. STAGE 3
Visual Basic code for audio signal recording Title: Audio Recorder 2. 0 Description: Audio Recorder is a program for recording sound. You can select the bit rate, 8/16 bits and stereo/mono. It is possible to make a manual recording, but is also possible to program a recording. The recording can be saved, if you like automatically. All settings are stored in the registry. Furthermore you can choose a midi file (use “Settings”) to record. As soon as you hit the “Record” button the midi file starts playing and it is recorded as a wave file at the same time. Option Explicit Const AppName = “AudioRecorder” Private Sub cmdSave_Click() Dim sName As String
If WaveMidiFileName = “” Then sName = “Radio_from_” & CStr(WaveRecordingStartTime) & “_to_” & CStr(WaveRecordingStopTime ) sName = Replace(sName, “:”, “-“) sName = Replace(sName, ” “, “_”) sName = Replace(sName, “/”, “-“) Else sName = WaveMidiFileName sName = Replace(sName, “MID”, “wav”) End If CommonDialog1. FileName = sName CommonDialog1. CancelError = True On Error GoTo ErrHandler1 CommonDialog1. Filter = “WAV file (*. wav*)|*. wav” CommonDialog1. Flags = &H2 or &H400 CommonDialog1. ShowSave sName = CommonDialog1. FileName WaveSaveAs (sName) Exit Sub ErrHandler1: End Sub Private Sub cmdRecord_Click() Dim settings As String Dim Alignment As Integer
Alignment = Channels * Resolution / 8 settings = “set capture alignment ” & CStr(Alignment) & ” bitspersample ” & CStr(Resolution) & ” samplespersec ” & CStr(Rate) & ” channels ” & CStr(Channels) & ” bytespersec ” & CStr(Alignment * Rate) WaveReset WaveSet WaveRecord WaveRecordingStartTime = Now cmdStop. Enabled = True ‘Enable the STOP BUTTON cmdPlay. Enabled = False ‘Disable the “PLAY” button cmdSave. Enabled = False ‘Disable the “SAVE AS” button cmdRecord. Enabled = False ‘Disable the “RECORD” button End Sub Private Sub cmdSettings_Click() Dim strWhat As String ‘ show the user entry form modally strWhat = MsgBox(“If you continue your data will be lost! , vbOKCancel) If strWhat = vbCancel Then Exit Sub End If Slider1. Max = 10 Slider1. Value = 0 Slider1. Refresh cmdRecord. Enabled = True cmdStop. Enabled = False cmdPlay. Enabled = False cmdSave. Enabled = False WaveReset Rate = CLng(GetSetting(“AudioRecorder”, “StartUp”, “Rate”, “110025”)) Channels = CInt(GetSetting(“AudioRecorder”, “StartUp”, “Channels”, “1”)) Resolution = CInt(GetSetting(“AudioRecorder”, “StartUp”, “Resolution”, “16”)) WaveFileName = GetSetting(“AudioRecorder”, “StartUp”, “WaveFileName”, “C:Radio. wav”) WaveAutomaticSave = GetSetting(“AudioRecorder”, “StartUp”, “WaveAutomaticSave”, “True”) WaveRecordingImmediate = True WaveRecordingReady = False
AudioRecorder – 2 WaveRecording = False WavePlaying = False ‘Be sure to change the Value property of the appropriate button!! ‘if you change the default values! WaveSet frmSettings. optRecordImmediate. Value = True frmSettings. Show vbModal End Sub Private Sub cmdStop_Click() WaveStop cmdSave. Enabled = True ‘Enable the “SAVE AS” button cmdPlay. Enabled = True ‘Enable the “PLAY” button cmdStop. Enabled = False ‘Disable the “STOP” button If WavePosition = 0 Then Slider1. Max = 10 Else If WaveRecordingImmediate And (Not WavePlaying) Then Slider1. Max = WavePosition If (Not WaveRecordingImmediate) And WaveRecording Then Slider1. Max = WavePosition End If
If WaveRecording Then WaveRecordingReady = True WaveRecordingStopTime = Now WaveRecording = False WavePlaying = False frmSettings. optRecordProgrammed. Value = False frmSettings. optRecordImmediate. Value = True frmSettings. lblTimes. Visible = False End Sub Private Sub cmdPlay_Click() WavePlayFrom (Slider1. Value) WavePlaying = True cmdStop. Enabled = True cmdPlay. Enabled = False End Sub Private Sub cmdWeb_Click() MsgBox (“AUTHOR:Nachiketas R–[email protected] com”) End Sub Private Sub cmdReset_Click() Slider1. Max = 10 Slider1. Value = 0 Slider1. Refresh cmdRecord. Enabled = True cmdStop. Enabled = False cmdPlay. Enabled = False cmdSave. Enabled = False WaveReset
Rate = CLng(GetSetting(“AudioRecorder”, “StartUp”, “Rate”, “110025”)) Channels = CInt(GetSetting(“AudioRecorder”, “StartUp”, “Channels”, “1”)) Resolution = CInt(GetSetting(“AudioRecorder”, “StartUp”, “Resolution”, “16”)) WaveFileName = GetSetting(“AudioRecorder”, “StartUp”, “WaveFileName”, “C:Radio. wav”) WaveAutomaticSave = GetSetting(“AudioRecorder”, “StartUp”, “WaveAutomaticSave”, “True”) WaveRecordingImmediate = True WaveRecordingReady = False WaveRecording = False WavePlaying = False WaveMidiFileName = “” ‘Be sure to change the Value property of the appropriate button!! ‘if you change the default values! WaveSet If WaveRenameNecessary Then Name WaveShortFileName As WaveLongFileName WaveRenameNecessary = False AudioRecorder – 3 WaveShortFileName = “” End If End Sub Private Sub Form_Load() WaveReset
Rate = CLng(GetSetting(“AudioRecorder”, “StartUp”, “Rate”, “110025”)) Channels = CInt(GetSetting(“AudioRecorder”, “StartUp”, “Channels”, “1”)) Resolution = CInt(GetSetting(“AudioRecorder”, “StartUp”, “Resolution”, “16”)) WaveFileName = GetSetting(“AudioRecorder”, “StartUp”, “WaveFileName”, “C:Radio. wav”) WaveAutomaticSave = GetSetting(“AudioRecorder”, “StartUp”, “WaveAutomaticSave”, “True”) WaveRecordingImmediate = True WaveRecordingReady = False WaveRecording = False WavePlaying = False ‘Be sure to change the Value property of the appropriate button!! ‘if you change the default values! WaveSet WaveRecordingStartTime = Now + TimeSerial(0, 15, 0) WaveRecordingStopTime = WaveRecordingStartTime + TimeSerial(0, 15, 0) WaveMidiFileName = “” WaveRenameNecessary = False End Sub Private Sub Form_Unload(Cancel As Integer) WaveClose
Call SaveSetting(“AudioRecorder”, “StartUp”, “Rate”, CStr(Rate)) Call SaveSetting(“AudioRecorder”, “StartUp”, “Channels”, CStr(Channels)) Call SaveSetting(“AudioRecorder”, “StartUp”, “Resolution”, CStr(Resolution)) Call SaveSetting(“AudioRecorder”, “StartUp”, “WaveFileName”, WaveFileName) Call SaveSetting(“AudioRecorder”, “StartUp”, “WaveAutomaticSave”, CStr(WaveAutomaticSave)) If WaveRenameNecessary Then Name WaveShortFileName As WaveLongFileName WaveRenameNecessary = False WaveShortFileName = “” End If End End Sub Private Sub Timer2_Timer() Dim RecordingTimes As String Dim msg As String RecordingTimes = “Start time: ” & WaveRecordingStartTime & vbCrLf _ & “Stop time: ” & WaveRecordingStopTime WaveStatistics If Not WaveRecordingImmediate Then WaveStatisticsMsg = WaveStatisticsMsg & “Programmed recording” If WaveAutomaticSave Then WaveStatisticsMsg = WaveStatisticsMsg & ” (automatic save)” Else WaveStatisticsMsg = WaveStatisticsMsg & ” (manual save)” End If
WaveStatisticsMsg = WaveStatisticsMsg & vbCrLf & vbCrLf & RecordingTimes End If StatisticsLabel. Caption = WaveStatisticsMsg WaveStatus If WaveStatusMsg AudioRecorder. Caption Then AudioRecorder. Caption = WaveStatusMsg If InStr(AudioRecorder. Caption, “stopped”) ; 0 Then cmdStop. Enabled = False cmdPlay. Enabled = True End If If RecordingTimes frmSettings. lblTimes. Caption Then frmSettings. lblTimes. Caption = Recordin gTimes If (Now ; WaveRecordingStartTime) _ And (Not WaveRecordingReady) _ And (Not WaveRecordingImmediate) _ And (Not WaveRecording) Then AudioRecorder – 4 WaveReset WaveSet WaveRecord WaveRecording = True cmdStop. Enabled = True ‘Enable the STOP BUTTON cmdPlay.
Enabled = False ‘Disable the “PLAY” button cmdSave. Enabled = False ‘Disable the “SAVE AS” button cmdRecord. Enabled = False ‘Disable the “RECORD” button End If If (Now ; WaveRecordingStopTime) And (Not WaveRecordingReady) And (Not WaveRecordingImmediate) Then WaveStop cmdSave. Enabled = True ‘Enable the “SAVE AS” button cmdPlay. Enabled = True ‘Enable the “PLAY” button cmdStop. Enabled = False ‘Disable the “STOP” button If WavePosition > 0 Then Slider1. Max = WavePosition Else Slider1. Max = 10 End If WaveRecording = False WaveRecordingReady = True If WaveAutomaticSave Then WaveFileName = “Radio_from_” & CStr(WaveRecordingStartTime) & “_to_” & CStr(WaveRecord ingStopTime)
WaveFileName = Replace(WaveFileName, “:”, “. “) WaveFileName = Replace(WaveFileName, ” “, “_”) WaveFileName = WaveFileName & “. wav” WaveSaveAs (WaveFileName) msg = “Recording has been saved” & vbCrLf msg = msg & “Filename: ” & WaveFileName MsgBox (msg) Else msg = “Recording is ready” & vbCrLf msg = msg & “Don’t forget to save recording… ” MsgBox (msg) End If frmSettings. optRecordProgrammed. Value = False frmSettings. optRecordImmediate. Value = True End If End Sub Option Explicit Private Sub cmdFileName_Click() WaveFileName = InputBox(“Filename: “, “Filename for automatic saving”, WaveFileName) End Sub Private Sub cmdMidi_Click() CommonDialog2. CancelError = True
On Error GoTo ErrHandler1 CommonDialog2. Filter = “Midi file (*. mid*)|*. mid” CommonDialog2. Flags = &H2 Or &H400 CommonDialog2. ShowOpen WaveMidiFileName = CommonDialog2. FileName WaveMidiFileName = GetShortName(WaveMidiFileName) ErrHandler1: End Sub Private Sub cmdOke_Click() Unload Me End Sub Private Sub cmdStartTime_Click() Dim wrst As String wrst = WaveRecordingStartTime wrst = InputBox(“Enter start time recording”, “Start time”, wrst) If wrst = “” Then Exit Sub If Not IsDate(wrst) Then MsgBox (“The date/time you entered was not valid! “) Else ‘ String returned from InputBox is a valid time, ‘ so store it as a date/time value in WaveRecordingStartTime.
If CDate(wrst) < Now Then MsgBox (“Recording events in the past is not possible… “) WaveRecordingStartTime = Now + TimeSerial(0, 15, 0) Else WaveRecordingStartTime = CDate(wrst) End If If WaveRecordingStopTime < WaveRecordingStartTime Then WaveRecordingStopTime = WaveRecordi ngStartTime + TimeSerial(0, 15, 0) End If End Sub Private Sub cmdStopTime_Click() Dim wrst As String wrst = WaveRecordingStopTime If wrst < WaveRecordingStartTime Then wrst = WaveRecordingStartTime + TimeSerial(0, 15, 0) wrst = InputBox(“Enter stop time recording”, “Stop time”, wrst) If wrst = “” Then Exit Sub If Not IsDate(wrst) Then MsgBox (“The time you entered was not valid! “) Else String returned from InputBox is a valid time, ‘ so store it as a date/time value in WaveRecordingStartTime. If CDate(wrst) < WaveRecordingStartTime Then MsgBox (“The stop time has to be later then the start time! “) WaveRecordingStopTime = WaveRecordingStartTime + TimeSerial(0, 5, 0) Else WaveRecordingStopTime = CDate(wrst) End If End If End Sub Private Sub Form_Load() Select Case Rate Case 44100 optRate44100. Value = True Case 22050 optRate22050. Value = True Case 11025 optRate11025. Value = True Case 8000 optRate8000. Value = True Case 6000 optRate6000. Value = True End Select frmSettings – 2 Select Case Channels Case 1 optMono. Value = True Case 2 optStereo.
Value = True End Select Select Case Resolution Case 8 opt8bits. Value = True Case 16 opt16bits. Value = True End Select If WaveRecordingImmediate Then optRecordImmediate. Value = True Else optRecordProgrammed. Value = True End If If WaveAutomaticSave Then Option11. Value = True Else Option10. Value = True End If End Sub Private Sub optRate11025_Click() Rate = 11025 optRate11025. Value = True End Sub Private Sub optRate44100_Click() Rate = 44100 optRate44100. Value = True End Sub Private Sub Option10_Click() WaveAutomaticSave = False End Sub Private Sub Option11_Click() WaveAutomaticSave = True End Sub Private Sub optRate22050_Click() Rate = 22050 ptRate22050. Value = True End Sub Private Sub optRate8000_Click() Rate = 8000 optRate8000. Value = True End Sub Private Sub optRate6000_Click() Rate = 6000 optRate6000. Value = True End Sub Private Sub optMono_Click() Channels = 1 optMono. Value = True End Sub Private Sub optStereo_Click() Channels = 2 optStereo. Value = True End Sub Private Sub opt8bits_Click() Resolution = 8 opt8bits. Value = True End Sub frmSettings – 3 Private Sub opt16bits_Click() Resolution = 16 opt16bits. Value = True End Sub Private Sub optRecordImmediate_Click() WaveRecordingImmediate = True frmManualAuto. Visible = False frmTimes. Visible = False lblTimes. Visible = False
AudioRecorder. cmdRecord. Enabled = True End Sub Private Sub optRecordProgrammed_Click() WaveRecordingImmediate = False frmManualAuto. Visible = True frmTimes. Visible = True lblTimes. Visible = True AudioRecorder. cmdRecord. Enabled = False If WaveRecordingStartTime < Now Then WaveRecordingStartTime = Now + TimeSerial(0, 15, 0) WaveRecordingStopTime = WaveRecordingStartTime + TimeSerial(0, 15, 0) End If End Sub frmSettings – 1 modShellExecute – 1 Option Explicit Public Declare Function ShellExecute Lib “shell32. dll” Alias _ “ShellExecuteA” (ByVal hwnd As Long, ByVal lpOperation As _ String, ByVal lpFile As String, ByVal lpParameters As String, _ ByVal pDirectory As String, ByVal nShowCmd As Long) As Long modWave – 1 Option Explicit Public Rate As Long Public Channels As Integer Public Resolution As Integer Public WaveStatusMsg As String * 255 Public WaveStatisticsMsg As String Public WaveRecordingImmediate As Boolean Public WaveRecordingStartTime As Date Public WaveRecordingStopTime As Date Public WaveRecordingReady As Boolean Public WaveRecording As Boolean Public WavePlaying As Boolean Public WaveAutomaticSave As Boolean Public WaveFileName As String Public WaveMidiFileName As String Public WaveLongFileName As String Public WaveShortFileName As String Public WaveRenameNecessary As Boolean ‘These were the public variables =============================================================================== Private Declare Function mciSendString Lib “winmm. dll” Alias “mciSendStringA” (ByVal lpstrCommand As String, ByVal lpstrrtning As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) A s Long Private Declare Function GetShortPathName Lib “kernel32” _ Alias “GetShortPathNameA” (ByVal lpszLongPath As String, _ ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long Private Declare Function FindFirstFile& Lib “kernel32” _ Alias “FindFirstFileA” (ByVal lpFileName As String, lpFindFileData _ As WIN32_FIND_DATA) Private Declare Function FindClose Lib “kernel32” _ (ByVal hFindFile As Long) As Long Private Const MAX_PATH = 260
Private Type FILETIME ‘ 8 Bytes dwLowDateTime As Long dwHighDateTime As Long End Type Private Type WIN32_FIND_DATA ‘ 318 Bytes dwFileAttributes As Long ftCreationTime As FILETIME ftLastAccessTime As FILETIME ftLastWriteTime As FILETIME nFileSizeHigh As Long nFileSizeLow As Long dwReserved? As Long dwReserved1 As Long cFileName As String * MAX_PATH cAlternate As String * 14 End Type Private Function FileExist(strFileName As String) As Boolean Dim lpFindFileData As WIN32_FIND_DATA Dim hFindFirst As Long hFindFirst = FindFirstFile(strFileName, lpFindFileData) If hFindFirst > 0 Then modWave – 2 FindClose hFindFirst FileExist = True Else FileExist = False End If End Function
Public Function GetShortName(ByVal sLongFileName As String) As String Dim lRetVal As Long, sShortPathName As String, iLen As Integer ‘Set up buffer area for API function call return sShortPathName = Space(255) iLen = Len(sShortPathName) ‘Call the function lRetVal = GetShortPathName(sLongFileName, sShortPathName, iLen) If lRetVal = 0 Then ‘The file does not exist, first create it! Open sLongFileName For Random As #1 Close #1 lRetVal = GetShortPathName(sLongFileName, sShortPathName, iLen) ‘Now another try! Kill (sLongFileName) ‘Delete file now! End If ‘Strip away unwanted characters. GetShortName = Left(sShortPathName, lRetVal) End Function Private Function Has_Space(sName As String) As Boolean Dim b As Boolean Dim i As Long = False ‘not yet any spaces found i = InStr(sName, ” “) If i 0 Then b = True Has_Space = b End Function Public Sub WaveReset() Dim rtn As String Dim i As Long rtn = Space$(260) ‘Close any MCI operations from previous VB programs i = mciSendString(“close all”, rtn, Len(rtn), 0) If i 0 Then MsgBox (“Closing all MCI operations failed! “) ‘Open a new WAV with MCI Command… i = mciSendString(“open new type waveaudio alias capture”, rtn, Len(rtn), 0) If i 0 Then MsgBox (“Opening new wave failed! “) End Sub Public Sub WaveSet() Dim rtn As String Dim i As Long Dim settings As String Dim Alignment As Integer rtn = Space$(260) Alignment = Channels * Resolution / 8 ettings = “set capture alignment ” & CStr(Alignment) & ” bitspersample ” & CStr(Resolution) & ” samplespersec ” & CStr(Rate) & ” channels ” & CStr(Channels) & ” bytespersec ” & CStr(Alignment * Rate) ‘Samples Per Second that are supported: ‘11025 low quality ‘22050 medium quality ‘44100 high quality (CD music quality) ‘Bits per sample is 16 or 8 ‘Channels are 1 (mono) or 2 (stereo) i = mciSendString(“seek capture to start”, rtn, Len(rtn), 0) ‘Always start at the beginning If i 0 Then MsgBox (“Starting recording failed! “) ‘You can use at least the following combinations ‘ i = mciSendString(“set capture alignment 4 bitspersample 16 samplespersec 44100 channels 2 b ytespersec 176400”, rtn, Len(rtn), 0) modWave – 3 i = mciSendString(“set capture alignment 2 bitspersample 16 samplespersec 44100 channels 1 b ytespersec 88200”, rtn, Len(rtn), 0) ‘ i = mciSendString(“set capture alignment 4 bitspersample 16 samplespersec 22050 channels 2 b ytespersec 88200”, rtn, Len(rtn), 0) ‘ i = mciSendString(“set capture alignment 2 bitspersample 16 samplespersec 22050 channels 1 b ytespersec 44100”, rtn, Len(rtn), 0) ‘ i = mciSendString(“set capture alignment 4 bitspersample 16 samplespersec 11025 channels 2 b ytespersec 44100”, rtn, Len(rtn), 0) ‘ i = mciSendString(“set capture alignment 2 bitspersample 16 samplespersec 11025 channels 1 b ytespersec 22050”, rtn, Len(rtn), 0) i = mciSendString(“set capture alignment 2 bitspersample 8 samplespersec 11025 channels 2 by tespersec 22050”, rtn, Len(rtn), 0) ‘ i = mciSendString(“set capture alignment 1 bitspersample 8 samplespersec 11025 channels 1 by tespersec 11025”, rtn, Len(rtn), 0) ‘ i = mciSendString(“set capture alignment 2 bitspersample 8 samplespersec 8000 channels 2 byt espersec 16000”, rtn, Len(rtn), 0) ‘ i = mciSendString(“set capture alignment 1 bitspersample 8 samplespersec 8000 channels 1 byt espersec 8000”, rtn, Len(rtn), 0) ‘ i = mciSendString(“set capture alignment 2 bitspersample 8 samplespersec 6000 channels 2 byt espersec 12000”, rtn, Len(rtn), 0) ‘ i = mciSendString(“set capture alignment 1 bitspersample 8 samplespersec 6000 channels 1 byt espersec 6000”, rtn, Len(rtn), 0) = mciSendString(settings, rtn, Len(rtn), 0) If i 0 Then MsgBox (“Settings for recording not consistent”) ‘ If the combination is not supported you get an error! End Sub Public Sub WaveRecord() Dim rtn As String Dim i As Long Dim msg As String rtn = Space$(260) If WaveMidiFileName “” Then If WaveRecordingImmediate Then MsgBox (“Midi file ” & WaveMidiFileName & ” will be recorde d”) i = mciSendString(“open ” & WaveMidiFileName & ” type sequencer alias midi”, rtn, Len(rtn) , 0) If i 0 Then MsgBox (“Opening midi file failed! “) i = mciSendString(“play midi”, rtn, Len(rtn), 0) ‘Start the recording If i 0 Then MsgBox (“Playing midi file failed! “) End If = mciSendString(“record capture”, rtn, Len(rtn), 0) ‘Start the recording If i 0 Then MsgBox (“Recording not possible, please restart your computer… “) End Sub Public Sub WaveSaveAs(sName As String) Dim rtn As String Dim i As Long ‘If file already exists then remove it If FileExist(sName) Then Kill (sName) End If ‘The mciSendString API call doesn’t seem to like’ ‘long filenames that have spaces in them, so we ‘will make another API call to get the short ‘filename version. ‘This is accomplished by the function GetShortName ‘MCI command to save the WAV file If Has_Space(sName) Then WaveShortFileName = GetShortName(sName) WaveLongFileName = sName WaveRenameNecessary = True ‘ These are necessary in order to be able to rename file = mciSendString(“save capture ” & WaveShortFileName, rtn, Len(rtn), 0) Elsei = mciSendString(“save capture ” & sName, rtn, Len(rtn), 0) modWave – 4 End If If i 0 Then MsgBox (“Saving file failed, file name was: ” & sName) End Sub Public Sub WaveStop() Dim rtn As String Dim i As Long i = mciSendString(“stop capture”, rtn, Len(rtn), 0) If i 0 Then MsgBox (“Stopping recording failed! “) If WaveMidiFileName “” Then i = mciSendString(“stop midi”, rtn, Len(rtn), 0) If i 0 Then MsgBox (“Stopping playing midi file failed! “) End If End Sub Public Sub WavePlay() Dim rtn As String Dim i As Long i = mciSendString(“play capture from 0”, rtn, Len(rtn), 0) If i 0 Then MsgBox (“Start playing failed! “) End Sub
Public Sub WaveStatus() Dim i As Long WaveStatusMsg = Space(255) i = mciSendString(“status capture mode”, WaveSt