Skip to content

Commit bbe451d

Browse files
committed
rest of the EasyABC files
1 parent b6ff0bf commit bbe451d

File tree

128 files changed

+15911
-147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+15911
-147
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@ Temporary Items
4949
*.pyc
5050

5151
abc_styler - geen succes.py
52+
*.stackdump

.vscode/launch.json

+213
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "PowerShell",
6+
"request": "launch",
7+
"name": "PowerShell Launch Current File w/Args Prompt",
8+
"script": "${file}",
9+
"args": [],
10+
"cwd": "${file}"
11+
},
12+
{
13+
"name": "Python",
14+
"type": "python",
15+
"request": "launch",
16+
"stopOnEntry": true,
17+
"pythonPath": "${config:python.pythonPath}",
18+
"program": "${file}",
19+
"cwd": "${workspaceRoot}",
20+
"env": {},
21+
"envFile": "${workspaceRoot}/.env",
22+
"debugOptions": [
23+
"WaitOnAbnormalExit",
24+
"WaitOnNormalExit",
25+
"RedirectOutput"
26+
]
27+
},
28+
{
29+
"name": "PySpark",
30+
"type": "python",
31+
"request": "launch",
32+
"stopOnEntry": true,
33+
"osx": {
34+
"pythonPath": "${env:SPARK_HOME}/bin/spark-submit"
35+
},
36+
"windows": {
37+
"pythonPath": "${env:SPARK_HOME}/bin/spark-submit.cmd"
38+
},
39+
"linux": {
40+
"pythonPath": "${env:SPARK_HOME}/bin/spark-submit"
41+
},
42+
"program": "${file}",
43+
"cwd": "${workspaceRoot}",
44+
"env": {},
45+
"envFile": "${workspaceRoot}/.env",
46+
"debugOptions": [
47+
"WaitOnAbnormalExit",
48+
"WaitOnNormalExit",
49+
"RedirectOutput"
50+
]
51+
},
52+
{
53+
"name": "Python Module",
54+
"type": "python",
55+
"request": "launch",
56+
"stopOnEntry": true,
57+
"pythonPath": "${config:python.pythonPath}",
58+
"module": "module.name",
59+
"cwd": "${workspaceRoot}",
60+
"env": {},
61+
"envFile": "${workspaceRoot}/.env",
62+
"debugOptions": [
63+
"WaitOnAbnormalExit",
64+
"WaitOnNormalExit",
65+
"RedirectOutput"
66+
]
67+
},
68+
{
69+
"name": "Integrated Terminal/Console",
70+
"type": "python",
71+
"request": "launch",
72+
"stopOnEntry": true,
73+
"pythonPath": "${config:python.pythonPath}",
74+
"program": "${file}",
75+
"cwd": "",
76+
"console": "integratedTerminal",
77+
"env": {},
78+
"envFile": "${workspaceRoot}/.env",
79+
"debugOptions": [
80+
"WaitOnAbnormalExit",
81+
"WaitOnNormalExit"
82+
]
83+
},
84+
{
85+
"name": "External Terminal/Console",
86+
"type": "python",
87+
"request": "launch",
88+
"stopOnEntry": true,
89+
"pythonPath": "${config:python.pythonPath}",
90+
"program": "${file}",
91+
"cwd": "",
92+
"console": "externalTerminal",
93+
"env": {},
94+
"envFile": "${workspaceRoot}/.env",
95+
"debugOptions": [
96+
"WaitOnAbnormalExit",
97+
"WaitOnNormalExit"
98+
]
99+
},
100+
{
101+
"name": "Django",
102+
"type": "python",
103+
"request": "launch",
104+
"stopOnEntry": true,
105+
"pythonPath": "${config:python.pythonPath}",
106+
"program": "${workspaceRoot}/manage.py",
107+
"cwd": "${workspaceRoot}",
108+
"args": [
109+
"runserver",
110+
"--noreload",
111+
"--nothreading"
112+
],
113+
"env": {},
114+
"envFile": "${workspaceRoot}/.env",
115+
"debugOptions": [
116+
"WaitOnAbnormalExit",
117+
"WaitOnNormalExit",
118+
"RedirectOutput",
119+
"DjangoDebugging"
120+
]
121+
},
122+
{
123+
"name": "Flask",
124+
"type": "python",
125+
"request": "launch",
126+
"stopOnEntry": false,
127+
"pythonPath": "${config:python.pythonPath}",
128+
"program": "fully qualified path fo 'flask' executable. Generally located along with python interpreter",
129+
"cwd": "${workspaceRoot}",
130+
"env": {
131+
"FLASK_APP": "${workspaceRoot}/quickstart/app.py"
132+
},
133+
"args": [
134+
"run",
135+
"--no-debugger",
136+
"--no-reload"
137+
],
138+
"envFile": "${workspaceRoot}/.env",
139+
"debugOptions": [
140+
"WaitOnAbnormalExit",
141+
"WaitOnNormalExit",
142+
"RedirectOutput"
143+
]
144+
},
145+
{
146+
"name": "Flask (old)",
147+
"type": "python",
148+
"request": "launch",
149+
"stopOnEntry": false,
150+
"pythonPath": "${config:python.pythonPath}",
151+
"program": "${workspaceRoot}/run.py",
152+
"cwd": "${workspaceRoot}",
153+
"args": [],
154+
"env": {},
155+
"envFile": "${workspaceRoot}/.env",
156+
"debugOptions": [
157+
"WaitOnAbnormalExit",
158+
"WaitOnNormalExit",
159+
"RedirectOutput"
160+
]
161+
},
162+
{
163+
"name": "Pyramid",
164+
"type": "python",
165+
"request": "launch",
166+
"stopOnEntry": true,
167+
"pythonPath": "${config:python.pythonPath}",
168+
"cwd": "${workspaceRoot}",
169+
"env": {},
170+
"envFile": "${workspaceRoot}/.env",
171+
"args": [
172+
"${workspaceRoot}/development.ini"
173+
],
174+
"debugOptions": [
175+
"WaitOnAbnormalExit",
176+
"WaitOnNormalExit",
177+
"RedirectOutput",
178+
"Pyramid"
179+
]
180+
},
181+
{
182+
"name": "Watson",
183+
"type": "python",
184+
"request": "launch",
185+
"stopOnEntry": true,
186+
"pythonPath": "${config:python.pythonPath}",
187+
"program": "${workspaceRoot}/console.py",
188+
"cwd": "${workspaceRoot}",
189+
"args": [
190+
"dev",
191+
"runserver",
192+
"--noreload=True"
193+
],
194+
"env": {},
195+
"envFile": "${workspaceRoot}/.env",
196+
"debugOptions": [
197+
"WaitOnAbnormalExit",
198+
"WaitOnNormalExit",
199+
"RedirectOutput"
200+
]
201+
},
202+
{
203+
"name": "Attach (Remote Debug)",
204+
"type": "python",
205+
"request": "attach",
206+
"localRoot": "${workspaceRoot}",
207+
"remoteRoot": "${workspaceRoot}",
208+
"port": 3000,
209+
"secret": "my_secret",
210+
"host": "localhost"
211+
}
212+
]
213+
}

