{"id":26959176,"url":"https://github.com/git-toni/tried-n-failed","last_synced_at":"2026-02-09T13:06:34.789Z","repository":{"id":70136521,"uuid":"87227946","full_name":"git-toni/tried-n-failed","owner":"git-toni","description":null,"archived":false,"fork":false,"pushed_at":"2017-04-04T19:43:18.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T04:36:58.742Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/git-toni.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-04-04T19:42:44.000Z","updated_at":"2017-04-04T19:42:44.000Z","dependencies_parsed_at":"2023-02-24T10:15:11.717Z","dependency_job_id":null,"html_url":"https://github.com/git-toni/tried-n-failed","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/git-toni/tried-n-failed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-toni%2Ftried-n-failed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-toni%2Ftried-n-failed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-toni%2Ftried-n-failed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-toni%2Ftried-n-failed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/git-toni","download_url":"https://codeload.github.com/git-toni/tried-n-failed/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/git-toni%2Ftried-n-failed/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270108533,"owners_count":24528763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-03T04:37:00.943Z","updated_at":"2026-02-09T13:06:34.780Z","avatar_url":"https://github.com/git-toni.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"## Compute Waveform of Audio track from frontend\n\nGiven a remote `src`, make the browser read the file, and incrementally \"draw\" the waveform.\n\nI've got:\n- Audiofile duration. \n- WebAudio's `AudioContent` processing pipeline\n\nProblems:\n\n- `CORS`\n  - Cannot receive header field `Content-Length` unless server allows it\n  - Cannot receive file chunk by chunk via `Range: bytes=100-1800` header(req) unless server allows via `Allow-Ranges`\n\n\nCode:\n\n```javascript \n// Get contentlength\n//var xmlhttp = new XMLHttpRequest();\n  //xmlhttp.overrideMimeType('text/xml');\n\n  xmlhttp.onreadystatechange = function () {\n    if (xmlhttp.readyState == 4 \u0026\u0026 xmlhttp.status == 200) {\n      console.log(xmlhttp.getAllResponseHeaders())\n      console.log('clen',xmlhttp.getResponseHeader('Content-Length'))\n      //var size = xmlhttp.getResponseHeader('Content-Length');//get file size\n      //fileSize = size\n      //var kbit=size/128;//calculate bytes to kbit\n      //var kbps= Math.ceil(Math.round(kbit/duration)/16)*16;\n      //console.log(kbps);\n    }\n  };\n  xmlhttp.open(\"HEAD\", audioUrl, true);\n  //xmlhttp.setRequestHeader(\"Access-Control-Expose-Headers\",\"Content-Length\")\n\n  xmlhttp.send();\n  \n//OR\naxios.head(audioUrl).then((res)=\u003e res.getAllResponseHeaders())\n```\nProcessing Pipeline:\n\n```javascript\nlet url ='https://archive.org/download/foot004/foot004_01-zucchini-snow.mp3'\nlet aud = new Audio(url);\naud.preload='auto'\n\nlet ctx = new AudioContext()\nvar analyser = ctx.createAnalyser();\n\nfunction onLoad(){\n  var sourceNode = ctx.createMediaElementSource(aud)\n  sourceNode.connect(analyser);\n  analyser.connect(ctx.destination);\n  getData()\n  \n}\nvar canvas  = document.createElement('canvas')\nfunction getData(){\n  //var dataArray = new Uint8Array(2048);\n  //analyser.getByteTimeDomainData(dataArray);\n  var freqByteData = new Uint8Array(analyser.frequencyBinCount);\n  analyser.getByteFrequencyData(freqByteData);\n  console.log(freqByteData)\n  //analyser.getByteTimeDomainData(freqByteData);\n\n  //console.log(dataArray)\n  //setTimeout(()=\u003e getData(),1000)\n}\nwindow.addEventListener('load', onLoad, false)\n//aud.addEventListener('progress',()=\u003e console.log('progress'),false)\n///console.log(aud.buffered.start(0)))\n\naud.addEventListener('loadedmetadata', ()=\u003e{\n  console.log('METADATA DONE',aud.duration)\n})\n\naud.addEventListener('canplay',()=\u003e{\n  //console.log('i can play')\n  //aud.play()\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgit-toni%2Ftried-n-failed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgit-toni%2Ftried-n-failed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgit-toni%2Ftried-n-failed/lists"}