Skip to main content

Welcome to SoundWave

SoundWave is a web-based music player that integrates with Spotify and YouTube, giving you multiple ways to search, play, and download your favorite music. This guide will get you started quickly.
SoundWave consists of three different player interfaces, each designed for a specific use case. Choose the one that fits your needs!

Choose Your Player

SoundWave offers three distinct player interfaces:

Spotify Player

Search and stream music using Spotify’s embedded player

YouTube Player

Search and play music from YouTube with advanced filtering

Download Generator

Generate direct download links from Spotify tracks

Spotify Player

The Spotify Player (index.html or index3.html) provides a clean interface for searching and playing Spotify tracks.

Accessing the Spotify Player

1

Open the Player

Navigate to index.html (fixed-width desktop version) or index3.html (responsive version) in your web browser.
2

Search for Music

Enter a song name, artist, or album in the search bar and click Buscar (Search).The player will display matching results from Spotify’s catalog.
3

Play a Track

Click on any song from the search results to load it into the embedded Spotify player below.The track will begin playing immediately in the iframe player.

How It Works

The Spotify Player uses the Spotify Web API to search for tracks and displays them using Spotify’s embedded iframe player.
// Obtain access token on page load
async function getAccessToken() {
    const response = await fetch('https://jsnode-ab0e.onrender.com', { 
        method: 'POST' 
    });
    const data = await response.json();
    accessToken = data.access_token;
}

window.onload = getAccessToken;
Version Differences:
  • index.html: Fixed 1024px width, optimized for desktop viewing
  • index3.html: Responsive design that adapts to mobile devices

User Interface

The Spotify Player features:
  • Search Bar: Enter your search query (song, artist, or album)
  • Results List: Clickable list of matching tracks in Spotify green (#1db954)
  • Embedded Player: Spotify iframe player that loads selected tracks
  • Dark Theme: Spotify-inspired dark background (#121212)
The player automatically obtains a Spotify access token when the page loads, so you can start searching immediately without any authentication steps.

YouTube Player

The YouTube Player (scripts.js with styles.css) offers advanced search capabilities with real-time suggestions and smart filtering.

Accessing the YouTube Player

1

Open the Player

Open the HTML file that includes scripts.js and styles.css in your browser.
2

Type to See Suggestions

Start typing in the search field. Real-time suggestions will appear as you type, powered by YouTube/Invidious search.The player uses a 300ms debounce to avoid excessive API calls.
3

Click a Suggestion or Search

Either click on a suggestion to auto-fill and search, or press the Buscar button to search manually.
4

Browse Results

Results are displayed in groups of 5. Use the navigation buttons (< and >) to browse through multiple pages of results.
5

Select and Play

Click on a track to automatically fetch and play the audio stream from YouTube.

Advanced Features

function debounce(func, wait) {
    let timeout;
    return function (...args) {
        clearTimeout(timeout);
        timeout = setTimeout(() => func.apply(this, args), wait);
    };
}

document.getElementById('song-name').addEventListener('input', debounce(function () {
    const songName = this.value;
    suggestionsContainer.innerHTML = '';

    if (songName) {
        originalSearchTerm = songName.toLowerCase();
        fetchSuggestions(songName);
    } else {
        clearSuggestionsAndResults();
    }
}, 300)); // 300ms delay

Key Capabilities

The YouTube Player includes several advanced features:
  • Real-time Suggestions: See suggestions as you type with intelligent debouncing
  • Smart Filtering: Automatically filters results to match your search term and excludes “official” videos
  • Multi-Page Search: Searches up to 6 pages of results (30 tracks)
  • Grouped Results: Results are organized in groups of 5 for easy browsing
  • Auto-Play: Automatically fetches and plays audio when you select a track
  • Fallback URLs: Uses multiple Invidious instances for reliability
The YouTube Player requires user interaction before enabling autoplay due to browser autoplay policies. Click anywhere on the page to enable automatic playback.

Download Generator

The Download Generator (index2.html) converts Spotify track URLs into direct download links.

Using the Download Generator

1

Open the Generator

Navigate to index2.html in your web browser.
2

Enter Spotify URL

Paste a Spotify track URL into the input field. The URL should look like:
https://open.spotify.com/track/[track-id]
3

Generate Download Link

Click Get Download Link to process the URL.The backend service will fetch the track and generate a direct download link.
4

Download or Play

The download link will appear, and an audio player will automatically load and play the track.Click the download link to save the audio file to your device.

Implementation Details

document.getElementById('spotifyForm').addEventListener('submit', async function (event) {
    event.preventDefault();

    const spotifyUrl = document.getElementById('spotifyUrl').value;
    const errorMessage = document.getElementById('errorMessage');
    const result = document.getElementById('result');
    const audioPlayer = document.getElementById('audioPlayer');

    // Clear previous messages
    errorMessage.textContent = '';
    result.textContent = '';
    audioPlayer.style.display = 'none';

    if (!spotifyUrl) {
        errorMessage.textContent = 'Spotify URL is required!';
        return;
    }
    
    // Continue with fetch...
});

User Interface

The Download Generator features a clean, minimal design:
  • Light Theme: White background with subtle shadows
  • Simple Form: Single input field for Spotify URLs
  • Green Button: Prominent “Get Download Link” button (#4CAF50)
  • Integrated Player: HTML5 audio player that appears with the download link
  • Error Handling: Clear error messages for invalid URLs or failed requests
The audio player automatically starts playing when the download link is generated, allowing you to preview the track before downloading.

API Backend

All three players rely on a Node.js backend hosted at https://jsnode-ab0e.onrender.com that provides:

Endpoints

EndpointMethodPurpose
/POSTGet Spotify access token (index.html)
/get-tokenPOSTGet Spotify access token (index3.html)
/searchGETSearch Spotify catalog
/get-download-linkPOSTConvert Spotify URL to download link

CORS Proxy

The YouTube Player uses https://api.allorigins.win/raw?url= as a CORS proxy to fetch content from Invidious instances (inv.nadeko.net and yewtu.be).

Quick Reference

File Structure

source/
├── index.html          # Spotify Player (desktop, 1024px fixed width)
├── index3.html         # Spotify Player (responsive)
├── index2.html         # Download Generator
├── scripts.js          # YouTube Player logic
├── styles.css          # YouTube Player styles
└── back.js             # Backend implementation

Styling

All players use consistent color schemes:
body {
    background-color: #121212; /* Dark background */
    color: white;
}

button {
    background-color: #1db954; /* Spotify green */
}

button:hover {
    background-color: #14833b; /* Darker green */
}

Next Steps

Architecture Overview

Learn about the technical architecture and API integrations

Styling Guide

Understand the styling system and design
All players work out of the box without any configuration. Simply open the HTML files in a modern web browser and start searching for music!

Build docs developers (and LLMs) love