Git Product home page Git Product logo

guitar's Introduction

Guitar

It's a virtual guitar record-a-synthesize-amatronic web application.

Demo animation

Try it out here.

You can copy and paste entire webpages containing guitar tabs and it'll try to load all it can.

Play back notes by pressing "almost any" key (at least on US keyboards), with the fretboard focused (or no control focused). You can rock back and forth between different fingers on different keys, or just pick one, whatever feels natural.

Record notes by clicking on the fretboard. Secondary click is a shortcut to an open string. You can do this easily in real life from any position, so it makes sense to be able to do it from any position on the virtual guitar too. Tertiary mouse button (middle mouse button) does a bend, although bends are not recorded yet. Timing is also not recorded yet. So it's not very useful for recording tabs, although you could certainly use it as an interactive chart at least.

You can choose any scale to highlight, a feature I first implemented in Tri-Chromatic Keyboard. It should be much more useful here, since you can learn how to play the guitar with it! (as opposed to an instrument that virtually no-one has, including me)


Uses tuna audio effects library. The guitar synthesis algorithm is from guitar-synth.

The tablature parser created for the app is available separately as a module here.

Development

npm install
npm run watch
npx live-server

The watch task compiles CoffeeScript when it changes.

live-server is a web server that reloads the page when files change. You can use any web server, alternatively.

Deployment

This app is deployed to GitHub Pages using the gh-pages module.

npm run build
npm run deploy

TODO

  • Better mobile support

    • Play back recorded notes with a button

    • Multitouch

  • Make web application self-explanatory and test accessibility

  • Make bending (MMB) less ridiculous

  • Record chords (with multitouch or a modifier key, maybe also have some sort of toggle)

  • Strum chords in playback, maybe have up/down arrows for up/down strumming

  • Source mapping, so you can see and keep the rhythm, articulations, and comments as context

  • Record, parse, and play back articulations such as slides, bends, vibratos, hammer-ons, and pull-offs

  • Different sound for sliding than for plucking/picking

  • Different sound in general, ha, since it's not great...

  • Support for different tunings

  • Allow configuring the effects chain (at least toggle distortion on/off)

  • Clear way set focus to the fretboard for playback (unfocusing the tablature editor), via the keyboard

  • Tablature editor

    • Scroll with the playback position

    • Make the playback position indicator different while playing, so it's clearer whether its showing what's playing or what's next

    • Set the position in the song when you click in the tablature editor

    • Handle multi-digit numbers when highlighting notes

    • Insert and overwrite notes with the virtual guitar fretboard (as opposed to just appending (which is a specific form of inserting))

    • Multi-String Cursor mode

      • Shift+click to select from the existing selection anchor

      • Disable or override double-click and triple-click... and quad-click (yeah, for real)

      • Why does the selection style change on mouseup?

    • Clearer overwrite mode cursor

    • Custom syntax highlighting

      • Highlight tablature with articulations and everything

      • Highlight << misalignment markers as erroneous

    • Maybe add some padding with renderer.setPadding?

    • Paste from contentEditable to detect a <pre> containing the tabs? Just to eliminate noise, and if it keeps surrounding text (context) while editing, extra output in what you might save / the work in removing it.

  • MusicXML? MIDI?

guitar's People

Contributors

1j01 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

guitar's Issues

Add a README image

Add a screenshot to the README.

Maybe show off multiple themes like I did for Wavey:

screenshot showing off different themes in stripes

Here's the one on my website currently:
guitar app screenshot of the fretboard

Improve feature discoverability

You have to read the README in order to know about the tablature parsing feature

You can copy and paste entire webpages containing guitar tabs and it'll try to load all it can.

And the GitHub repo isn't even linked from the app!

Also other things like right click to do an open string, middle click to bend.

Toggle displaying note names

Maybe have a toggle between note names, fret numbers, and none, or just also display fret numbers outside, either at the top or bottom (but statically; not as an option)

Improve fretboard note playing indicators

