{"id":362,"date":"2024-12-31T03:46:16","date_gmt":"2024-12-31T03:46:16","guid":{"rendered":"https:\/\/lectenna.com\/?page_id=362"},"modified":"2024-12-31T04:15:37","modified_gmt":"2024-12-31T04:15:37","slug":"audio-over-aux","status":"publish","type":"page","link":"https:\/\/lectenna.com\/index.php\/audio-over-aux\/","title":{"rendered":"Audio over AUX"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>LEctenna Full Melody with Sound<\/title>\n    <style>\n        body {\n            display: flex;\n            flex-direction: column;\n            align-items: center;\n            height: 100vh;\n            margin: 0;\n            background-color: black;\n            color: white;\n            font-family: Arial, sans-serif;\n        }\n\n        h1, p {\n            text-align: center;\n        }\n\n        #statusMessage {\n            margin-top: 20px;\n            text-align: center;\n            font-size: 18px;\n            color: #00ff00;\n        }\n\n        #playButton {\n            margin-top: 20px;\n            padding: 10px 20px;\n            background-color: #008CBA;\n            color: white;\n            border: none;\n            border-radius: 5px;\n            cursor: pointer;\n            font-size: 16px;\n        }\n\n        #playButton:hover {\n            background-color: #005f6a;\n        }\n    <\/style>\n<\/head>\n<body>\n    <div>\n        <h1>LEctenna Full Melody with Sound<\/h1>\n        <p>Click the button to play the melody through the speaker and via LEctenna.<\/p>\n        <p id=\"statusMessage\">Status: Preparing&#8230;<\/p>\n        <button id=\"playButton\">Play Melody<\/button>\n    <\/div>\n\n    <script>\n        const TARGET_URL = \"https:\/\/httpbin.org\/post\"; \/\/ Dummy endpoint for testing\n        const statusMessage = document.getElementById(\"statusMessage\");\n        const playButton = document.getElementById(\"playButton\");\n\n        \/\/ Define the melody (frequency in Hz and duration in milliseconds)\n        const melody = [\n            { frequency: 392, duration: 800 }, \/\/ G4\n            { frequency: 440, duration: 800 }, \/\/ A4\n            { frequency: 494, duration: 800 }, \/\/ B4\n            { frequency: 523, duration: 800 }, \/\/ C5\n            { frequency: 494, duration: 800 }, \/\/ B4\n            { frequency: 440, duration: 800 }, \/\/ A4\n            { frequency: 392, duration: 800 }, \/\/ G4\n            { frequency: 349, duration: 1200 }, \/\/ F4\n        ];\n\n        \/\/ Generate a sinusoidal data block for a specific frequency and size\n        function generateSineWaveData(frequency, sizeInBytes) {\n            const data = new Uint8Array(sizeInBytes);\n            const sampleRate = 44100; \/\/ Standard audio sample rate (44.1 kHz)\n            const samplesPerCycle = Math.floor(sampleRate \/ frequency);\n\n            for (let i = 0; i < sizeInBytes; i++) {\n                \/\/ Generate a smooth sinusoidal wave\n                const angle = (2 * Math.PI * (i % samplesPerCycle)) \/ samplesPerCycle;\n                data[i] = Math.round(128 + 127 * Math.sin(angle)); \/\/ Map sine value to 0-255\n            }\n\n            return data;\n        }\n\n        \/\/ Send sinusoidal data continuously for a given note via LEctenna\n        async function playNoteViaLEctenna(frequency, duration) {\n            const dataBlockSize = 256 * 1024; \/\/ Smaller block size for continuous transmission\n            const dataBlock = generateSineWaveData(frequency, dataBlockSize);\n            const endTime = performance.now() + duration;\n\n            while (performance.now() < endTime) {\n                try {\n                    await fetch(TARGET_URL, {\n                        method: \"POST\",\n                        body: dataBlock,\n                        headers: {\n                            \"Content-Type\": \"application\/octet-stream\",\n                        },\n                    });\n                } catch (error) {\n                    console.error(\"Error during transmission:\", error);\n                    statusMessage.textContent = \"Status: Error. Retrying...\";\n                }\n            }\n        }\n\n        \/\/ Play the melody through the Web Audio API\n        function playMelodyViaSound() {\n            const audioContext = new (window.AudioContext || window.webkitAudioContext)();\n            let currentTime = audioContext.currentTime;\n\n            melody.forEach(note => {\n                const oscillator = audioContext.createOscillator();\n                oscillator.type = \"sine\"; \/\/ Sine wave for a smooth sound\n                oscillator.frequency.setValueAtTime(note.frequency, currentTime);\n                oscillator.connect(audioContext.destination);\n                oscillator.start(currentTime);\n                oscillator.stop(currentTime + note.duration \/ 1000);\n\n                currentTime += note.duration \/ 1000; \/\/ Update current time for next note\n            });\n        }\n\n        \/\/ Function to play the melody via both Web Audio API and LEctenna\n        async function playFullMelody() {\n            \/\/ Start playing via speakers (Web Audio API)\n            playMelodyViaSound();\n\n            \/\/ Send the melody to LEctenna for data transmission\n            for (const note of melody) {\n                statusMessage.textContent = `Playing ${note.frequency} Hz for ${note.duration} ms via LEctenna`;\n                await playNoteViaLEctenna(note.frequency, note.duration);\n            }\n\n            statusMessage.textContent = \"Melody finished. Restarting...\";\n        }\n\n        \/\/ Play the melody when the button is clicked\n        playButton.addEventListener(\"click\", () => {\n            playFullMelody();\n        });\n    <\/script>\n<\/body>\n<\/html>\n","protected":false},"excerpt":{"rendered":"<p>LEctenna Full Melody with Sound LEctenna Full Melody with Sound Click the button to play the melody through the speaker and via LEctenna. Status: Preparing&#8230; Play Melody<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"footnotes":""},"class_list":["post-362","page","type-page","status-publish","hentry","entry"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"LEctenna Full Melody with Sound LEctenna Full Melody with Sound Click the button to play the melody through the speaker and via LEctenna. Status: Preparing... Play Melody\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/lectenna.com\/index.php\/audio-over-aux\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"LEctenna - Test your LEctenna\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Audio over AUX - LEctenna\" \/>\n\t\t<meta property=\"og:description\" content=\"LEctenna Full Melody with Sound LEctenna Full Melody with Sound Click the button to play the melody through the speaker and via LEctenna. Status: Preparing... Play Melody\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/lectenna.com\/index.php\/audio-over-aux\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2024-12-31T03:46:16+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2024-12-31T04:15:37+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Audio over AUX - LEctenna\" \/>\n\t\t<meta name=\"twitter:description\" content=\"LEctenna Full Melody with Sound LEctenna Full Melody with Sound Click the button to play the melody through the speaker and via LEctenna. Status: Preparing... Play Melody\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/lectenna.com\\\/index.php\\\/audio-over-aux\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lectenna.com#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/lectenna.com\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lectenna.com\\\/index.php\\\/audio-over-aux\\\/#listItem\",\"name\":\"Audio over AUX\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lectenna.com\\\/index.php\\\/audio-over-aux\\\/#listItem\",\"position\":2,\"name\":\"Audio over AUX\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/lectenna.com#listItem\",\"name\":\"Home\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/lectenna.com\\\/#organization\",\"name\":\"LEctenna\",\"description\":\"Test your LEctenna\",\"url\":\"https:\\\/\\\/lectenna.com\\\/\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/lectenna.com\\\/index.php\\\/audio-over-aux\\\/#webpage\",\"url\":\"https:\\\/\\\/lectenna.com\\\/index.php\\\/audio-over-aux\\\/\",\"name\":\"Audio over AUX - LEctenna\",\"description\":\"LEctenna Full Melody with Sound LEctenna Full Melody with Sound Click the button to play the melody through the speaker and via LEctenna. Status: Preparing... Play Melody\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/lectenna.com\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/lectenna.com\\\/index.php\\\/audio-over-aux\\\/#breadcrumblist\"},\"datePublished\":\"2024-12-31T03:46:16+00:00\",\"dateModified\":\"2024-12-31T04:15:37+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/lectenna.com\\\/#website\",\"url\":\"https:\\\/\\\/lectenna.com\\\/\",\"name\":\"LEctenna\",\"description\":\"Test your LEctenna\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/lectenna.com\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Audio over AUX - LEctenna","description":"LEctenna Full Melody with Sound LEctenna Full Melody with Sound Click the button to play the melody through the speaker and via LEctenna. Status: Preparing... Play Melody","canonical_url":"https:\/\/lectenna.com\/index.php\/audio-over-aux\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BreadcrumbList","@id":"https:\/\/lectenna.com\/index.php\/audio-over-aux\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/lectenna.com#listItem","position":1,"name":"Home","item":"https:\/\/lectenna.com","nextItem":{"@type":"ListItem","@id":"https:\/\/lectenna.com\/index.php\/audio-over-aux\/#listItem","name":"Audio over AUX"}},{"@type":"ListItem","@id":"https:\/\/lectenna.com\/index.php\/audio-over-aux\/#listItem","position":2,"name":"Audio over AUX","previousItem":{"@type":"ListItem","@id":"https:\/\/lectenna.com#listItem","name":"Home"}}]},{"@type":"Organization","@id":"https:\/\/lectenna.com\/#organization","name":"LEctenna","description":"Test your LEctenna","url":"https:\/\/lectenna.com\/"},{"@type":"WebPage","@id":"https:\/\/lectenna.com\/index.php\/audio-over-aux\/#webpage","url":"https:\/\/lectenna.com\/index.php\/audio-over-aux\/","name":"Audio over AUX - LEctenna","description":"LEctenna Full Melody with Sound LEctenna Full Melody with Sound Click the button to play the melody through the speaker and via LEctenna. Status: Preparing... Play Melody","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/lectenna.com\/#website"},"breadcrumb":{"@id":"https:\/\/lectenna.com\/index.php\/audio-over-aux\/#breadcrumblist"},"datePublished":"2024-12-31T03:46:16+00:00","dateModified":"2024-12-31T04:15:37+00:00"},{"@type":"WebSite","@id":"https:\/\/lectenna.com\/#website","url":"https:\/\/lectenna.com\/","name":"LEctenna","description":"Test your LEctenna","inLanguage":"en-US","publisher":{"@id":"https:\/\/lectenna.com\/#organization"}}]},"og:locale":"en_US","og:site_name":"LEctenna - Test your LEctenna","og:type":"article","og:title":"Audio over AUX - LEctenna","og:description":"LEctenna Full Melody with Sound LEctenna Full Melody with Sound Click the button to play the melody through the speaker and via LEctenna. Status: Preparing... Play Melody","og:url":"https:\/\/lectenna.com\/index.php\/audio-over-aux\/","article:published_time":"2024-12-31T03:46:16+00:00","article:modified_time":"2024-12-31T04:15:37+00:00","twitter:card":"summary","twitter:title":"Audio over AUX - LEctenna","twitter:description":"LEctenna Full Melody with Sound LEctenna Full Melody with Sound Click the button to play the melody through the speaker and via LEctenna. Status: Preparing... Play Melody"},"aioseo_meta_data":{"post_id":"362","title":null,"description":null,"keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"WebPage","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2024-12-31 03:46:16","updated":"2025-06-04 12:11:04","seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/lectenna.com\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tAudio over AUX\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/lectenna.com"},{"label":"Audio over AUX","link":"https:\/\/lectenna.com\/index.php\/audio-over-aux\/"}],"_links":{"self":[{"href":"https:\/\/lectenna.com\/index.php\/wp-json\/wp\/v2\/pages\/362","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lectenna.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/lectenna.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/lectenna.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lectenna.com\/index.php\/wp-json\/wp\/v2\/comments?post=362"}],"version-history":[{"count":6,"href":"https:\/\/lectenna.com\/index.php\/wp-json\/wp\/v2\/pages\/362\/revisions"}],"predecessor-version":[{"id":370,"href":"https:\/\/lectenna.com\/index.php\/wp-json\/wp\/v2\/pages\/362\/revisions\/370"}],"wp:attachment":[{"href":"https:\/\/lectenna.com\/index.php\/wp-json\/wp\/v2\/media?parent=362"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}