Table of Contents
If you use an XML editor that can load DTD (which is recommended) you will find the epulse dtd in the epulse-xxe folder. A highly recommended XML editor for epulse is XXE, because it can have an almost graphical interface, and is much easier to use. More about that in the next chapter.
The base element of an epulse XML file is signal. So with the xml declaration header and the base element, an epulse XML file looks like this:
<?xml version="1.0" encoding="iso-8859-1"?> <signal> ... </signal>
All the xml elements will be described in this chapter.
signal is the base element in an epulse xml file. It has the following children, in that order: description (optional), output (optional), sections (compulsory) and program (compulsory).
<signal> <description>...</description> <!-- optional --> <output/> <!-- optional --> <sections>...</sections> <program>...</program> </signal>
description can hold a description of the file. It is meant for the user only and is ignored by epulse. It can have a name attribute, and a longer text inside the element. It has no children.
<description name="Demo"> Simple demonstration file. Generates a 30 seconds long sinus wave at 440Hz </description>
The output element holds parameters for the output file. If it isn't present in the xml file, default values will be taken. The type attribute tells which output type must be used. Currently the only supported output is wav. The frequency attribute tells what frequency, in Hz, to use. By default it is 44100Hz. The filename attribute gives the output filename. By default it is the same as the input file, with a wav extension instead of xml.
<output type="wav" freq="44100" filename="demo.wav"/>
The sections element contains all the sections that will be used in the final signal. It has any number of section children.
<sections> <section name="section1"> ... </section> <section name="section2"> ... </section> </sections>
The section element describes a section of the signal. It has a unique and compulsory name attribute and any number of waveform children.
<section name="section1"> <waveform name="sine wave" type="Sine" output="yes"> ... </waveform> </section>
The name attribute will be used to designate this section in the program.
The waveform element describes a waveform in a section. It must have a name attribute that is unique in the section, a type attribute that tells what waveform to generate, and an optional output attribute. It has then parameter children. If there is an output="yes" attribute, the waveform will be used to produce the signal. If several waveform have this attribute in the section, their outputs will be added. It there is output="no" or if there isn't any output attribute, the waveform output will not be used as a signal output. It will be used a a modulation instead.
<waveform name="sine wave" type="Sine" output="yes"> <parameter name="Frequency">...</parameter> <parameter name="Phase">...</parameter> <parameter name="Mean">...</parameter> <parameter name="Amplitude">...</parameter> </waveform>
The type attribute must be a type supported be Epulse. In the following section a list of the waveform types will be presented, along with the parameters. A waveform element must have parameter children. You must provide exactly one parameter for each adjustable parameter. If you forget one parameter or if you provide one that doesn't exist for this type of waveform, epulse will give you an error.
The parameter element defines a waveform parameter. The name attribute is the name of the parameter, and the elements has a constant or fromwaveform child that gives the parameter value.
<parameter name="Frequency"><fromwaveform name="Frequency modulation"/></parameter> <parameter name="Phase"><constant value="0"/></parameter>
The constant element defines a constant value for a waveform parameter. The value is in the value attribute. It has no children.
<constant value="0"/>
The fromwaveform element defines a modulation of a waveform parameter. The value of the parameter is the output of the waveform designated by the name attribute. It has no children.
<fromwaveform name="Frequency modulation"/>
A waveform with the given name must exist in the section, or epulse will give an error.
The program element describes the program that will be executed by epulse. The program will tell epulse what section to use, and for how long. It can have element and loop children.
<program> <element name="section1" duration="15"/> <loop times="5"> ... </loop> </sections>
element is a program instruction that tells epulse to produce the section designated by its name attribute, for a time indicated by the duration attribute (in seconds).
<element name="section1" duration="15"/>
loop is a program instruction that tells epulse to execute several times the element contents. The times attribute indicates how many times the contents must be executed. It can have element and loop children.
<loop times="5"> <element name="section1" duration="15"/> <element name="section2" duration="5"/> </loop>