{"id":1440,"date":"2024-09-18T18:54:38","date_gmt":"2024-09-18T13:24:38","guid":{"rendered":"https:\/\/theblackturn.com\/blogs\/?page_id=1440"},"modified":"2026-04-24T22:07:23","modified_gmt":"2026-04-24T16:37:23","slug":"mp3-to-wav","status":"publish","type":"page","link":"https:\/\/theblackturn.com\/blogs\/mp3-to-wav\/","title":{"rendered":"MP3 to WAV"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"1440\" class=\"elementor elementor-1440\" data-elementor-post-type=\"page\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-748f996d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"748f996d\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-4f64a397\" data-id=\"4f64a397\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-7532ab37 elementor-widget elementor-widget-shortcode\" data-id=\"7532ab37\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"shortcode.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-shortcode\">\n    <h1>MP3 to WAV Converter<\/h1>\n    <form id=\"uploadForm\" method=\"POST\" enctype=\"multipart\/form-data\">\n        <label for=\"audioFiles\">Select MP3 Files:<\/label>\n        <input type=\"file\" class=\"custom-input\" name=\"audioFiles[]\" id=\"audioFiles\" accept=\".mp3\" multiple required><br><br> <!-- Allow multiple file selection -->\n\n        <div id=\"fileInfo\"><\/div> <!-- For file size and type -->\n\n        <label for=\"sampleRate\">Select Sample Rate (Hz):<\/label>\n        <select class=\"custom-input\" name=\"sampleRate\" id=\"sampleRate\">\n            <option value=\"44100\">44,100 Hz (CD Quality)<\/option>\n            <option value=\"48000\">48,000 Hz (Studio Quality)<\/option>\n            <option value=\"96000\">96,000 Hz (High Definition)<\/option>\n        <\/select><br><br>\n\n        <label for=\"bitRate\">Select Bit Rate (kbps):<\/label>\n        <select class=\"custom-input\" name=\"bitRate\" id=\"bitRate\">\n            <option value=\"128k\">128 kbps<\/option>\n            <option value=\"192k\">192 kbps<\/option>\n            <option value=\"320k\">320 kbps<\/option>\n        <\/select><br><br>\n\n        <button class=\"custom-button\" type=\"submit\">Convert to WAV<\/button>\n    <\/form>\n\n    <h3>Upload Progress<\/h3>\n    <div class=\"progress-container\" style=\"width: 100%; background-color: #ddd;\">\n        <div id=\"uploadProgressBar\" class=\"progress-bar\" style=\"width: 0%; height: 20px; background-color: #4caf50; text-align: center; line-height: 20px; color: white;\">0%<\/div>\n    <\/div>\n    <div id=\"uploadSpeed\" style=\"margin-top: 10px; font-weight: bold;\"><\/div> <!-- New div to display upload speed -->\n\n    <br>\n    <h3>Conversion Status<\/h3>\n    <div id=\"conversionStatus\">Waiting for upload...<\/div>\n    <div id=\"conversionProgressContainer\" class=\"progress-container hidden\">\n        <div id=\"conversionProgressBar\" class=\"progress-bar\">0%<\/div>\n    <\/div>\n\n    <div id=\"downloadLinks\" class=\"hidden\"> <!-- This div will contain individual download links or zip download -->\n        <h3>Download Files:<\/h3>\n        <div id=\"individualLinks\"><\/div>\n        <a id=\"downloadZipLink\" class=\"hidden\" href=\"\">Download All as Zip<\/a>\n    <\/div>\n\n    <style>\n        .hidden {\n            display: none;\n        }\n    <\/style>\n\n    <script type=\"text\/javascript\">\n        const ajaxurl = 'https:\/\/theblackturn.com\/blogs\/wp-admin\/admin-ajax.php';\n\n        const uploadForm = document.getElementById('uploadForm');\n        const uploadProgressBar = document.getElementById('uploadProgressBar');\n        const conversionProgressBar = document.getElementById('conversionProgressBar');\n        const conversionProgressContainer = document.getElementById('conversionProgressContainer');\n        const conversionStatus = document.getElementById('conversionStatus');\n        const downloadLinks = document.getElementById('downloadLinks');\n        const individualLinks = document.getElementById('individualLinks');\n        const downloadZipLink = document.getElementById('downloadZipLink');\n        const fileInfo = document.getElementById('fileInfo');\n\n        let startTime;\n\n        \/\/ Display file sizes when files are selected\n        document.getElementById('audioFiles').addEventListener('change', function (event) {\n            const files = event.target.files;\n            let infoHTML = '';\n            for (let i = 0; i < files.length; i++) {\n                const file = files[i];\n                const fileSize = (file.size \/ (1024 * 1024)).toFixed(2); \/\/ Convert to MB\n                infoHTML += `File Name: ${file.name} | File Size: ${fileSize} MB<br>`;\n            }\n            fileInfo.innerHTML = infoHTML;\n        });\n\n        uploadForm.addEventListener('submit', async (event) => {\n            event.preventDefault();\n\n            const formData = new FormData(uploadForm);\n            formData.append('action', 'mp3_to_wav_conversion_multiple');\n\n            const xhr = new XMLHttpRequest();\n            startTime = new Date().getTime();\n\n            xhr.open('POST', ajaxurl, true);\n\n            \/\/ Upload progress tracking with speed calculation\n            xhr.upload.onprogress = function (event) {\n                if (event.lengthComputable) {\n                    const percentComplete = (event.loaded \/ event.total) * 100;\n                    const currentTime = new Date().getTime();\n                    const timeElapsed = (currentTime - startTime) \/ 1000; \/\/ in seconds\n                    const uploadSpeed = (event.loaded \/ 1024 \/ timeElapsed).toFixed(2); \/\/ in KB\/s\n\n                    \/\/ Update progress bar with percentage only\n                    uploadProgressBar.style.width = percentComplete + '%';\n                    uploadProgressBar.innerHTML = Math.round(percentComplete) + '%';\n\n                    \/\/ Display upload speed below the progress bar\n                    document.getElementById('uploadSpeed').innerHTML = 'Upload Speed: ' + uploadSpeed + ' KB\/s';\n                }\n            };\n\n            xhr.onload = function () {\n                if (xhr.status === 200) {\n                    try {\n                        const response = JSON.parse(xhr.responseText);\n                        if (response.status === 'success') {\n                            conversionStatus.innerHTML = 'Upload complete! Starting conversion...';\n                            showDownloadLinks(response.files, response.zip); \/\/ Show individual and zip download links\n                        } else {\n                            conversionStatus.innerHTML = 'Upload failed! ' + response.message;\n                        }\n                    } catch (e) {\n                        conversionStatus.innerHTML = 'Error parsing server response.';\n                    }\n                }\n            };\n\n            xhr.onerror = function () {\n                conversionStatus.innerHTML = 'An error occurred during the upload or conversion process.';\n            };\n\n            xhr.send(formData);\n            conversionStatus.innerHTML = 'Uploading and converting...';\n        });\n\n        function showDownloadLinks(files, zipLink) {\n            downloadLinks.classList.remove('hidden');\n            individualLinks.innerHTML = ''; \/\/ Clear previous links\n            files.forEach(file => {\n                const link = document.createElement('a');\n                link.href = file;\n                link.textContent = file.split('\/').pop(); \/\/ Show file name\n                link.download = '';\n                link.style.display = 'block';\n                individualLinks.appendChild(link);\n            });\n            if (zipLink) {\n                downloadZipLink.href = zipLink;\n                downloadZipLink.classList.remove('hidden');\n            }\n        }\n    <\/script>\n\n    <\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"","protected":false},"author":4,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1440","page","type-page","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/theblackturn.com\/blogs\/wp-json\/wp\/v2\/pages\/1440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theblackturn.com\/blogs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/theblackturn.com\/blogs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/theblackturn.com\/blogs\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/theblackturn.com\/blogs\/wp-json\/wp\/v2\/comments?post=1440"}],"version-history":[{"count":6,"href":"https:\/\/theblackturn.com\/blogs\/wp-json\/wp\/v2\/pages\/1440\/revisions"}],"predecessor-version":[{"id":1945,"href":"https:\/\/theblackturn.com\/blogs\/wp-json\/wp\/v2\/pages\/1440\/revisions\/1945"}],"wp:attachment":[{"href":"https:\/\/theblackturn.com\/blogs\/wp-json\/wp\/v2\/media?parent=1440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}