.vscode/settings.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"python.pythonPath": "C:/Python27/python.exe",
3+
4+
"files.exclude": {
5+
"**/*.pyc": true,
6+
"**/*.bak": true
7+
}
8+
}

abc_search.py

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import re
2+
3+
all_notes = "| C,, D,, E,, F,, G,, A,, B,, C, D, E, F, G, A, B, C D E F G A B c d e f g a b c' d' e' f' g' a' b' c'' d'' e'' f'' g'' a'' b''".split()
4+
note2number = dict([(n, i) for (i, n) in enumerate(all_notes)])
5+
note_pattern = re.compile(r"([ABCDEFG],*|[abcdefg]'*)")
6+
repl_by_spaces = lambda m: ' ' * len(m.group(0))
7+
8+
remove_non_notes = re.compile(r'(?xm)' + '|'.join([
9+
r'\%\%beginps(.|\s)+?\%\%endps', # remove embedded postscript
10+
r'\%\%begintext(.|\s)+?\%\%endtext', # remove text
11+
r'\[\w:.*?\]', # remove embedded fields
12+
r'(?m)^\w:.*?$', # remove normal fields
13+
r'(?m)%.*$', # remove comments
14+
r'\[\w:.*?\]', # remove embedded fields
15+
r'\\"', # remove escaped " characters
16+
r'".*?"', # remove strings
17+
r'\\"', # remove escaped quote characters
18+
r'\{.*?\}', # remove grace notes
19+
r'!.+?!', # remove ornaments like eg. !pralltriller!
20+
r'\+.+?\+', # remove ornaments like eg. +pralltriller+
21+
r'\{.*?\}', # remove grace notes
22+
]))
23+
24+
def remove_non_note_fragments(abc):
25+
# replace non-note fragments of the text by replacing them by spaces (thereby preserving offsets), but keep also bar and repeat symbols
26+
return remove_non_notes.sub(repl_by_spaces, abc.replace('\r', '\n'))
27+
28+
def get_intervals_from_abc(abc):
29+
abc = remove_non_note_fragments(abc)
30+
notes = [note2number[m] for m in note_pattern.findall(abc)]
31+
intervals = [i2-i1 for (i1,i2) in zip(notes[:-1], notes[1:])]
32+
return ''.join([chr(74+i) for i in intervals])
33+
34+
def get_matches(abc, abc_search_intervals):
35+
abc = remove_non_note_fragments(abc)
36+
matches = list(note_pattern.finditer(abc)) # the matched notes in the abc
37+
notes = [note2number[m.group(0)] for m in matches] # the note number for each note
38+
offsets = [m.span(0) for m in matches] # the start/end offset in the ABC code for each note
39+
intervals = [i2-i1 for (i1,i2) in zip(notes[:-1], notes[1:])] # the intervals between pairs of notes
40+
intervals = ''.join([chr(74+i) for i in intervals]) # the intervals coded as strings
41+
# find the search string among all the intervals
42+
for m in re.finditer(re.escape(abc_search_intervals), intervals):
43+
i = m.start(0) # the offset in the search string is the same as the index of the note
44+
start, end = offsets[i][0], offsets[i+len(abc_search_intervals)][1]
45+
yield (start, end) # return start and end offset in the ABC code for the matched sequence of notes
46+
47+
def abc_matches_iter(abc, search_string):
48+
search = get_intervals_from_abc(search_string)
49+
offset = 0 # the total character offset from the beginning of the abc text
50+
tunes = abc.split('X:') # split the code up per tune
51+
52+
for i, tune in enumerate(tunes):
53+
if i > 0: tune = 'X:' + tune # add back the X: to the tunes from which it was removed during the split
54+
55+
# find matches
56+
for start_offset_in_tune, end_offset_in_tune in get_matches(tune, search):
57+
# convert the offsets within the tune to global offsets
58+
start, end = (offset+start_offset_in_tune, offset+end_offset_in_tune)
59+
yield (start, end)
60+
61+
offset += len(tune)
62+
63+
if __name__ == '__main__':
64+
search = 'CEG'
65+
abc = '''' GE CE GE'''
66+
67+
for r in abc_matches_iter(abc, search):
68+
pass

