Orinj Effect framework Testing effects

Orinj version 9.0.0

Note: This page is not for the users of Orinj, but for developers who want to create digital signal processing effects for Orinj.

Downloads

exampledelaytest.zip July 3, 2025 The source code and executable JAR for the effect testing application (19 KB)

This zip file contains:

ExampleDelayTest

This source code can be used to test effects created with the Orinj effect framework. It replicates the way Orinj searches for effect JAR files, extracts information about the effects in these JAR files, and creates the effect and its user interface. The code also allows the playing of a single wave file with one of the available effects.

The source code itself can be compiled with the following.

javac "ExampleDelayTest\src\com\recordingblogs\AudioBuffer.java" -d "ExampleDelayTest\class" -classpath "ExampleDelayTest\class;Orange\oreffect.jar"
javac "ExampleDelayTest\src\com\recordingblogs\Envelope.java" -d "ExampleDelayTest\class" -classpath "ExampleDelayTest\class;Orange\oreffect.jar"
javac "ExampleDelayTest\src\com\recordingblogs\WaveFile.java" -d "ExampleDelayTest\class" -classpath "ExampleDelayTest\class;Orange\oreffect.jar"
javac "ExampleDelayTest\src\com\recordingblogs\SelectDialog.java" -d "ExampleDelayTest\class" -classpath "ExampleDelayTest\class;Orange\oreffect.jar"
javac "ExampleDelayTest\src\com\recordingblogs\WaveFileDialog.java" -d "ExampleDelayTest\class" -classpath "ExampleDelayTest\class;Orange\oreffect.jar"
javac "ExampleDelayTest\src\com\recordingblogs\EffectStoreItem.java" -d "ExampleDelayTest\class" -classpath "ExampleDelayTest\class;Orange\oreffect.jar"
javac "ExampleDelayTest\src\com\recordingblogs\EffectStore.java" -d "ExampleDelayTest\class" -classpath "ExampleDelayTest\class;Orange\oreffect.jar"
javac "ExampleDelayTest\src\com\recordingblogs\Mixer.java" -d "ExampleDelayTest\class" -classpath "ExampleDelayTest\class;Orange\oreffect.jar"
javac "ExampleDelayTest\src\com\recordingblogs\EffectDialog.java" -d "ExampleDelayTest\class" -classpath "ExampleDelayTest\class;Orange\oreffect.jar"
javac "ExampleDelayTest\src\com\recordingblogs\MainFrame.java" -d "ExampleDelayTest\class" -classpath "ExampleDelayTest\class;Orange\oreffect.jar"
javac "ExampleDelayTest\src\com\recordingblogs\ExampleDelayTest.java" -d "ExampleDelayTest\class" -classpath "ExampleDelayTest\class;Orange\oreffect.jar"
jar cfm ExampleDelayTest\exampledelaytest.jar ExampleDelayTest\manifest.txt -C ExampleDelayTest\class .

The following describes the classes included in this code in alphabetical order.

AudioBuffer.java

This class is a simple array of bytes. It stores audio data that is read from the wave file and sent to the output audio device. Since this buffer will not always be full (e.g., when reading audio data from the end of the wave file), this class also keeps track of the number of bytes that were read and should be used during playback.

EffectDialog.java

This is an extension of JDialog that encompasses the user interface for the effect. This class serves two purposes.

  • This dialog shows up during playback, so that you can change the controls of the effect (the ExampleDelay effect, for example, starts with delay of zero and decay of 100%, which is not very interesting).
  • Closing the dialog will cause playback to stop, so that you do not have to always listen to the whole wave file.

The controls for each effect are contained in a JPanel (see Orinj Effect Framework Example delay DelayPanel Java). This dialog adds the panel and a Close button.

EffectStore.java

This is an array of the available effects. It replicates the way Orinj keeps track of effects.

EffectStoreItem.java

This contains information about a single effect, including name, type, and the constructors for the effect and its graphical user interface. These items are created as effects are read from the existing effect package JAR files.

ExampleDelayTest.java

