SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2012-03-11 21:13:00

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Chords! (a CLI piano reference)

Chords! is a CLI piano reference built in Python+Curses. it allows you to select a root-key and then a chord for that. the program then displays the separate notes from the chord, as well as the pianokeys to play (on a cute tiny virtual piano!). along with the chord it will also display the scale for the root-note.

since i've built this for myself primarily, it also has a feature for displaying the pckeys. this is for software which allows you to play a keyboard through your pc-keyboard-keys. an example of a piece of software that has this is Renoise.

to use it you need to have python+curses. i've looked but am not certain if it is a separate package or if curses comes with python by default. sorry. maybe someone more knowledgeable than me can help out in this department.

here is a screenshot:

chords.png

now, if you're interested, go here: http://pastebin.com/XMdtGBw0
copy-paste that into a file called chords.py, then do

chmod +x chords.py

to make it executable.
then run

python chords.py

to start it up.

this is the CHORDS_README.txt :

Chords!
Roald Blijleven (rhowaldt@gmail.com), 2012

Chords! is a CLI piano-reference written in Python+Curses.
it also has reference built in for using a pc-keyboard to play notes
(as, for example, Renoise uses).

these are the relevant keys to press:

Arrow-keys: navigate the 'notes' and 'subnotes' sections.
Tab: switch between the 'notes' and 'subnotes' sections.
Enter: select a chord to display (the scale is displayed as well).
F1: Switch between 3 scales: Major, Natural/Harmonic/Melodic Minor.
F2: Switch between notes of the sharp (#) and flat (b) form.
F3: Switch between the display of notes, pckeys or nothing on the keyboard.

that's about all i have to say about that... hope this is of use to someone, or maybe inspire others to start working with Python+Curses, because, as you can see, it is pretty cool smile

Offline

Be excellent to each other!

#2 2012-03-11 21:33:26

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,163
Website

Re: Chords! (a CLI piano reference)

^ Nice work mate!

Hopefully it can inspire someone to learn piano also... smile


VSIDO | Words That Build Or Destroy

We do not run from challenges, they become new innovations within VSIDO!

Offline

#3 2012-03-11 21:45:04

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: Chords! (a CLI piano reference)

^ ha! good point smile
i don't have a piano but this little tool sure comes in handy when you're trying to figure some stuff out. and it could indeed be used as a piano-learning-tool as well.

thanks for the kind words!

Offline

#4 2012-03-11 21:50:42

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,726

Re: Chords! (a CLI piano reference)

Not to mention a very nice TUNER for ones various stringed instruments!! GOOD WORK rhowaldt!!

Offline

#5 2012-03-11 21:54:10

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,163
Website

Re: Chords! (a CLI piano reference)

^ So true...  and a needed one

I have a BOSS tuner that is 25 years old and although still works, it has seen it's better days..


VSIDO | Words That Build Or Destroy

We do not run from challenges, they become new innovations within VSIDO!

Offline

#6 2012-03-11 21:57:37

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,726

Re: Chords! (a CLI piano reference)

VERY true VastOne.. I do a lot of my playing with my laptop near. So this is a very nice musicians tool!! Thank you rhowaldt for making a bass player smile smile

Offline

#7 2012-03-11 22:04:33

safetycopy
urban legend
From: The Chatsubo
Registered: 2010-04-03
Posts: 1,311

Re: Chords! (a CLI piano reference)

^ Another bass player big_smile

@rhowaldt: I'm not a piano-player, but I think you've made a nice tool there smile I keep meaning to experiment with Ruby and curses a bit...


i wonder if i missed the warning
Skinny Puppy, Love in Vein

Offline

#8 2012-03-12 15:04:25

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 2,993
Website

Re: Chords! (a CLI piano reference)

Rhowaldt, am I missing a library?

 Traceback (most recent call last):A#  B
                                                        File "chords.py", line 366, in <module>
                   chord_section = myscreen.derwin(4,75,24,subnotes_section_hpos)
 _curses.error: curses function returned NULL

I got a picture of a keyboard above that before it exited.


John
--------------------
( a boring Japan blog , idle twitterings  and GitStuff )
#! forum moderator

Offline

#9 2012-03-12 15:12:08

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: Chords! (a CLI piano reference)

^ not sure if it is a missing library, don't think so... the first thing i can think of is that your terminal-window is smaller than mine by default, and it is failing because of that... could you try with a fullscreen terminal? i hadn't really thought of this, so might have to adjust my code for this or something...

Offline

#10 2012-03-12 16:16:07

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 2,993
Website

Re: Chords! (a CLI piano reference)

Ah it seems to work with a maximized window.
But

 E m(inor): E F# B

Should be E G B surely? Gives emajor as E G B too. Seems to be the same with other keys - major and minor thirds are a semitone too small. Haven't checked every chord but not sure about 'C 7-sus4: C F G A' either. I would have said C F G Bflat

Hey, this is a great idea so please don't think I'm complaining or anything, but it also left my terminal's prompt a bit messed up after quitting. I used Ctrl+C - is there a better way to exit?


John
--------------------
( a boring Japan blog , idle twitterings  and GitStuff )
#! forum moderator

Offline

#11 2012-03-12 17:18:09

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: Chords! (a CLI piano reference)

^ hmmm... i did a quick check for some of the more complicated chords to see if they were formed properly, and they were. seems i should've checked the simpler ones too... i'll look into it! thanks for finding and reporting this, the app is not of much use when it is faulty smile

quit the app by pressing 'q'. i think Ctrl+C messes your terminal up because it doesn't reset properly. just type 'reset' when it is messed up to get it back to normal.

edit: wait, i cannot replicate the E-minor showing as you say it does. on my machine it just says 'E G B' for Em, like it should...
any idea what keys you pressed etc?

Offline

#12 2012-03-13 02:23:19

Vansgo
#! Die Hard
Registered: 2011-05-02
Posts: 1,580
Website

Re: Chords! (a CLI piano reference)

you did it -very COOL cool

Offline

#13 2012-03-13 04:35:26

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 2,993
Website

Re: Chords! (a CLI piano reference)

rhowaldt wrote:

i cannot replicate the E-minor showing as you say it does. on my machine it just says 'E G B' for Em, like it should...
any idea what keys you pressed etc?

OK
open terminal, maximize
python chords.py
arrow right to E
F1 choose "Natural Minor scale of E: E F# G A B C D"
Tab, arrow down to "m(inor)"
Enter gives "E m(inor): E F# B"


John
--------------------
( a boring Japan blog , idle twitterings  and GitStuff )
#! forum moderator

Offline

#14 2012-03-13 09:58:13

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: Chords! (a CLI piano reference)

^ thanks. i know now exactly where the issue lies. you won't have the issue when using the Major Scale.
wow, pretty amazing how you can overlook some stuff. thanks again for finding this johnraff!

Offline

#15 2012-03-13 16:10:24

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 2,993
Website

Re: Chords! (a CLI piano reference)

OK when you've got that fixed, can you make a guitar version, with finger positions for open chords, bar chords or 4-finger chords? wink


John
--------------------
( a boring Japan blog , idle twitterings  and GitStuff )
#! forum moderator

Offline

#16 2012-03-13 22:16:12

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: Chords! (a CLI piano reference)

^ hahaha, wow, good idea! seriously, i might do that. i know guitar better than piano, so should be easier too, and i will definitely also use it myself.

i'll look into fixing this thursday, as that will be the first night i'll be home again.

Offline

#17 2012-03-15 21:38:16

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: Chords! (a CLI piano reference)

new pastebin link to chords.py_1.2: http://pastebin.com/XMdtGBw0
the problem was that i used the scale-builder-function to build the chords, but if you switched scales to Harmonic Minor for example, it would use those notes to build the chord instead of keeping to the Major scale always, as it should. fixed now.

oh yeah, johnraff, i'm going to be building that guitar-chords-reference too. it's gonna be called GChords! big_smile

Offline

#18 2012-03-15 22:33:42

machinebacon
#! unstable
From: China
Registered: 2009-07-02
Posts: 6,634
Website

Re: Chords! (a CLI piano reference)

pychords big_smile

Well done, Roald, really nice. You could add (as aforementioned "tuner") a metronome smile

Offline

#19 2012-03-15 22:40:49

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: Chords! (a CLI piano reference)

@pybacon: you see how i could've easily gotten away with naming it 'Pyano', but deliberately chose a proper name? big_smile

in recent news: just changed the scrot up on the first post to a recent one. because i was busy doing scrots anyway, as a present/teaser for johnraff: http://crunchbanglinux.org/forums/post/200088/#p200088

Offline

#20 2012-03-16 04:13:51

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 2,993
Website

Re: Chords! (a CLI piano reference)

Ah yes, it's coming along. smile

Bar chords ought to be pretty easy because you need a few basic shapes and just move them up and down the neck to match the key.
An algorithm for open chords might be interesting though - something that looks for E A D G or B in the chord and adds some (physically possible roll ) places to put your fingers...


John
--------------------
( a boring Japan blog , idle twitterings  and GitStuff )
#! forum moderator

Offline

#21 2012-03-16 04:21:38

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 2,993
Website

Re: Chords! (a CLI piano reference)

rhowaldt wrote:

new pastebin link to chords.py_1.2: http://pastebin.com/XMdtGBw0
the problem was that i used the scale-builder-function to build the chords, but if you switched scales to Harmonic Minor for example, it would use those notes to build the chord instead of keeping to the Major scale always, as it should.

A quick look confirms that it seems to be fixed now. I'm not sure if I get your explanation, though. Surely you build chords out of the notes of the scale you're using?


John
--------------------
( a boring Japan blog , idle twitterings  and GitStuff )
#! forum moderator

Offline

#22 2012-03-16 09:16:23

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: Chords! (a CLI piano reference)

^ you build chords out of the notes of the major-scale, afaik. be that C-major, E-major, or G#-major. i don't think you build chords onto the C Harmonic Minor Scale. but if i am wrong about that, then i shouldn't have fixed this?

look, i am no expert. i am learning piano etc, and musictheory. so lots of stuff i know from just reading online. if anybody knows better, please educate me big_smile

Offline

#23 2012-03-16 10:18:28

Vansgo
#! Die Hard
Registered: 2011-05-02
Posts: 1,580
Website

Re: Chords! (a CLI piano reference)

Trying the 1.2 version now - opens correctly in medium sized term - basic features seem to be working with arrows, tab and function keys - very cool indeed - great progress smile Audible sound would be a nice feature

With Python installed -curses

Offline

#24 2012-03-16 11:06:30

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: Chords! (a CLI piano reference)

^ audible sound will be a no-go i think. for me, that would mean having to dive into yet another completely new area. i have already done python, curses and piano/musictheory on this one project, so not really up for doing sound as well.

also, the tool was mainly meant as a reference on how to play the different chords, regardless of what they sound like. use a real piano or piece of software to actually play them.

thanks for the kind words nonetheless Vansgo, and glad you like it!

Offline

Be excellent to each other!

#25 2012-03-16 11:27:09

Vansgo
#! Die Hard
Registered: 2011-05-02
Posts: 1,580
Website

Re: Chords! (a CLI piano reference)

If your code is open-source yikes a 440 hz used as a pitch standard - small script to create audible tones in hz from variable clicks/ranges to produce the notes...no pressure, python and scripting not my forte' - did this about 5 years ago with VB, created a small, basic synth. Pyano is a great project just as it is smile

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo