Tutorial

Neue Updates und Verbesserungen zu Roundfleet.

Wichtiger Hinweis

Die in diesen Tutorials bereitgestellten Codebeispiele und Skripte dienen nur zu Bildungszwecken. Roundfleet ist nicht verantwortlich für Probleme, Schäden oder Sicherheitslücken, die durch die Verwendung, Änderung oder Implementierung dieser Beispiele entstehen können. Überprüfen und testen Sie Code immer in einer sicheren Umgebung, bevor Sie ihn in Produktionssystemen verwenden.

Configure Alert Sound and Volume on macOS

Learn how to customize system alert sounds and volume levels on Mac devices. Essential for creating consistent audio experiences across enterprise Mac fleets and accommodating different work environments.

Change Alert Sound

Change the default alert sound from "Tink" to other available system sounds:

#!/bin/bash

# Get current user context
CURRENT_USER=$(stat -f "%Su" /dev/console)
CURRENT_USER_UID=$(id -u "$CURRENT_USER")

# Configuration
ALERT_SOUND="Submarine"  # Options: Basso, Funk, Glass, Ping, Pop, Submarine, Tink

echo "Setting alert sound to: $ALERT_SOUND"

# Apply alert sound setting
launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    defaults write .GlobalPreferences com.apple.sound.beep.sound "/System/Library/Sounds/${ALERT_SOUND}.aiff"

echo "✅ Alert sound changed to $ALERT_SOUND"
echo "🔄 Changes take effect immediately"

Change Alert Volume

Adjust the alert volume level (0-100%):

#!/bin/bash

# Get current user context
CURRENT_USER=$(stat -f "%Su" /dev/console)
CURRENT_USER_UID=$(id -u "$CURRENT_USER")

# Configuration
ALERT_VOLUME="75"  # Volume percentage (0-100)

echo "Setting alert volume to: ${ALERT_VOLUME}%"

# Apply alert volume setting
launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    osascript -e "set volume alert volume $ALERT_VOLUME"

echo "✅ Alert volume set to ${ALERT_VOLUME}%"

List Available Alert Sounds

Script to discover all available system alert sounds:

#!/bin/bash

echo "🔊 Available System Alert Sounds:"
echo "=================================="

# List all sound files in system sounds directory
SOUNDS_DIR="/System/Library/Sounds"
if [[ -d "$SOUNDS_DIR" ]]; then
    for sound_file in "$SOUNDS_DIR"/*.aiff; do
        if [[ -f "$sound_file" ]]; then
            sound_name=$(basename "$sound_file" .aiff)
            echo "  📢 $sound_name"
        fi
    done
else
    echo "❌ System sounds directory not found"
fi

echo ""
echo "💡 Use any of these names in the ALERT_SOUND variable"

Complete Alert Configuration

Comprehensive script to configure both sound and volume:

#!/bin/bash

# Function to configure alert settings
configure_alert_settings() {
    local sound_name="$1"
    local volume_level="$2"
    
    # Get current user context
    local current_user=$(stat -f "%Su" /dev/console)
    local current_user_uid=$(id -u "$current_user")
    
    echo "=== Roundfleet Alert Configuration ==="
    echo "👤 User: $current_user"
    echo "🔊 Sound: $sound_name"
    echo "🔊 Volume: ${volume_level}%"
    echo "==================================="
    
    # Validate sound file exists
    local sound_path="/System/Library/Sounds/${sound_name}.aiff"
    if [[ ! -f "$sound_path" ]]; then
        echo "❌ Error: Sound '$sound_name' not found"
        echo "📋 Available sounds:"
        ls /System/Library/Sounds/*.aiff | sed 's|.*/||' | sed 's|\.aiff||' | sed 's/^/  - /'
        return 1
    fi
    
    # Validate volume range
    if [[ $volume_level -lt 0 || $volume_level -gt 100 ]]; then
        echo "❌ Error: Volume must be between 0 and 100"
        return 1
    fi
    
    # Apply alert sound setting
    launchctl asuser $current_user_uid sudo -iu "$current_user" \
        defaults write .GlobalPreferences com.apple.sound.beep.sound "$sound_path"
    
    # Apply alert volume setting
    launchctl asuser $current_user_uid sudo -iu "$current_user" \
        osascript -e "set volume alert volume $volume_level"
    
    echo "✅ Alert settings configured successfully"
    echo "🎵 Sound: $sound_name"
    echo "🔊 Volume: ${volume_level}%"
}

# Enterprise configuration
ALERT_SOUND="Glass"
ALERT_VOLUME="50"

# Apply configuration
configure_alert_settings "$ALERT_SOUND" "$ALERT_VOLUME"

Get Current Alert Settings

Script to display current alert sound and volume configuration:

#!/bin/bash