This is the main function for this source code. This function does the following.

  • It loads all available effects from the available effect packages.
  • It shows all effects to the user and allows the user to select an effect. The selected effect is the one that will be applied during playback. If the user clicks on Cancel when selecting an effect, the execution will stop.
  • It allows the user to select a wave file to be played. If the user clicks on Cancel when choosing a wave, the execution will stop.
  • It opens the chosen wave and tests it to make sure that it is a valid wave file with the appropriate format. Note that this source code only works with wave files that are PCM wave files with compression code 1 (see Format chunk (of a Wave file)), and have the sampling rate 44100 Hz and the sampling resolution 16 bits per sample.
  • It creates a mixer. The mixer applies the effect to the audio data in the wave file and plays the resulting audio.
  • It creates the effect and the effect dialog and begins playback.

MainFrame.java

This class loads available effects. It does the following.

  • It looks through the "effects" folder for JAR files.
  • It unzips JAR files and looks for the file "effect.xml" in each JAR file. The effect.xml file should reside at the top of each effect package JAR file and should contain information on the effects in the specific JAR file (see Orinj Effect framework oreffect JAR).
  • It loads all effects according to the information in the effect.xml files and places them in the effect store (see EffectStore.java and EffectStoreItem.java above).

Mixer.java

This class applies the chosen effect to the chosen wave file and plays the resulting audio. A good amount of preparation for playback is done inside this class, including aligning the wave file pointer to the start of its data chunk, filling the audio buffers with silence, reading a few audio buffers from the wave file, and sending these buffers to the output audio device. This means that the output audio device's own buffer will be filled with some amount of audio, which will be played and continuously filled while the mixer reads and sends additional buffers.

The continuation of playback, after the initial preparation, is done in a separate thread. This is so to allow the user to change controls in the effect dialog (see EffectDialog.java above) or to press the Close button of the effect dialog and stop playback.

The mixer treats the effect as an object of class EffectInterface (see Orinj Effect framework oreffect JAR). This means that the mixer will only have access to the functions of EffectInterface (in this case, the mixer only uses "apply" and "allowsDryWetMix").

SelectDialog.java

This dialog lists the names of all available effects and lets the user choose one effect to be applied during playback.

WaveFile.java

This is an implementation of a wave file. The wave file is implemented as a RandomAccessFile, since wave files consist of chunks, some of which may be skipped.

This is a simplistic wave implementation. Since chunks can be contained within chunks, a better way may be to implement the wave file as a stack of chunks. For simplicity, this implementation assumes that the data and format chunks of the wave file are at the top of the file and not sub chunks of some other chunk. This implementation cannot handle all wave files.

The following are the member data of the class.

  • m_datapointer – this is the position of the data chunk in the wave file (after the name of the chunk "data" and the four byte size of the chunk). We keep this information so that we can quickly go to the audio data portion of the wave to begin playback.
  • m_format – the audio format of the wave. In many audio applications, quick access to the format will be necessary so that the wave can be appropriately mixed. For example, one should know whether the wave contains one or two channels so that effects that use different parameters for the different channels can be applied.

The following are some of the functions in the class.

  • openRead() – this function checks the format of the file (for the right headers, subheaders, and chunks) and prepares the file for use (by aligning m_datapointer). Since this code only handles 16-bit PCM waves with the 44100 Hz sampling rate, this function also checks for the appropriate compression code, sampling resolution, and sampling rate.
  • startPlay() – this function moves the file pointer to the beginning of the audio data.
  • getData() – this function reads a buffer of audio data.

WaveFileDialog.java

This dialog allows the user to choose a wave file for playback.

Testing effect packages in Orinj and creating presets

You can also test your effects in Orinj. Place your effect package JAR file in the "orange/effects" folder and start Orinj. Orinj will automatically recognize the JAR file, recognize the effects, and create menus so that these effects can be used in tracks.

See also:
Orinj Effect framework

Add new comment

Filtered HTML

  • Freelinking helps you easily create HTML links. Links take the form of [[indicator:target|Title]]. By default (no indicator): Click to view a local node.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.