CLAM TUTORIAL PART 2

Introduction to CLAM (II), the SMS Example

After the introduction we had in Part 1 of this tutorial we are ready to learn a bit more about the processing capabilities of the framework. To do so, we will work on one of the examples: the SMSTools2 application. This application is similar to the one we are supposed to build by the end of this tutorial, it is interesting enough to dedicate a whole session to its study. In the meantime, we will become familiar with more CLAM tools. You will find the files of this example in the /examples/SMS folder in the repository.

  1. Using the SMSREADME.txt file you will find in that folder plus the information available in the CLAM documentation, make a brief explanation of the functionality of this application.
  2. What does the xml configuration file (available in the same folder) contain?

Now we can run and study the example. Note that the main class in the application is really a class hierarchy. We have the SMSBase class, where most of the functionality of the application is implemented. The SMSTools and SMSStdio classes derive from this, the former implementing the graphical version of the application and the latter implementing the standard i/o version. We will choose to compile the graphical version so we will have a graphical interface created using the Fltk library.

You can use the xml file available in the example folder or edit the default configuration from the application. Note that there is a field in the configuration that points to the path of the incoming audio file that is going to be analyzed. You will need to modify the path so it points to a sound available in your local drive (this operation though can be directly done through the graphical user interface). You can use any of the following sounds: sine.wav, sweep.wav, noise.wav, 1.wav, 2.wav, 3.wav.

Load the xml file (or edit the default configuration) and visualize the input sound.

  1. Analyze the sounds. Go to the Display menu and visualize the different components. Explain what you see and what are the differences between the different sounds.  
  2. Save the result of the analysis in xml format. Comment what you think is relevant to this process: speed, size and contents of the resulting xml file, ...
  3. Now we are ready to synthesize the analysis result. Listen to each of the components of the synthesis (sinusoidal, residual and final sound) and explain their characteristics. Look at the waveform of each component and explain what they look like.

Now we can dive a little deeper into the code that implements this application.

First, take a look at the SMSBase class.

  1. What classes and methods do we use for loading and storing audio files?
  2. And last, the class also has some members that are instances of classes that derive from the ProcessingConfig class. What are they used for? How is the xml configuration file loaded?

Now we will take a look at the SMSAnalysisSynthesisConfig class. It is the first time we are looking at a DynamicType class.

  1. What are its main attributes?

Most of the processing of the application is handled in the AnalysisProcessing and SynthesisProcessing methods of the SMSBase class. Note that in both cases we do more or less the same. We 'Start' the ProcessingComposite an then enter a loop that runs through all the audio and we call the Do method with the appropiate data. Finally we call the Stop method to "turn off" the ProcessingComposite.

Let's take a look at the SMSAnalysis class. This class looks like it should be very complex. All the analysis processing is done inside its Do method. But we see that the class does not have so many lines of code. This is because we are using the ProcessingComposite structure: the class is not much more than an aggregate of smaller Processing classes.

  1. Comment each of the Processing (or ProcessingComposites) inside the SMSAnalysis class and briefly explain their functionality.