Currently it looks broken, like it's got an offset that's not supposed to be there.
It is actually intentional, it's offset so it overlaps the fret that that would be contacted physically.

It should be something more like a circle (where you'd put your finger), blobbily connected to an oval on the fret, or a highlight of the fret. It might look like a bombshell, which might be weird. Maybe it shouldn't be connected? idk
The highlight that represents a finger should move along with your mouse / finger / etc. (and be centered for playback, or if articulations are implemented, it could slide and stuff too)

Safari error

Safari error for coffee script
Guitar not show and run

Synth freaks out at really high notes and starts trickling NaNs into the pipeline

It starts feeding back on itself in a way that it's not supposed to and it results in really loud noises ending up as Infinities, which cause NaNs which cause NaNs which cause NaNs which cause an error in tuna.js which can break the sound completely and/or make the string partially invisible; it can also make the particular string permanently incredibly loud, for all the notes (because I have it copy over the array data when resizing it to change the period)

Web MIDI output

Use the fretboard as a MIDI instrument interface in other apps (it does work with other apps, doesn't it? it might not; that would be lame; it might only be able to output to hardware midi devices)

(Could also support MIDI input in the future, and MIDI files as input, so you can transcribe other music to guitar tablature more easily)

Save tablature to local storage

(Could maybe do collaborative editing with Firepad in the future; I've done something fairly reasonable in jspaint (in the abstract) with different types of sessions and session types + document IDs in the URL, but I'd rather have it save locally as well, always have a local copy with your latest changes even in collaborative mode - for both apps / for any app)

Record what you play, with timing, by default

Including playing back tabs, because you can make interesting new things by pressing multiple notes at once and making new rhythms; you could alternate between pressing 2 and 3 or 4 different keys at once, etc.

"So much of art, so much of creation is discovery" -Bret Victor, Inventing on Principle at ~5:24

And it's easy to discover interesting new things with this. I want to make capturing those discoveries easy, frictionless, effortless, literally not something you have to think about. You can't know when you're about to do something creatively interesting, when you're about to improvise something new and fun, or just make an accidental variation on a melody, before you do it, you can only recognize it afterwards; so it makes sense--that is, it follows that our tools should support recording retroactively.
(I call it "precording"; you could also call it "retrocording")

Multi-Row Cursor doesn't apply until mouse is released

The cursor is effectively in one location until you release the mouse, so it inserts or deletes characters on a single row, which can lead to misalignment and then the Multi-Row Cursor mode stopping its effect entirely.

Demonstration of typing while selecting:

Add scale highlighting

Like I've done in Tri-Chromatic Keyboard

I think this would be really helpful, especially for a physical instrument (as opposed to something virtually no one in the world (including me) has a physical analog to), because you could learn from it and apply it back to the real world. I guess there are charts for this sort of thing, but... hm, looking at google images, it's pretty overwhelming. The least overwhelming one is a photo of a guitar with some circles with note names added.

Crashes eventually

I'm seeing this in Chrome (on Windows 10).

Should investigate and see if there are memory leaks - I imagine that's what's going on!

Separate how you bend from how you start playing a string

So that you can start from a bend.

It would probably be fine for many mice, but what about a single-button mouse? If you're using modifier keys instead of specific mouse buttons, it probably wouldn't work, by default. It could work, tho, by listening for a modifier key, or another key like B if that's less weird.

Skeuomorphic POV mode (or physical scale printouts?)

It can be fun to play based on scales on the screen without looking at the guitar you're holding, but when you need to (especially when the frets get closer together), looking between your guitar and the app with its representation and holding in mind the relation could be easier,
especially since the strings at the top on the screen are lower physically (assuming right handed guitar/tuning/player) unless you're holding it weird.
It could be easier with: literal "skew-o-morphism"!
(skewing it into perspective so it's more like what you're seeing)
of course augmented reality would be better...
or maybe... get this... printing out scales to slip under the strings of the neck of the guitar
they would need to avoid the frets, and they might affect the sound if it's not flush enough, but it's doable; just need some slits for the frets (which could be a pain to cut out), and you'd need to specify measurements
and most printer paper isn't long enough for a full size guitar so it should let you split it up (it should still only need one A4(?) piece of paper, just two pieces)
yeah, guitar scale sleeves, I want to try that

Transcribe MIDI to tablature automatically / semi-interactively

Scope

For a first pass, audio transcription can be left to other tools that convert audio to MIDI, like Basic Pitch.
That said, Basic Pitch is open source, so it could be integrated directly, eventually (especially if tensorflow.js is supported for in-browser inference; I think it requires a Python backend currently).

Problem Statement

I feel like the fundamental shortcoming of transcription systems is their all-or-nothing/once-off approach to automation. Transcription tools are either are all manual (a digital equivalent of writing sheet music by hand) or they are a one-off process that you can trigger, but which isn't interactive.

With automatic transcription systems that aren't interactive, if the result isn't quite right, you can go back and change settings (if there are any) and try again, but the settings don't necessarily work well across the whole song, especially if it has tempo changes, and if the measures don't line up properly, usually none of the note and rest durations chosen during quantization will make sense.

Also, with fretted instrument transcription, most programs seem to output tablature that is impossible to play, not really taking into consideration hand geometry. In general, a MIDI file may indeed be impossible to play, but, it feels like they're not even trying, idk.

Solution Strategy

  • A slider at the top of the fretboard lets you adjust the hand position, to anywhere along the fretboard, and the transcription system will try to find fingerings close to this hand position.
  • The hand position can be recorded at many points during the song.
  • Capo position, tuning, and tempo changes can also be recorded anywhere in the song.
  • (The transcription system should also try to pick fingerings that are easy to play in succession, ideally, but that seems more complicated. For instance, a diagonal arrangement of fingers may be slid to parallel easily, but the opposite diagonal often warrants switching which fingers are used for which string.)
  • If it doesn't detect how measures should be broken up right, you can manually move bars around, that separate the measures, and it will recompute the transcription/quantization for just the affected measures. If you adjust tempo change events, it recomputes the bars after the tempo change.
  • Tempo changes (and even tuning changes) can be gradual, so support for curves could be useful, but that's pretty advanced. That said, when designing the "change events" system, it may be better to go ahead and design it as a "curve editor", since it would need some sort of timeline anyway.
  • When you select a note, you should be able to pick any equivalent note to replace it with, with exact matches on other strings highlighted, and different-octave matches highlighted differently.
  • (Ideally, when adjusting settings that affect the automation, changes you've made already should be persisted if possible, such as deleting a note or picking a different fingering for it, but this is pretty complicated in general. For instance, adjusting settings may generate different numbers of notes, so if you adjusted the fingering of a note, where there are now two, should it affect both? Or if there were two and you adjusted one and there's now only one, should the adjustment apply to it, or should it be left, like the originally-unadjusted note?)
    • (It could at least let you know if changes you made will be overwritten.)

TERRIBLE variable names in this project

Inconsistent styling, and unpleasant to work with because I can't tell what things are just by looking at them
For instance I got tripped up by the difference between str and s, which are both abbreviations of the word "string", but one of which is a GuitarString and one of which is a number (an index into the array of guitar strings). Neither are strings, which is funny, but, ay-ai-ai, not good, not good stuff

Can't avoid auto-parsing with multi-row selection disabled

Previously there was only multi-row selection; I added a toggle for it, but I apparently need to do something on click, like prevent default, or rework how the unfocusing detection works

A demonstration of trying to undo and fix the alignment of part of some tabs:

issue after adding ability to disable multi row cursor

...I think clicking on the selection (such as might start a drag) is what causes it to unfocus
(with the multiline selection preventing that possibility - but we do want that possibility)

Selection clears redo

Also it doesn't restore selections when undoing/redoing, it just selects everything.
redo broken by selection

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.