Ulyd v3 – p5.js Recreation

# Ulyd v3 – p5.js Recreation

This project is a recreation of the original Flash-based `ulyd-v3.swf` interactive sound art piece, made in 2005, rebuilt using modern web technologies (p5.js). Also expanded to include Spatial Audio, changing pitch based on placement of the samples.

## About the Project

Ulyd v3 is an interactive sound sequencer. It features a vertical scanning line that triggers sounds when it passes over objects placed in the main area.

### Features

**Scanner**: A white line scans down the screen, triggering sounds.

**Pool**: A collection of sound objects on the right side.

**Drag & Drop**: Users can drag objects from the pool into the scanner area.

**Spatial Audio**: Sounds are modulated based on their horizontal position:

**Left**: Lower pitch, panned left.

**Center**: Normal pitch, centered.

**Right**: Higher pitch, panned right.

**Reactive Backgrounds**: The background atmosphere shifts and fades randomly when sounds are triggered.

**Sound Groups**:

**Yellow Icons**: Bright ping sounds.

**Silver Icons**: Glass/Sonar sounds.

## Technical Details

**Library**: [p5.js](https://p5js.org/) for graphics and interaction.

**Audio**: [p5.sound](https://p5js.org/reference/#/libraries/p5.sound) for audio playback and effects.

**Compatibility**: Works in all modern browsers (Chrome, Safari, Firefox). Includes fixes for Safari’s strict audio autoplay policies.

## How to Embed

1. Upload the contents of this folder to your web server.

2. Use an `<iframe>` to embed `index.html` on your page.

3. Ensure the `allow=”autoplay”` attribute is set on the iframe.

“`html

<iframe src=”path/to/index.html” width=”100%” height=”600″ style=”border:none;” allow=”autoplay”></iframe>


Script to decompile all .swf in a folder using ffdec:

extract_all_swfs.sh


#!/usr/bin/env bash

# --- Usage ---
# ./extract_all_swfs.sh /path/to/swf_folder
# Output will go inside subfolders: swf_folder/<filename_without_ext>/

SWF_DIR="$1"

if [ -z "$SWF_DIR" ]; then
  echo "Usage: $0 /path/to/folder_with_swfs"
  exit 1
fi

if [ ! -d "$SWF_DIR" ]; then
  echo "Error: '$SWF_DIR' is not a directory."
  exit 1
fi

# --- Check for Java ---
if ! command -v java &> /dev/null; then
  echo "Error: Java is not installed or not in PATH."
  echo "Please install Java (e.g., 'brew install openjdk')."
  exit 1
fi

# --- Download JPEXS Free Flash Decompiler (jar only) ---
JAR="ffdec.jar"
ZIP="ffdec.zip"

if [ ! -f "$JAR" ]; then
  echo "Downloading JPEXS Free Flash Decompiler..."
  curl -L -o "$ZIP" \
    "https://github.com/jindrapetrik/jpexs-decompiler/releases/download/version24.1.1/ffdec_24.1.1.zip"
  
  echo "Extracting JPEXS Free Flash Decompiler..."
  unzip -o -q "$ZIP"
  rm "$ZIP"
  
  # Clean up unused files from the zip
  rm -f CHANGELOG.md Icon.icns com.jpexs.decompiler.flash.metainfo.xml \
        ffdec ffdec-cli.exe ffdec-cli.jar ffdec.bat ffdec.exe ffdec.sh \
        icon.ico icon.png license.txt soleditor.bat soleditor.sh \
        translator.bat translator.sh
fi

echo "Starting batch extraction..."
echo

# --- Loop through all SWF files ---
for SWF_FILE in "$SWF_DIR"/*.swf; do
  [ -e "$SWF_FILE" ] || continue  # Skip if no SWF files found

  BASENAME=$(basename "$SWF_FILE" .swf)
  OUT_DIR="$SWF_DIR/$BASENAME"

  echo "Processing: $BASENAME.swf"
  mkdir -p "$OUT_DIR"

  # Extract scripts
  java -jar "$JAR" \
    -export script \
    "$OUT_DIR/script" \
    "$SWF_FILE"

  # Extract images
  java -jar "$JAR" \
    -export image \
    "$OUT_DIR/images" \
    "$SWF_FILE"

  # Extract sounds
  java -jar "$JAR" \
    -export sound \
    "$OUT_DIR/sounds" \
    "$SWF_FILE"

  # Extract all resources
  java -jar "$JAR" \
    -export all \
    "$OUT_DIR/all" \
    "$SWF_FILE"

  echo " → Extracted into: $OUT_DIR"
  echo
done

echo "Batch extraction complete!"

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *