Audio Comparison Documentation

What you see above is the most simple usage. Just paste

[audiocomparison file_a="/path/to/a.mp3" file_b="/path/to/b.mp3"]

into your code. If you are using the block editor, you can use the Shortcode or the HTML block. Adjust the paths to your sound files, usually something like /wp-content/uploads/2023/11/awesomemix.mp3. You can find the correct paths in your media files.

BTW, the files could be any type your website viewer’s browsers can handle, so MP3 & WAV will most likely work and are recommended.

You can control the user interface for your Audio Comparisons in two ways: via central settings and per comparison instance (i.e. attributes per shortcode).

Plugin Settings

The settings are pretty much self explanatory. You can change positions of the output label and the Play/Stop button, choose which version should be played first on pressing the Play button, as well as the labels on all buttons and the text used as output. Note that in the Output for A and B you can use %T as a placeholder for the elapsed time (format m:ss).

All these parameters can be overwritten per comparison/shortcode instance, which means any parameter NOT set in a shortcode uses the global settings above.

The Style Editor

The style editor allows quick and easy design of your comparison buttons! Start by selecting a theme (themes provide a basic styling and utilize different effects, like blinking, hover shading etc.) and adjust sizes, borders, colors, font sizes etc. to your liking. The usage should be pretty self explanatory. And if the result is looking too weird, you could always click the “Reset to defaults” button!

If the “Apply style…” checkbox is ticked, the necessary CSS stylesheet is inserted automatically on every page that has an Audio Comparison instance on it.

Note: Sometimes certain WP themes do mess up WP internals. If the styling does not seem to work, try the “Use safe method” checkbox, which inserts the stylesheet on every page of the site without depending on an Audio Comparison instance.

Alternatively, or if you just want to use the generated CSS as a starting point for your own designs, click the “Copy style…” button to place the designed CSS classes on your clipboard, ready to be modified in your favourite text editor and put to use in the ‘Additional CSS’ places of your WordPress theme.

License Key

Let’s quickly take care of the license key settings. You can use a single key for one website domain, but you can move a key from one domain to another yourself.

To activate your domain, enter the license key purchased here and click “Activate”. Upon validation, the License server says: line should show valid.

To move your key from one domain to another, simply enter the same key again and click “Deactivate”.

This will free the key for another domain, where you just repeat the “Activate” routine from above. Please note that without a key (and outside of the trial period), all instances of Audio Comparison on your website will stop working.

Shortcode Parameters

Every parameter set globally can be changed per Audio Comparison instance using shortcode parameters, which looks like this:

[audiocomparison 
      file_a="/path/to/a.mp3"
      file_b="/path/to/b.mp3"
      parameter1="value1"
      parameter2="value2"
]

Of course you can also put all on one line:

[audiocomparison file_a="/path/to/a.mp3" file_b="/path/to/b.mp3" parameter1="value1" parameter2="value2"]

You can use the following parameters:

ParameterGlobal SettingDescriptionValues
textOutputSets the position of the output labelbefore before the buttons
after after the buttons
none no output label
text_aOutput for AContents of output label while playing audio APlaceholder %T inserts elapsed time
text_bOutput for BContents of output label while playing audio BPlaceholder %T inserts elapsed time
text_cOutput for CContents of output label while playing audio CPlaceholder %T inserts elapsed time
text_loadingOutput during file loadContents of output label while buffering audio.
text_readyOutput after file loadContents of output label after audio has been loaded
play_buttonPlay/Stop buttonSets the position of the Play/Stop buttonleft left of the A/B/C buttons
right right of the A/B/C buttons
none no Play/Stop button
play_defaultPlay defaultWhich version to play first when pressing the Play buttonA File A
B File B
C File C
text_button_playLabel on Play/Stop button for PlayPlay/Stop button label while not playing audio
text_button_stopLabel on Play/Stop button for StopPlay/Stop button label while playing audio
text_button_aLabel on A buttonText on button A
text_button_bLabel on B buttonText on button B
text_button_cLabel on C buttonText on button C

So to create an instance with no output label, Play/Stop button on the right, A/B buttons labelled “Awesome” and “Boring”, you’d use a shortcode like this:

[audiocomparison 
      file_a="/path/to/mixed.mp3"
      file_b="/path/to/raw.mp3"
      text="none"
      play_button="right"
      text_button_a="Awesome"
      text_button_b="Boring"
]

Style with CSS

The following CSS classes are associated with the elements of an Audio Comparison instance:

ElementCSS class
Whole instance div.audio-comparison
Play/Stop button.audio-comparison-play-stop
Button A.audio-comparison-play-a
Button B.audio-comparison-play-b
Button C.audio-comparison-play-c
Output label.audio-comparison-label

In addition, some classes are dynamically assigned and removed from elements to fine tune the UI response to actions:

CSS classAction
.audio-comparison-output-bufferingAssigned to the output label while audio is still loading
.audio-comparison-output-playing-aAssigned to the output label while audio A is playing
.audio-comparison-output-playing-bAssigned to the output label while audio B is playing
.audio-comparison-output-playing-cAssigned to the output label while audio C is playing
.audio-comparison-button-bufferingAssigned to all buttons during audio loading
.audio-comparison-button-playingAssigned to the A, B, or C button while the respective audio is playing
.audio-comparison-playingAssigned to the Play/Stop button while audio is playing

Buttons that cannot be clicked at the moment (e.g. Play/Stop button during buffering, A button while playing A, etc.) have the attribute disabled="disabled" set, which you can also use to adjust the visual style.

JavaScript Function

To support special design solutions, there is also a public JavaScript function that you can use on your page:

FunctionDescription
AC_StopPlayingGroup()stop any playing comparison on the page

You can use that for instance to place Audio Comparisons on a slider: if the user advances to the next slide, stop the current group from playing. Or you could make Audio Comparison stop to if the user clicks play on a video with sound, so that the sounds do not overlap.

Support

If you have any suggestions (we’re always thankful for good ideas!) or need support, please contact our support at support@kaedinger.de.