# Get current user context
CURRENT_USER=$(stat -f "%Su" /dev/console)
CURRENT_USER_UID=$(id -u "$CURRENT_USER")

echo "📊 Current Alert Settings"
echo "========================="

# Get current alert sound
current_sound=$(launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    defaults read .GlobalPreferences com.apple.sound.beep.sound 2>/dev/null)

if [[ -n "$current_sound" ]]; then
    sound_name=$(basename "$current_sound" .aiff)
    echo "🔊 Alert Sound: $sound_name"
else
    echo "🔊 Alert Sound: Tink (default)"
fi

# Get current alert volume using AppleScript
current_volume=$(launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    osascript -e "get volume settings" 2>/dev/null | grep -o 'alert volume:[0-9]*' | cut -d: -f2)

if [[ -n "$current_volume" ]]; then
    echo "🔊 Alert Volume: ${current_volume}%"
else
    echo "🔊 Alert Volume: Unable to determine"
fi

echo "👤 User: $CURRENT_USER"
echo "🖥️  Device: $(hostname)"

Enterprise Alert Policy

Standardized alert configuration for enterprise environments:

#!/bin/bash

# Enterprise alert standardization
COMPANY_NAME="Roundfleet"
ENVIRONMENT_TYPE="office"  # Options: office, quiet, presentation, factory

# Define environment-specific settings
case "$ENVIRONMENT_TYPE" in
    "office")
        ALERT_SOUND="Glass"
        ALERT_VOLUME="50"
        ;;
    "quiet")
        ALERT_SOUND="Tink"
        ALERT_VOLUME="25"
        ;;
    "presentation")
        ALERT_SOUND="Pop"
        ALERT_VOLUME="10"
        ;;
    "factory")
        ALERT_SOUND="Basso"
        ALERT_VOLUME="100"
        ;;
    *)
        ALERT_SOUND="Glass"
        ALERT_VOLUME="50"
        ;;
esac

# Function to apply enterprise alert policy
apply_enterprise_alert_policy() {
    local current_user=$(stat -f "%Su" /dev/console)
    local current_user_uid=$(id -u "$current_user")
    
    echo "🏢 Applying Enterprise Alert Policy"
    echo "==================================="
    echo "Environment: $ENVIRONMENT_TYPE"
    echo "Device: $(hostname)"
    echo "User: $current_user"
    echo "Sound: $ALERT_SOUND"
    echo "Volume: ${ALERT_VOLUME}%"
    echo "Timestamp: $(date)"
    
    # Apply sound setting
    launchctl asuser $current_user_uid sudo -iu "$current_user" \
        defaults write .GlobalPreferences com.apple.sound.beep.sound "/System/Library/Sounds/${ALERT_SOUND}.aiff"
    
    # Apply volume setting
    launchctl asuser $current_user_uid sudo -iu "$current_user" \
        osascript -e "set volume alert volume $ALERT_VOLUME"
    
    echo "✅ Enterprise alert policy applied"
    echo "📊 Configuration complete on $(hostname)"
}

# Execute enterprise policy
apply_enterprise_alert_policy

Reset to Default Settings

Restore alert settings to macOS defaults:

#!/bin/bash

# Get current user context
CURRENT_USER=$(stat -f "%Su" /dev/console)
CURRENT_USER_UID=$(id -u "$CURRENT_USER")

echo "🔄 Resetting alert settings to defaults..."

# Reset alert sound to default (Tink)
launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    defaults delete .GlobalPreferences com.apple.sound.beep.sound 2>/dev/null || true

# Reset alert volume to default (75%)
launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" \
    osascript -e "set volume alert volume 75"

echo "✅ Alert settings reset to defaults"
echo "🔊 Sound: Tink (default)"
echo "🔊 Volume: 75% (default)"

Usage with Roundfleet

  1. Choose appropriate sound and volume for your environment
  2. Test settings on a single device first
  3. Deploy through Roundfleet's remote script execution
  4. Verify settings across device fleet

Available System Sounds

Sound NameDescriptionUse Case
BassoDeep, attention-grabbingHigh-priority alerts
FunkModern, pleasantGeneral notifications
GlassClear, sharpProfessional environments
PingQuick, subtleMinimal distraction
PopShort, crispQuick acknowledgments
SubmarineUnique, distinctiveCreative environments
TinkDefault system soundStandard configuration

Environment Guidelines

EnvironmentRecommended SoundVolume Level
OfficeGlass, Tink25-50%
Quiet zonesPing, Pop10-25%
PresentationsPop, Tink10%
Factory/LoudBasso, Funk75-100%
CreativeSubmarine, Funk50-75%

Troubleshooting

Sound not changing: Verify sound file exists in /System/Library/Sounds/ Volume not applying: Ensure AppleScript execution permissions Permission denied: Verify user context with launchctl asuser