Please bookmark this page to avoid losing your image tool!

Android Ringtone MP3 Player And Search Tool

(Free & Supports Bulk Upload)

Drag & drop your images here or

The result will appear here...
You can edit the below JavaScript code to customize the image tool.
function processImage(originalImg, defaultTopic = "Android", themeColor = "#4CAF50") {
    // Main Container
    const container = document.createElement('div');
    container.style.fontFamily = "'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif";
    container.style.width = '100%';
    container.style.maxWidth = '450px';
    container.style.margin = '0 auto';
    container.style.backgroundColor = '#ffffff';
    container.style.borderRadius = '16px';
    container.style.boxShadow = '0 8px 25px rgba(0,0,0,0.15)';
    container.style.overflow = 'hidden';
    container.style.position = 'relative';
    container.style.display = 'flex';
    container.style.flexDirection = 'column';
    container.style.minHeight = '550px';

    // Header Area (Using the Original Image as Background)
    const header = document.createElement('div');
    header.style.position = 'relative';
    header.style.height = '140px';
    header.style.display = 'flex';
    header.style.alignItems = 'center';
    header.style.justifyContent = 'center';
    header.style.backgroundColor = themeColor; 
    header.style.overflow = 'hidden';

    const bgImg = document.createElement('img');
    bgImg.src = originalImg.src;
    bgImg.style.position = 'absolute';
    bgImg.style.top = '0';
    bgImg.style.left = '0';
    bgImg.style.width = '100%';
    bgImg.style.height = '100%';
    bgImg.style.objectFit = 'cover';
    bgImg.style.opacity = '0.5';
    bgImg.style.filter = 'blur(4px) brightness(0.7)';
    header.appendChild(bgImg);

    const titleDiv = document.createElement('div');
    titleDiv.style.position = 'relative';
    titleDiv.style.zIndex = '1';
    titleDiv.style.textAlign = 'center';
    titleDiv.style.color = '#fff';

    const titleH2 = document.createElement('h2');
    titleH2.innerText = 'Ringtone Mp3 Search';
    titleH2.style.margin = '0 0 5px 0';
    titleH2.style.textShadow = '1px 1px 3px rgba(0,0,0,0.8)';
    
    const subTitle = document.createElement('span');
    subTitle.innerText = 'Search topics & create ringtones';
    subTitle.style.fontSize = '13px';
    subTitle.style.opacity = '0.9';

    titleDiv.appendChild(titleH2);
    titleDiv.appendChild(subTitle);
    header.appendChild(titleDiv);
    container.appendChild(header);

    // Content Area
    const content = document.createElement('div');
    content.style.padding = '20px';
    content.style.flex = '1';
    content.style.display = 'flex';
    content.style.flexDirection = 'column';
    container.appendChild(content);

    // Search Bar
    const searchForm = document.createElement('form');
    searchForm.style.display = 'flex';
    searchForm.style.marginBottom = '20px';
    searchForm.onsubmit = (e) => { 
        e.preventDefault(); 
        performSearch(); 
    };

    const searchInput = document.createElement('input');
    searchInput.type = 'text';
    searchInput.value = defaultTopic;
    searchInput.placeholder = 'Search ringtone topic...';
    searchInput.style.flex = '1';
    searchInput.style.padding = '12px 15px';
    searchInput.style.border = '2px solid #eee';
    searchInput.style.borderRight = 'none';
    searchInput.style.borderRadius = '24px 0 0 24px';
    searchInput.style.outline = 'none';
    searchInput.style.fontSize = '14px';

    const searchBtn = document.createElement('button');
    searchBtn.type = 'submit';
    searchBtn.innerText = 'Search';
    searchBtn.style.padding = '12px 20px';
    searchBtn.style.backgroundColor = themeColor;
    searchBtn.style.color = '#fff';
    searchBtn.style.border = `2px solid ${themeColor}`;
    searchBtn.style.borderRadius = '0 24px 24px 0';
    searchBtn.style.cursor = 'pointer';
    searchBtn.style.fontWeight = 'bold';
    searchBtn.style.transition = 'opacity 0.2s';
    searchBtn.onmouseover = () => searchBtn.style.opacity = '0.85';
    searchBtn.onmouseout = () => searchBtn.style.opacity = '1';

    searchForm.appendChild(searchInput);
    searchForm.appendChild(searchBtn);
    content.appendChild(searchForm);

    // Results Container
    const resultsDiv = document.createElement('div');
    resultsDiv.style.flex = '1';
    resultsDiv.style.overflowY = 'auto';
    resultsDiv.style.height = '270px'; // fixed inner height
    content.appendChild(resultsDiv);

    // Hidden Audio Player (For playing API results)
    const audioNode = document.createElement('audio');

    // Bottom Player UI
    const playerBar = document.createElement('div');
    playerBar.style.backgroundColor = '#1e1e1e';
    playerBar.style.color = '#fff';
    playerBar.style.padding = '15px 20px';
    playerBar.style.display = 'flex';
    playerBar.style.alignItems = 'center';
    playerBar.style.justifyContent = 'space-between';
    playerBar.style.display = 'none'; // Hidden until playback starts

    const trackInfo = document.createElement('div');
    trackInfo.style.fontSize = '14px';
    trackInfo.style.whiteSpace = 'nowrap';
    trackInfo.style.overflow = 'hidden';
    trackInfo.style.textOverflow = 'ellipsis';
    trackInfo.style.flex = '1';
    trackInfo.style.marginRight = '15px';
    trackInfo.style.fontWeight = '500';

    const playPauseBtn = document.createElement('button');
    playPauseBtn.innerText = '⏸';
    playPauseBtn.style.background = 'none';
    playPauseBtn.style.border = 'none';
    playPauseBtn.style.color = themeColor;
    playPauseBtn.style.fontSize = '24px';
    playPauseBtn.style.cursor = 'pointer';
    playPauseBtn.style.outline = 'none';

    playerBar.appendChild(trackInfo);
    playerBar.appendChild(playPauseBtn);
    container.appendChild(playerBar);

    let activeSynth = null; 

    // General Play/Pause controller
    playPauseBtn.onclick = () => {
        if (activeSynth) {
            // It's a procedural synth tone (mock fallback)
            try { activeSynth.stop(); } catch(e) {}
            activeSynth = null;
            playPauseBtn.innerText = '▶';
            trackInfo.innerText = 'Stopped';
        } else if (!audioNode.paused) {
            audioNode.pause();
            playPauseBtn.innerText = '▶';
        } else if (audioNode.src && audioNode.paused) {
            audioNode.play();
            playPauseBtn.innerText = '⏸';
        }
    };

    audioNode.onended = () => {
        playPauseBtn.innerText = '▶';
    };

    // Performs actual search or falls back to Web Audio synthed tracks
    async function performSearch() {
        resultsDiv.innerHTML = `<div style="text-align:center; padding:30px; color:#888;">Fetching ringtones...</div>`;
        const query = searchInput.value.trim();
        if (!query) return;

        try {
            // Try iTunes public API (Supports CORS, free, returns MP3 previews)
            const qUrl = encodeURIComponent(query + ' ringtone');
            const resp = await fetch(`https://itunes.apple.com/search?term=${qUrl}&limit=25&entity=song`);
            const data = await resp.json();
            
            if (data.results && data.results.length > 0) {
                renderResults(data.results.map(r => ({
                    title: r.trackName,
                    artist: r.artistName,
                    url: r.previewUrl,
                    type: 'api'
                })));
            } else {
                renderMockResults(query);
            }
        } catch (err) {
            // Network error / CORS blocked -> Fallback to mock Web Audio generated results
            renderMockResults(query);
        }
    }

    // Generates mock entries if no live MP3 API available
    function renderMockResults(query) {
        const mocks = [
            { title: `${query} Original Mix`, artist: 'Synth Android', type: 'synth', synthType: 'classic' },
            { title: `${query} Digital Notification`, artist: 'Alerts Maker', type: 'synth', synthType: 'digital' },
            { title: `${query} Marimba Wake`, artist: 'Tone Generator', type: 'synth', synthType: 'marimba' }
        ];
        renderResults(mocks);
    }

    // Render entries to the result list
    function renderResults(items) {
        resultsDiv.innerHTML = '';
        if (items.length === 0) {
            resultsDiv.innerHTML = '<div style="text-align:center; padding:30px; color:#888;">No results found.</div>';
            return;
        }

        items.forEach((item) => {
            const row = document.createElement('div');
            row.style.display = 'flex';
            row.style.alignItems = 'center';
            row.style.padding = '12px 10px';
            row.style.borderBottom = '1px solid #f1f1f1';
            row.style.transition = 'background 0.2s';
            row.onmouseover = () => row.style.backgroundColor = '#f9f9f9';
            row.onmouseout = () => row.style.backgroundColor = 'transparent';

            const icon = document.createElement('div');
            icon.innerText = item.type === 'synth' ? '🎛️' : '🎵';
            icon.style.fontSize = '22px';
            icon.style.marginRight = '15px';

            const info = document.createElement('div');
            info.style.flex = '1';
            info.style.overflow = 'hidden';
            
            const rTitle = document.createElement('div');
            rTitle.innerText = item.title;
            rTitle.style.fontWeight = '600';
            rTitle.style.fontSize = '14px';
            rTitle.style.whiteSpace = 'nowrap';
            rTitle.style.textOverflow = 'ellipsis';
            rTitle.style.overflow = 'hidden';
            rTitle.style.color = '#333';

            const rArtist = document.createElement('div');
            rArtist.innerText = item.artist;
            rArtist.style.fontSize = '12px';
            rArtist.style.color = '#777';
            rArtist.style.marginTop = '2px';

            info.appendChild(rTitle);
            info.appendChild(rArtist);

            const playBtn = document.createElement('button');
            playBtn.innerText = '▶';
            playBtn.style.padding = '6px 12px';
            playBtn.style.backgroundColor = 'transparent';
            playBtn.style.color = themeColor;
            playBtn.style.border = `2px solid ${themeColor}`;
            playBtn.style.borderRadius = '20px';
            playBtn.style.cursor = 'pointer';
            playBtn.style.fontWeight = 'bold';
            playBtn.style.outline = 'none';

            playBtn.onclick = () => playItem(item);

            row.appendChild(icon);
            row.appendChild(info);
            row.appendChild(playBtn);
            resultsDiv.appendChild(row);
        });
    }

    // Handles picking a track to play
    function playItem(item) {
        playerBar.style.display = 'flex';
        trackInfo.innerText = "Playing: " + item.title;
        playPauseBtn.innerText = '⏸';

        // Stop existing audio sources
        audioNode.pause();
        if (activeSynth) {
            try { activeSynth.stop(); } catch(e){}
            activeSynth = null;
        }

        if (item.type === 'api') {
            audioNode.src = item.url;
            audioNode.play();
        } else if (item.type === 'synth') {
            activeSynth = playSynthTones(item.synthType);
        }
    }

    // Procedurally generated fallback ringtones using Web Audio API
    function playSynthTones(type) {
        const AudioContext = window.AudioContext || window.webkitAudioContext;
        if (!AudioContext) {
            alert('Your browser does not support Web Audio API');
            return null;
        }
        
        const audioCtx = new AudioContext();
        if (audioCtx.state === 'suspended') {
            audioCtx.resume();
        }

        const now = audioCtx.currentTime;
        const osc = audioCtx.createOscillator();
        const gain = audioCtx.createGain();
        
        osc.connect(gain);
        gain.connect(audioCtx.destination);

        if (type === 'classic') {
            // Rapid alternation of frequencies (classic phone ring)
            osc.type = 'square';
            osc.frequency.setValueAtTime(500, now);
            osc.frequency.setValueAtTime(600, now + 0.1);
            osc.frequency.setValueAtTime(500, now + 0.2);
            osc.frequency.setValueAtTime(600, now + 0.3);
            osc.frequency.setValueAtTime(500, now + 0.4);
            
            gain.gain.setValueAtTime(0, now);
            gain.gain.linearRampToValueAtTime(0.15, now + 0.05);
            gain.gain.setValueAtTime(0.15, now + 1.8);
            gain.gain.linearRampToValueAtTime(0, now + 2);
            
            osc.start(now);
            osc.stop(now + 2);
        } else if (type === 'digital') {
            // Simple notification beep
            osc.type = 'sine';
            osc.frequency.setValueAtTime(880, now);
            osc.frequency.setValueAtTime(1100, now + 0.1);
            
            gain.gain.setValueAtTime(0, now);
            gain.gain.linearRampToValueAtTime(0.4, now + 0.05);
            gain.gain.exponentialRampToValueAtTime(0.01, now + 1.2);
            
            osc.start(now);
            osc.stop(now + 1.2);
        } else {
            // Short marimba drop
            osc.type = 'sine';
            osc.frequency.setValueAtTime(650, now);
            
            gain.gain.setValueAtTime(0, now);
            gain.gain.linearRampToValueAtTime(0.6, now + 0.02);
            gain.gain.exponentialRampToValueAtTime(0.01, now + 0.6);
            
            osc.start(now);
            osc.stop(now + 0.6);
        }

        osc.onended = () => {
            playPauseBtn.innerText = '▶';
            activeSynth = null;
        };

        return osc; 
    }

    // Trigger initial search onload
    performSearch();

    return container;
}

Free Image Tool Creator

Can't find the image tool you're looking for?
Create one based on your own needs now!

Description

This tool allows users to search for and preview various MP3 ringtones and notification sounds. Users can enter specific topics or keywords to find suitable audio tracks, which can be played directly through an integrated media player. It is useful for finding new alert tones, custom ringtones, or digital notification sounds for Android devices and other mobile platforms.

Leave a Reply

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