Chapter 2. XML syntax summary

Table of Contents

1. XML Elements
1.1. signal
1.2. description
1.3. output
1.4. sections
1.5. section
1.6. waveform
1.7. parameter
1.8. constant
1.9. fromwaveform
1.10. program
1.11. element
1.12. loop
2. Waveform types
2.1. Sine
2.2. Sine-Period
2.3. Rectangle-Duty-Cycle
2.4. Rectangle-Duration
2.5. Rectangle-Period
2.6. Triangle-Duty-Cycle
2.7. Triangle-Duration
2.8. Triangle-Period
2.9. Pulse-Rectangle
2.10. Pulse-Gaussian

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"?>

All the xml elements will be described in this chapter.

1. XML Elements

1.1. signal

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).

  <description>...</description>     <!-- optional -->
  <output/>                          <!-- optional -->

1.2. description

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

1.3. output

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"/>

1.4. sections

The sections element contains all the sections that will be used in the final signal. It has any number of section children.

  <section name="section1">

  <section name="section2">

1.5. section

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">

The name attribute will be used to designate this section in the program.

1.6. waveform

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>

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.

1.7. parameter

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>

1.8. constant

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"/>

1.9. fromwaveform

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.

1.10. program

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.

  <element name="section1" duration="15"/>
  <loop times="5">

1.11. element

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"/>

1.12. loop

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"/>