-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from ishythefishy/theoretical-scales
Identify theoretical scales and provide a link to the alternative
- Loading branch information
Showing
20 changed files
with
427 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,36 @@ | ||
# Fretonator | ||
# www.fretonator.com | ||
|
||
This project was generated using [Nx](https://nx.dev). | ||
|
||
<p align="center"><img src="https://raw.githubusercontent.com/nrwl/nx/master/nx-logo.png" width="450"></p> | ||
|
||
🔎 **Nx is a set of Extensible Dev Tools for Monorepos.** | ||
|
||
## Quick Start & Documentation | ||
|
||
[Nx Documentation](https://nx.dev/angular) | ||
|
||
[10-minute video showing all Nx features](https://nx.dev/angular/getting-started/what-is-nx) | ||
|
||
[Interactive Tutorial](https://nx.dev/angular/tutorial/01-create-application) | ||
|
||
## Adding capabilities to your workspace | ||
|
||
Nx supports many plugins which add capabilities for developing different types of applications and different tools. | ||
|
||
These capabilities include generating applications, libraries, etc as well as the devtools to test, and build projects as well. | ||
|
||
Below are some plugins which you can add to your workspace: | ||
|
||
- [Angular](https://angular.io) | ||
- `ng add @nrwl/angular` | ||
- [React](https://reactjs.org) | ||
- `ng add @nrwl/react` | ||
- Web (no framework frontends) | ||
- `ng add @nrwl/web` | ||
- [Nest](https://nestjs.com) | ||
- `ng add @nrwl/nest` | ||
- [Express](https://expressjs.com) | ||
- `ng add @nrwl/express` | ||
- [Node](https://nodejs.org) | ||
- `ng add @nrwl/node` | ||
[![Netlify Status](https://api.netlify.com/api/v1/badges/87d9f619-8f13-47e8-99cc-5167db7294a6/deploy-status)](https://app.netlify.com/sites/fretonator/deploys) | ||
|
||
## Generate an application | ||
<img src="https://www.fretonator.com/assets/img/og_twitter.png"> | ||
|
||
Run `ng g @nrwl/angular:app my-app` to generate an application. | ||
## Thanks for checking out the Fretonator! | ||
|
||
> You can use any of the plugins above to generate applications as well. | ||
I’m a qualified music teacher that (somehow) ended up working as a lead software engineer (it’s a long story), and I built this for my husban️d. | ||
|
||
When using Nx, you can create multiple applications and libraries in the same workspace. | ||
He’s a phenomenal guitarist, and over the past few years has worked on learning modes and scale theory for the guitar (with a little help from me). Obviously, the internet is great for this kind of stuff, but what he felt the world wide web was lacking was an interactive and informative tool to could use in his practice sessions that had everything he needed on one single page. | ||
|
||
## Generate a library | ||
## Enter the Fretonator! | ||
|
||
Run `ng g @nrwl/angular:lib my-lib` to generate a library. | ||
The Fretonator is your new interactive tool for learning common modes on the guitar, understanding the chord theory behind the modes, and most importantly - having a jam. | ||
|
||
> You can also use any of the plugins above to generate libraries as well. | ||
I am gratefully welcoming feedback from musicians, pull requests from software engineers, and anything else you are willing to contribute. | ||
|
||
Libraries are sharable across libraries and applications. They can be imported from `@fretonator/mylib`. | ||
Thank you and happy jamming! | ||
|
||
## Development server | ||
|
||
Run `ng serve my-app` for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files. | ||
## Technical | ||
|
||
## Code scaffolding | ||
The Fretonator was built with: | ||
|
||
Run `ng g component my-component --project=my-app` to generate a new component. | ||
``` | ||
Angular | ||
Angular Universal | ||
Angular Prerender | ||
Netlify | ||
``` | ||
|
||
## Build | ||
|
||
Run `ng build my-app` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. | ||
|
||
## Running unit tests | ||
|
||
Run `ng test my-app` to execute the unit tests via [Jest](https://jestjs.io). | ||
|
||
Run `nx affected:test` to execute the unit tests affected by a change. | ||
|
||
## Running end-to-end tests | ||
|
||
Run `ng e2e my-app` to execute the end-to-end tests via [Cypress](https://www.cypress.io). | ||
|
||
Run `nx affected:e2e` to execute the end-to-end tests affected by a change. | ||
|
||
## Understand your workspace | ||
|
||
Run `nx dep-graph` to see a diagram of the dependencies of your projects. | ||
|
||
## Further help | ||
|
||
Visit the [Nx Documentation](https://nx.dev/angular) to learn more. | ||
``` | ||
This project was generated using [Nx](https://nx.dev). | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
apps/fretonator-web/src/app/common/fretonator/is-theoretical-scale.pipe.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { IsTheoreticalScalePipe } from './is-theoretical-scale.pipe'; | ||
|
||
describe('IsTheoreticalScalePipe', () => { | ||
let pipe: IsTheoreticalScalePipe; | ||
|
||
beforeEach(() => { | ||
pipe = new IsTheoreticalScalePipe(); | ||
}); | ||
it('create an instance', () => { | ||
expect(pipe).toBeTruthy(); | ||
}); | ||
|
||
it('returns true for a scale with a double flat in', () => { | ||
expect(pipe.transform(['C', 'D𝄫'])).toBe(true); | ||
}); | ||
|
||
it('returns true for a scale with a double sharp in', () => { | ||
expect(pipe.transform(['Cx', 'D'])).toBe(true); | ||
}); | ||
|
||
it('returns false for scales without double flat or double sharp', () => { | ||
expect(pipe.transform(['C', 'D'])).toBe(false); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
apps/fretonator-web/src/app/common/fretonator/is-theoretical-scale.pipe.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import { Scale } from '../../util/types'; | ||
|
||
@Pipe({ | ||
name: 'isTheoreticalScale' | ||
}) | ||
export class IsTheoreticalScalePipe implements PipeTransform { | ||
|
||
transform(scale: Scale): boolean { | ||
for (const note of scale) { | ||
if(note.indexOf('x') !== -1 || note.indexOf('𝄫') !== -1) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...fretonator-web/src/app/common/fretonator/scale-map/get-enharmonic-equivalent.pipe.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { GetEnharmonicEquivalentPipe } from './get-enharmonic-equivalent.pipe'; | ||
|
||
describe('GetHarmonicEquivalentPipe', () => { | ||
it('create an instance', () => { | ||
const pipe = new GetEnharmonicEquivalentPipe(); | ||
expect(pipe).toBeTruthy(); | ||
}); | ||
|
||
it('returns A♭ for G#', () => { | ||
const pipe = new GetEnharmonicEquivalentPipe(); | ||
expect(pipe.transform('G#')).toBe('A♭'); | ||
}) | ||
}); |
20 changes: 20 additions & 0 deletions
20
apps/fretonator-web/src/app/common/fretonator/scale-map/get-enharmonic-equivalent.pipe.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import { Enharmonics } from '../../../util/constants'; | ||
|
||
@Pipe({ | ||
name: 'getEnharmonicEquivalent' | ||
}) | ||
export class GetEnharmonicEquivalentPipe implements PipeTransform { | ||
|
||
transform(note: string): string { | ||
for (const group of Enharmonics) { | ||
if (group.indexOf(note) === 0) { | ||
return group[1] | ||
} | ||
|
||
if (group.indexOf(note) === 1) { | ||
return group[0] | ||
} | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...retonator-web/src/app/common/fretonator/scale-map/get-enharmonic-router-link.pipe.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { GetEnharmonicRouterLinkPipe } from './get-enharmonic-router-link.pipe'; | ||
|
||
describe('GetEnharmonicRouterLinkPipe', () => { | ||
let pipe; | ||
beforeEach(() => { | ||
pipe = new GetEnharmonicRouterLinkPipe(); | ||
}); | ||
it('create an instance', () => { | ||
expect(pipe).toBeTruthy(); | ||
}); | ||
|
||
it('returns correctly for g sharp ionian', () => { | ||
expect(pipe.transform('g', 'sharp', 'ionian')).toStrictEqual(['/', 'a', 'flat', 'ionian']); | ||
}); | ||
}); |
28 changes: 28 additions & 0 deletions
28
apps/fretonator-web/src/app/common/fretonator/scale-map/get-enharmonic-router-link.pipe.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import { RouterLink } from '@angular/router'; | ||
import { Enharmonics } from '../../../util/constants'; | ||
|
||
@Pipe({ | ||
name: 'getEnharmonicRouterLink' | ||
}) | ||
export class GetEnharmonicRouterLinkPipe implements PipeTransform { | ||
|
||
transform(note: string, noteExtenderString: string, mode: string): string[] { | ||
let newNote; | ||
|
||
for(const group of Enharmonics) { | ||
if (group[0].includes(note.toUpperCase())) { | ||
newNote = group[1].charAt(0).toLowerCase(); | ||
} | ||
|
||
if (group[1].includes(note.toUpperCase())) { | ||
newNote = group[0].charAt(0).toLowerCase(); | ||
} | ||
} | ||
|
||
const newNoteExtender = noteExtenderString === 'sharp' ? 'flat' : 'sharp'; | ||
|
||
return ['/', newNote, newNoteExtender, mode]; | ||
} | ||
|
||
} |
Oops, something went wrong.