{"id":23409759,"url":"https://github.com/siy1121/waveformviewdemo","last_synced_at":"2025-04-12T01:17:32.001Z","repository":{"id":48103626,"uuid":"124391299","full_name":"SIY1121/WaveFormViewDemo","owner":"SIY1121","description":"Provides a view to display audio waveforms.","archived":false,"fork":false,"pushed_at":"2021-08-06T13:42:05.000Z","size":7280,"stargazers_count":48,"open_issues_count":3,"forks_count":18,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-12T01:17:25.660Z","etag":null,"topics":["android","android-library","audio-visualizer","kotlin-android"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SIY1121.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-08T12:54:15.000Z","updated_at":"2024-09-13T01:22:03.000Z","dependencies_parsed_at":"2022-08-12T18:40:38.487Z","dependency_job_id":null,"html_url":"https://github.com/SIY1121/WaveFormViewDemo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SIY1121%2FWaveFormViewDemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SIY1121%2FWaveFormViewDemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SIY1121%2FWaveFormViewDemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SIY1121%2FWaveFormViewDemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SIY1121","download_url":"https://codeload.github.com/SIY1121/WaveFormViewDemo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501858,"owners_count":21114684,"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","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":["android","android-library","audio-visualizer","kotlin-android"],"created_at":"2024-12-22T16:13:15.871Z","updated_at":"2025-04-12T01:17:31.977Z","avatar_url":"https://github.com/SIY1121.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WaveFormView\n\u003cimg src=\"https://github.com/SIY1121/WaveFormViewDemo/blob/master/screenshots/wfv.png\" width=\"50%\"/\u003e\n\nWaveFormView provides a view to display audio waveforms.\n\nGenerating waveforms at runtime, you don't have to prepare data in advance.\n\n**Note : It takes a few seconds to generate**\n\n# Screenshots\n\u003cimg src=\"https://github.com/SIY1121/WaveFormViewDemo/blob/master/screenshots/sample1.png\" width=\"40%\"/\u003e\u003cimg src=\"https://github.com/SIY1121/WaveFormViewDemo/blob/master/screenshots/sample2.png\" width=\"40%\" /\u003e\n\n# Importing the Library\nAdd the following dependicity to your `build.gradle` file.\n\n```\ndependencies {\n    repositories {\n        jcenter()\n    }\n    compile 'space.siy:waveformview:1.0.0'\n}\n```\n\n# Usage\nYou can see full code at [MainActivity.kt](https://github.com/SIY1121/WaveFormViewDemo/blob/master/app/src/main/java/space/siy/waveformviewdemo/MainActivity.kt)\n\n```kotlin\n//Open From Assets Folder\nval afd = assets.openFd(\"jazz_in_paris.mp3\")\n\n//Build WaveFormData\nWaveFormData.Factory(afd.fileDescriptor, afd.startOffset, afd.length)\n        .build(object : WaveFormData.Factory.Callback {\n            //When Complete, you can receive data and set to the view\n            override fun onComplete(waveFormData: WaveFormData) {\n                waveFormView.data = waveFormData\n\n                //Initialize MediaPlayer\n                val player = MediaPlayer()\n                player.setDataSource(afd.fileDescriptor, afd.startOffset, afd.length)\n                player.prepare()\n                player.start()\n\n                //Synchronize with MediaPlayer using WaveFormView.Callback\n                waveFormView.callback = object : WaveFormView.Callback {\n                    override fun onPlayPause() {\n                        if (player.isPlaying)\n                            player.pause()\n                        else\n                            player.start()\n                    }\n                    override fun onSeek(pos: Long) {\n                        player.seekTo(pos.toInt())\n                    }\n                }\n\n                //You have to notify current position to the view\n                Handler().postDelayed(object : Runnable {\n                    override fun run() {\n                        waveFormView.position = player.currentPosition.toLong()\n                        Handler().postDelayed(this, 20)\n                    }\n                }, 20)\n\n            }\n\n            override fun onProgress(progress: Float) {\n                progressBar.progress = (progress*10).toInt()\n            }\n        })\n```\n\n# Customization\nYou can change block style via xml and program.\n\nThe following xml shows all attributes.\n\n\n```xml\n\u003cspace.siy.waveformview.WaveFormView\n        android:id=\"@+id/waveFormView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        app:blockColor=\"@color/white\"\n        app:blockColorPlayed=\"@color/red\"\n        app:showTimeText=\"true\"\n        app:textColor=\"@color/white\"\n        app:textBgColor=\"@color/black\"\n        app:blockWidth=\"10\"\n        app:topBlockScale=\"1\"\n        app:bottomBlockScale=\"0.5\"\n        app:peakMode=\"peakmode_average\"\n        app:secPerBlock=\"0.1\" /\u003e\n```\n# Document\n\nSee [here](https://github.com/SIY1121/WaveFormViewDemo/blob/master/waveformview/build/markdown/space.siy.waveformview/index.md).\n\n# Requirement\nSupports Android 5.0+\n\nWaveFormView uses MediaCodec supporting 5.0+ to generate waveform at runtime.\n\n# Lisence\n\n\u003e Licensed under the Apache License, Version 2.0 (the \"License\");\n\u003e you may not use this work except in compliance with the License.\n\u003e You may obtain a copy of the License in the LICENSE file, or at:\n\u003e\n\u003e  [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\u003e\n\u003e Unless required by applicable law or agreed to in writing, software\n\u003e distributed under the License is distributed on an \"AS IS\" BASIS,\n\u003e WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\u003e See the License for the specific language governing permissions and\n\u003e limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiy1121%2Fwaveformviewdemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiy1121%2Fwaveformviewdemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiy1121%2Fwaveformviewdemo/lists"}