• Stars
    star
    127
  • Rank 282,790 (Top 6 %)
  • Language
    JavaScript
  • Created almost 10 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Generates waveform like soundcloud.

soundcloud-waveform-generator

SoundCloud-Waveform.js is a simple and small library for JavaScript which generates waveform like soundcloud from audio, as PNG and pixels data of the generated image.

You can change the color of the waveform, the width of bars, gap between bars, generated image width/height. Demo

How to use

Create soundcloud like waveform by calling the generate() function of the SoundCloudWaveform object. The generate() function will return URLs to a PNG file and pixels data of the generated image in its return function.

Parameters of the generate() function

SoundCloudWaveform.generate(file, {
		canvas_width: integer,
		canvas_height: integer,
		bar_width: integer,
		bar_gap : float,
		wave_color: string,
		download: boolean,
		onComplete: callback function
	});
Parameter Value
file File-object
canvas_width Width of the final image. Default is 453
canvas_height Height of the final image. Default is 66
bar_width Width of the bars. Default is 1
bar_gap Width of the gaps between bars. MUST BE FLOAT VALUE. Default is 0.2
wave_color Color of the outputted waveform. Default is '#666'
download Download final image. Default is false
onComplete A function to handle the data sent back, 2 parameters. First one is the URL to the PNG, second is pixels data of the generated image.

Example usage

HTML

<input type="file">
<canvas width='453' height='66' id='showcase'></canvas>

JavaScript

document.querySelector('input').addEventListener('change', function(e) {
    SoundCloudWaveform.generate(e.target.files[0], {
    	onComplete: function(png, pixels) {
			var canvas = document.getElementById('showcase');
			var context = canvas.getContext('2d');
			context.putImageData(pixels, 0, 0);
		}
    });
}, false);

More Repositories

1

bash-guide

A guide to learn bash
11,268
star
2

like-on-github

Chrome extension - Link a repository with the extension and automatically save the links to content you like
JavaScript
230
star
3

trending-guides

List of trending guides on github curated over time
116
star
4

furnish-js

Let the classes on DOM elements generate the CSS for you.
JavaScript
102
star
5

git-random

Chrome extension - Replaces new tab with random github user's profile
HTML
78
star
6

mjml-cms

Extended version of the MJML editor with support for dynamic templating.
TypeScript
40
star
7

github-pr

CLI tool to automatically create pull request on Github
Shell
36
star
8

go-mongo-indexer

CLI tool to manage mongo database collection indexes through json files
Go
26
star
9

tweet-cli

🐦 Tweet directly from your cli without any hassle
PHP
24
star
10

ts-grpc-example

gRPC example with typescript and nodejs
JavaScript
20
star
11

mysql-migrate

Version control your database with tiny one migration script
PHP
14
star
12

cut-url

Chrome Extension - To shorten your URLs in a Shortcut.
JavaScript
12
star
13

tevo

A jenkins tool to run jobs from command line
PHP
10
star
14

idnan.github.io

The code behind
CSS
9
star
15

docker-elk

The ELK stack powered by Docker and Compose
8
star
16

Easy-Tabs

Allows you to easily manage your tabs. Now you can easly pin/unpin, reload and hide/unhide with single clicks
JavaScript
6
star
17

docker-mmonit

MMonit docker
Dockerfile
6
star
18

composer-permission

Composer script handling directories permissions by making them writable
PHP
6
star
19

PHP-URLShortener

A basic URL shortener developed in PHP
PHP
5
star
20

raycast-utc-time

A simple raycast extension to quickly display and copy the current UTC time to the clipboard
Shell
4
star
21

jsLog

Displays logs in an overlay on top of your site. Useful for web development.
JavaScript
3
star
22

pong

A javascript version of the classic 1972 arcade game Pong!
JavaScript
3
star
23

jenkins-deploy

A jenkins tool to run jobs from command line
PHP
3
star
24

instanttag

HTML
2
star
25

vagrant-shell-provision

Script to provision Vagrant with shell
Shell
1
star