Giter Site home page Giter Site logo

sazdg / chord-finder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from manuelvargas1251/chord-finder

0.0 0.0 0.0 5.25 MB

๐ŸŽน๐ŸŽต Client web application to find chords through keyboard UI

Home Page: https://mnl.space/Chord-Finder/

JavaScript 89.91% HTML 4.64% CSS 5.31% Shell 0.14%

chord-finder's Introduction

Programming language Version Build Status - enhancement/coverage Coverage Status Jest Unit Tests

Chord Finder ๐ŸŽน

This is a js web application that tells you what chord you are playing on the piano in any inversion. Click or keypress the notes to build your chord! If you select two notes it will tell you what the interval is between those two notes.

I started by rewriting my previous C++ chord finder console application in javascript and added the web interface as I went.

[View Web Application]

Event Handlers

Code is triggered by clicking or keypressing on the keyboard UI. Also using Automatic Semicolon Insertion.

// mouse click event
$(".key").click(function () {
	//toggle key color key when pressed
	//pass note id to add to chord
	$(this).toggleClass("pressed")
	processDOMChord($(this).attr('id'), userChordIds)
})

// keyboard event
$("html").keypress(function (element) {
	let noteCode = keyMapping[element.which]
	$("#" + noteCode).toggleClass("pressed")
	processDOMChord(noteCode, userChordIds)
	console.log(noteCode)
})

Unit Testing & Coverage

Using Facebook's Jest for unit testing. Configured Travis-CI for continuos integration on every commit and pull request as well as coverage reporting from Coveralls

Test Configuration in package.json

{
	"build": "node env",
	"test": "jest --coverage --coverageReporters=text-lcov | coveralls",
	"jest-watch": "jest --watchAll --coverage",
	"jest": "jest --coverage --coverageReporters=text-lcov | coveralls"
}

For local testing, remove the coveralls flag, else err response 422

{
	"build": "node env",
	"test": "jest --coverage --coverageReporters=text-lcov",
	"jest-watch": "jest --watchAll --coverage",
	"jest": "jest --coverage --coverageReporters=text-lcov"
}

Development

// download the repo locally from github and cd into the folder
gh repo clone ManuelVargas1251/Chord-Finder
cd Chord-Finder

// install browserify globally
npm install -g browserify

// download node modules locally
npm install

// run js tests
npm test

// build new bundle
browserify src/js/index.js > bundle.js

Environments

By using https://raw.githack.com/ I created a working lower environments to test code in any committed branch. I was also able to provide test statuses for every branch through Travis CI and Coveralls.

Production

Build Status - Master Coverage Status - Master

Development

Build Status - Development Coverage Status - Development

Reference

Musical Chord Wiki

Musical Interval Wiki

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.