bin/note.txt

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
The files with an *.exe are Windows executables. The
2+
ones without the extension are Mac executables.
3+
4+
The latest MAC executables of nwc2xml can be found in
5+
http://code.google.com/p/nwc2xml/downloads/list
6+
7+
The latest Mac executables of the abcmidi package can be found in
8+
http://abcplus.sourceforge.net/
9+
10+
The latest Windows executables of the abcmidi package and
11+
abcm2ps can be found in
12+
http://ifdo.ca/~seymour/runabc/top.html (see abcmidi_win32.zip).
13+
This distribution has been updated to March 03 2014
14+
15+
16+

bin/readme.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Place the binaries (executables) for the programs abcm2ps, abc2midi, midi2abc,
2+
abc2abc and nwc2xml here. EasyABC will find them without the need
3+
for any configuration by the user. Also see note.txt.

build.bat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python setup.py build && "C:\Program Files (x86)\Inno Setup 5\iscc.exe" setupEasy137.iss

build.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#rm reference.txt generalmidi.txt abcm2ps_osx abc2midi_osx abc2abc_osx
2+
#rm -fr dist/EasyABC.app
3+
python setup.py py2app
4+
#cp -r reference.txt generalmidi.txt img locale sound dist/EasyABC.app/Contents/Resources
5+
#cp -r bin/abcm2ps bin/abc2midi bin/abc2abc dist/EasyABC.app/Contents/Resources/bin
6+
for file in `ls -1 locale/`; do
7+
mkdir "dist/EasyABC.app/Contents/Resources/$file.lproj"
8+
done
9+
mkdir "dist/EasyABC.app/Contents/Resources/English.lproj"
10+
#force to have executable binary as py2app remove the executable flag
11+
chmod +x dist/EasyABC.app/Contents/Resources/bin/*

build__dmg.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
rm "dist/EasyABC_1.3.7.dmg"
2+
hdiutil create "dist/EasyABC_1.3.7.dmg" -volname "EasyABC 1.3.7" -fs HFS+ -srcfolder "dist/EasyABC.app"

build_deb.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
cp -r dist/deb_package tmp/
3+
4+
dpkg --build /tmp/deb_package easyabc-1.3.7.deb

creating_an_executable.txt

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
This note describes how to create a Windows PC executable of easy_abc.
2+
3+
You can find a tutorial on the site http://www.py2exe.org/index.cgi/Tutorial
4+
which is somewhat accurate.
5+
6+
easy_abc comes with setup.py which is used to create easy_abc.exe.
7+
8+
You will also need to install on your computer, py2exe, cx_Freeze-*.win32.py2.7,
9+
and mechanize. They are all found on http://sourceforge.net. Ensure that these
10+
scripts go into the folder linked to PYTHONPATH.
11+
12+
Copy all the executables, abc2abc.exe, abc2midi.exe, abcm2ps.exe,
13+
nwc2xml.exe, and zlibwapi.dll into the bin folder. You can find nwc2xml.exe
14+
and zlibwapi.dll in the older easy_abc install.
15+
16+
Copy the folder Microsoft.VC90.CRT into your easyabc_source_code... folder.
17+
18+
Open a command window, CD to the folder easyabc_source_code... and set the
19+
PYTHON and PYTHONPATH using the autoexec.bat file. You should now be
20+
ready.
21+
22+
python setup.py install
23+
24+
You should see lots of messages and an executable with other files
25+
should be put into the folder build/exe.win32-27/ which you will find
26+
in the easy_source_code... folder.
27+
28+
I found that executable runs fine on Windows 7 64-bit but,
29+
I did not get it to run on my Windows XP laptop.
30+
31+
The package also comes with setup.iss which is a script for running
32+
the Inno Setup Compiler which is freely available. The setup.iss
33+
file should no longer be used since it assumes a build/exe.win32-26/
34+
created by Python2.6 rather than Python2.7. Instead you should
35+
use setupEasy07.iss which I created recently. You will also
36+
require Inno Setup installed on your PC. See the header of text
37+
file setupEasy07.iss.
38+
39+
I also created an install script for the "nullsoft scriptable install
40+
system 2.46" (NSIS) before discovering Inno Setup. I have left the
41+
script here easyabc.nsi but I now prefer Inno Setup which appears
42+
to be the standard.
43+
44+
Seymour Shlien

0 commit comments

Comments
 (0)