<!-- Auto-modified logic added -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dog Repeller</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/howler/2.2.3/howler.min.js"></script>
    <style>
        body {
            font-family: Arial, sans-serif;
            text-align: center;
            padding: 20px;
        }
        button {
            padding: 10px 20px;
            font-size: 16px;
            margin: 10px;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <button id="controlButton" onclick="toggleSound()">Play</button>

    <script>
        const AudioContext = window.AudioContext || window.webkitAudioContext;
        let context = new AudioContext();
        let oscillator;
        let gainNode;
        let isPlaying = false;

        const fireworksSound = new Howl({
            src: ['https://freesound.org/data/previews/542/542494_134150-lq.mp3'],
            volume: 1.0,
            loop: false
        });

        const machinegunSound = new Howl({
            src: ['https://freesound.org/data/previews/84/84811_969434-lq.mp3'],
            volume: 1.0,
            loop: false
        });

        const grenadesSound = new Howl({
            src: ['https://freesound.org/data/previews/166/166766_2437352-lq.mp3'],
            volume: 1.0,
            loop: false
        });

        function toggleSound() {
            if (isPlaying) {
                stopSound();
                document.getElementById("controlButton").textContent = "Play";
            } else {
                startSound();
                document.getElementById("controlButton").textContent = "Stop";
            }
        }

        function startSound() {
            isPlaying = true;
            oscillator = context.createOscillator();
            gainNode = context.createGain();

            oscillator.type = 'sine';
            oscillator.frequency.setValueAtTime(100, context.currentTime);
            gainNode.gain.setValueAtTime(1, context.currentTime);

            oscillator.connect(gainNode);
            gainNode.connect(context.destination);

            oscillator.start();
            playSequence();
        }

        function playSequence() {
            if (!isPlaying) return;

            oscillator.frequency.linearRampToValueAtTime(19000, context.currentTime + 1.5);
            setTimeout(() => {
                if (isPlaying) fireworksSound.play();
            }, 1500);

            oscillator.frequency.linearRampToValueAtTime(100, context.currentTime + 3);
            setTimeout(() => {
                if (isPlaying) machinegunSound.play();
            }, 1750);

            setTimeout(() => {
                if (isPlaying) grenadesSound.play();
            }, 2000);

            setTimeout(() => {
                stopSound();
            }, 3000);
        }

        function stopSound() {
            isPlaying = false;
            if (oscillator) {
                oscillator.stop();
                oscillator.disconnect();
            }
        }
    </script>
</body>
</html>

<!-- End of auto-modifications -->