Skip to content

Commit fec5ad8

Browse files
committed
added pwfine command, extended command range
1 parent fe6e746 commit fec5ad8

Some content is hidden

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

49 files changed

+1610
-157
lines changed

.gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "klystron"]
22
path = klystron
3-
url = https://github.com/kometbomb/klystron.git
3+
url = https://github.com/LTVA1/klystron.git

Makefile

+14-14
Original file line numberDiff line numberDiff line change
@@ -140,22 +140,22 @@ build: Makefile src/version.h src/version_number.h
140140
$(Q)$(MAKE) all CFG=$(CFG) EXTFLAGS="$(EXTFLAGS)"
141141

142142
src/version.h: src/version
143-
$(Q)echo '#ifndef VERSION_H' > ./src/version.h
144-
$(Q)echo '#define VERSION_H' >> ./src/version.h
145-
$(Q)echo '#include "version_number.h"' >> ./src/version.h
146-
$(Q)echo '#define REVISION "' | tr -d '\n' >> ./src/version.h
147-
$(Q)date +"%Y%m%d" | tr -d '\n' >> ./src/version.h
148-
$(Q)echo '"' >> ./src/version.h
149-
$(Q)echo '#define VERSION_STRING "klystrack " VERSION " " REVISION' >> ./src/version.h
150-
$(Q)echo '#endif' >> ./src/version.h
143+
# $(Q)echo '#ifndef VERSION_H' > ./src/version.h
144+
# $(Q)echo '#define VERSION_H' >> ./src/version.h
145+
# $(Q)echo '#include "version_number.h"' >> ./src/version.h
146+
# $(Q)echo '#define REVISION "' | tr -d '\n' >> ./src/version.h
147+
# $(Q)date +"%Y%m%d" | tr -d '\n' >> ./src/version.h
148+
# $(Q)echo '"' >> ./src/version.h
149+
# $(Q)echo '#define VERSION_STRING "klystrack " VERSION " " REVISION' >> ./src/version.h
150+
# $(Q)echo '#endif' >> ./src/version.h
151151

152152
src/version_number.h: src/version
153-
$(Q)echo '#ifndef VERSION_NUMBER' > src/version_number.h
154-
$(Q)echo '#define VERSION_NUMBER' >> src/version_number.h
155-
$(Q)echo '#define VERSION "' | tr -d '\n' >> src/version_number.h
156-
$(Q)cat src/version | tr -d '\r\n' | tr -d '\n' >> src/version_number.h
157-
$(Q)echo '"' >> src/version_number.h
158-
$(Q)echo '#endif' >> src/version_number.h
153+
# $(Q)echo '#ifndef VERSION_NUMBER' > src/version_number.h
154+
# $(Q)echo '#define VERSION_NUMBER' >> src/version_number.h
155+
# $(Q)echo '#define VERSION "' | tr -d '\n' >> src/version_number.h
156+
# $(Q)cat src/version | tr -d '\r\n' | tr -d '\n' >> src/version_number.h
157+
# $(Q)echo '"' >> src/version_number.h
158+
# $(Q)echo '#endif' >> src/version_number.h
159159

160160
# root (i.e. src/*.c)
161161
$(eval $(call directory_defs,,))
10 Bytes
Binary file not shown.

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
# klystrack-plus
2+
3+
A fork of klystrack chiptune tracker. A bit outdated but very good and comprehensive tutorial is [here](http://n00bstar.blogspot.com/2013/02/klystrack-tutorial-basics.html). To compile from github (not from source archive) you would need to download klystron and do some black magic I think, so better use source.zip.
4+
5+
## Future plans
6+
7+
- ~~additive mode for current 2-op fm synth~~ done in v0.4
8+
- 4-op fm synth with all 12 algorithms I've found. If algorithm is from OPL3 or Sega chip special tip emerges. Each op has its own macro, filter, envelope, etc. Filter of the first op which would be edited in main window filters overall output of the 4-op stack.
9+
- commands for setting start and end points of the sample from instrument macro (the result is you can use less samples, e.g. use sine and make lower half sine and upper half sine from the same sample for different instruments)
10+
- Song info or song comment (separate window with arbitrary amount of text as in e.g. Impulse tracker)
11+
- Oscilloscope in instrument editing window which shows current waveform produced by instrument
12+
- ~~Exponential wave in wavegen (mainly for OPL3)~~ done in v0.3
13+
- DPCMator in wavegen (convert any sample into DPCM NES format (only 1 step up or down for each step, 6-bit resolution) and save as 8-bit PCM sample)
14+
- ~~Killing duplicate samples and relinking instruments to remaining 1 sample (useful for imported xms and its, combined with klystrack's sample compression it would give huge (or not) size reduction)~~ done in v0.5
15+
- ~~saving wavegen settings as sort of "synth patches"~~ done in v0.3
16+
- ~~moving klystrack config file from C:/Users/%USERNAME% to app folder which would make app portable~~ done in v0.4
17+
18+
Below are links related to original klystrack. You will not find my releases there. Instead check releases of my fork.
19+
120
# klystrack
221

322
Klystrack is a chiptune tracker for making chiptune-like music on a modern computer.

b0

Whitespace-only changes.

b2

Whitespace-only changes.

b3

Whitespace-only changes.

installer/klystrack.nsi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
!include "MUI.nsh"
22
!include "installer\FileAssociation.nsh"
33

4-
Name "klystrack ${VERSION}"
4+
Name "klystrack-plus ${VERSION}"
55
OutFile "zip\klystrack-${VERSION}.exe"
66
InstallDirRegKey HKCU "Software\klystrack" ""
77
InstallDir $PROGRAMFILES32\klystrack

klystron

Submodule klystron deleted from 1074324

linux/klystrack.desktop

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[Desktop Entry]
2-
Name=Klystrack
2+
Name=Klystrack-plus
33
Comment=Chiptune Tracker
44
Comment[fr]=Tracker 8-bits
55
Exec=klystrack %f

src/action.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,12 @@ void generic_action(void *func, void *unused1, void *unused2)
294294

295295
void quit_action(void *unused1, void *unused2, void *unused3)
296296
{
297-
mused.done = 1;
297+
if (confirm(domain, mused.slider_bevel, &mused.largefont, "Do you really want to exit?"))
298+
{
299+
mused.done = 1;
300+
}
298301
}
299302

300-
301303
void change_mode_action(void *mode, void *unused1, void *unused2)
302304
{
303305
change_mode(CASTPTR(int,mode));

src/box drawing changed codes.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
\x9a\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x9e\x8c \n\x8b\BASE \xaf\xb0\xb1\xb2\xb3\xaf\xb0\xb1\xb2\xb3 \xb4L \x8b \n\x8b\xb5\DRUM \xb5KSYNC \x8b \n\x8b\xb4VIB \xb5SET PW \x8b \n\x8b\xb5SET CUT SLIDE\xaf\xb1\xb2\xb3\x8b \n\x98\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x87 \n\x8b\xb4PUL \xaf\xb0\xb1\xb2\xb3 \xb4SAW \x8b \n\x8b\xb5TRI \xb4NOI \xb4METAL \x8b \n\x8b\xb4POKEY \xae\xb2\xb3 \xb4 1/4TH \x8b \n\x98\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x87 \n\x8b\xb4WAVE\xaf\xb1\xb2\xb3 \xb4OENV \xb4L \x8b \n\x98\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x87 \n\x8bOSC. MIX MODE \xaf\xb0\xb1\xb2\xb3 \x8b \n\x98\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x87 \n\x8bVOL \xaf\xb1\xb2\xb3 \xb4RELATIVE \x8b \n\x8b\ATK \xaf\xb1\xb2\xb3 DEC \xaf\xb1\xb2\xb3 \x8b \n\x8bSUS \xaf\xb1\xb2\xb3 REL \xaf\xb1\xb2\xb3 \x8b \n\x98\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x87 \n\x8b\xb4\BUZZ DETUNE\xaf\xb1\xb2\xb3 \x8b \n\x8bSHAPE\xae\xb2\xb3 FINE\xaf\xb0\xb1\xb2\xb3 \x8b \n\x98\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x87 \n\x8b\xb4SYNC SRC \xaf\xb1\xb2\xb3 \x8b \n\x8b\xb4RING MOD SRC \xaf\xb1\xb2\xb3 \x8b \n\x98\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x95\x87 \n\x8b\xb4\FILTER TYPE\xaf\xb0\xb1\xb2\xb3 \x8b \n\x8b\CUT\xaf\xb0\xb1\xb2\xb3 RES \xae\xb2\xb3 \x8b \n\x8bSLOPE \xaf\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb1\xb2\xb3 \x8b

src/box drawing.txt

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
░ ▒ ▓ █ │ ┤ ╡ ╢ ╖ ╕ ╣ ║ ╗ ╝ ╜ ╛ ┐ └ ┴ ┬ ├ ─ ┼ ╞ ╟ ╚ ╔ ╩ ╦ ╠ ═ ╬ ╧ ╨ ╤ ╥ ╙ ╘ ╒ ╓ ╫ ╪ ┘ ┌
2+
3+
╔════════════════════╗
4+
║\BASE \xaf\xb0\xb1\xb2\xb3\xaf\xb0\xb1\xb2\xb3 \xb4L ║
5+
║\xb5\DRUM \xb5KSYNC ║
6+
║\xb4VIB \xb5SET PW ║
7+
║\xb5SET CUT SLIDE\xaf\xb1\xb2\xb3║
8+
╟────────────────────╢
9+
║\xb4PUL \xaf\xb0\xb1\xb2\xb3 \xb4SAW ║
10+
║\xb5TRI \xb4NOI \xb4METAL ║
11+
║\xb4POKEY \xae\xb2\xb3 \xb4 1/4TH ║
12+
╟────────────────────╢
13+
║\xb4WAVE\xaf\xb1\xb2\xb3 \xb4OENV \xb4L ║
14+
╟────────────────────╢
15+
║OSC. MIX MODE \xaf\xb0\xb1\xb2\xb3 ║
16+
╟────────────────────╢
17+
║VOL \xaf\xb1\xb2\xb3 \xb4RELATIVE ║
18+
║\ATK \xaf\xb1\xb2\xb3 DEC \xaf\xb1\xb2\xb3 ║
19+
║SUS \xaf\xb1\xb2\xb3 REL \xaf\xb1\xb2\xb3 ║
20+
╟────────────────────╢
21+
║\xb4\BUZZ DETUNE\xaf\xb1\xb2\xb3 ║
22+
║SHAPE\xae\xb2\xb3 FINE\xaf\xb0\xb1\xb2\xb3 ║
23+
╟────────────────────╢
24+
║\xb4SYNC SRC \xaf\xb1\xb2\xb3 ║
25+
║\xb4RING MOD SRC \xaf\xb1\xb2\xb3 ║
26+
╟────────────────────╢
27+
║\xb4\FILTER TYPE\xaf\xb0\xb1\xb2\xb3 ║
28+
║\CUT\xaf\xb0\xb1\xb2\xb3 RES \xae\xb2\xb3 ║
29+
║SLOPE \xaf\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb0\xb1\xb2\xb3 ║

src/combWFgen.c

+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
/*
2+
Copyright (c) 2009-2010 Tero Lindeman (kometbomb)
3+
4+
Permission is hereby granted, free of charge, to any person
5+
obtaining a copy of this software and associated documentation
6+
files (the "Software"), to deal in the Software without
7+
restriction, including without limitation the rights to use,
8+
copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the
10+
Software is furnished to do so, subject to the following
11+
conditions:
12+
13+
The above copyright notice and this permission notice shall be
14+
included in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23+
OTHER DEALINGS IN THE SOFTWARE.
24+
*/
25+
26+
#include "stdlib.h"
27+
#include "math.h"
28+
29+
#include "SDL.h"
30+
#include "gfx/gfx.h"
31+
#include "snd/music.h"
32+
#include "gui/toolutil.h"
33+
#include "copypaste.h"
34+
#include "diskop.h"
35+
#include "event.h"
36+
#include "view.h"
37+
#include "gui/slider.h"
38+
#include "action.h"
39+
#include "gui/mouse.h"
40+
#include "gui/bevel.h"
41+
#include "gui/menu.h"
42+
#include "shortcutdefs.h"
43+
#include "version.h"
44+
#include "mused.h"
45+
#include "config.h"
46+
#include "mybevdefs.h"
47+
#include <time.h>
48+
#include "util/rnd.h"
49+
#include "view/visu.h"
50+
#include "view/pattern.h"
51+
#include "view/sequence.h"
52+
#include "view/wavetableview.h"
53+
#include "view/timer.h"
54+
#include "mymsg.h"
55+
#include "key.h"
56+
#include "nostalgy.h"
57+
#include "theme.h"
58+
59+
long map_Arduino(long x, long in_min, long in_max, long out_min, long out_max)
60+
{
61+
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; //don't ask me just easiest wavegen+oscview setup involved arduino
62+
}
63+
64+
//from jsSID emulator
65+
66+
void createCombinedWF(int wfarray[], float bitmul, float bitstrength,float treshold)
67+
{ //I found out how the combined waveform works (neighboring bits affect each other recursively)
68+
for (int i=0; i<4096; i++)
69+
{
70+
wfarray[i]=0; //neighbour-bit strength and DAC MOSFET treshold is approximately set by ears'n'trials
71+
72+
for (int j=0; j<12;j++)
73+
{
74+
float bitlevel=0.0;
75+
76+
for (int k=0; k<12; k++)
77+
{
78+
bitlevel += ( bitmul/pow(bitstrength,abs(k-j)) ) * (((i>>k)&1)-0.5) ;
79+
}
80+
81+
wfarray[i] += (bitlevel>=treshold)? pow(2,j) : 0;
82+
}
83+
84+
wfarray[i]*=12;
85+
}
86+
87+
for(int i = 0; i < 4096; i++)
88+
{
89+
wfarray[i] *= 1.26;
90+
}
91+
}
92+
93+
void createPulseTri(int wfarray[], float bitmul, float bitstrength,float treshold)
94+
{ //I found out how the combined waveform works (neighboring bits affect each other recursively)
95+
for (int i=0; i<2048; i++)
96+
{
97+
wfarray[i]=0; //neighbour-bit strength and DAC MOSFET treshold is approximately set by ears'n'trials
98+
99+
for (int j=0; j<12;j++)
100+
{
101+
float bitlevel=0.0;
102+
103+
for (int k=0; k<12; k++)
104+
{
105+
bitlevel += (bitmul/pow(bitstrength,abs(k-j))) * (((2*i>>k)&1)-0.5); //bitlevel += (bitmul/pow(bitstrength,abs(k-j))) * (((i>>k)&1)-0.5);
106+
}
107+
108+
wfarray[i] += (bitlevel>=treshold) ? pow(2,j) : 0;
109+
}
110+
111+
wfarray[i]*=12;
112+
}
113+
114+
for(int i=2045; i<2049; i++)
115+
{
116+
wfarray[i] = wfarray[2045];
117+
}
118+
119+
for(int i=0; i<2048; i++)
120+
{
121+
if(wfarray[i] > 0 && map_Arduino(i, 0, 2047, 0, 53535) < wfarray[i])
122+
{
123+
wfarray[i] = map_Arduino(i, 0, 2047, 0, 53535);
124+
}
125+
}
126+
127+
for(int i=2047; i<4096; i++)
128+
{
129+
wfarray[i] = wfarray[4096 - i];
130+
}
131+
132+
for(int i=0; i<4096; i++)
133+
{
134+
wfarray[i] = (wfarray[i] * 26) / 20;
135+
}
136+
137+
for(int i=0; i<4096; i++)
138+
{
139+
wfarray[4096 + i] = 0;
140+
/*wfarray[4096 + i] = wfarray[i];
141+
wfarray[i] = 0;*/
142+
}
143+
}

src/combWFgen.h

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
Copyright (c) 2009-2010 Tero Lindeman (kometbomb)
3+
4+
Permission is hereby granted, free of charge, to any person
5+
obtaining a copy of this software and associated documentation
6+
files (the "Software"), to deal in the Software without
7+
restriction, including without limitation the rights to use,
8+
copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the
10+
Software is furnished to do so, subject to the following
11+
conditions:
12+
13+
The above copyright notice and this permission notice shall be
14+
included in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23+
OTHER DEALINGS IN THE SOFTWARE.
24+
*/
25+
26+
extern int TriSaw_8580[4096]; //wasn't there
27+
extern int PulseSaw_8580[4096];
28+
extern int PulseTriSaw_8580[4096];
29+
extern int PulseTri_8580[8192];
30+
31+
long map_Arduino(long x, long in_min, long in_max, long out_min, long out_max);
32+
void createCombinedWF(int wfarray[], float bitmul, float bitstrength,float treshold) ;
33+
void createPulseTri(int wfarray[], float bitmul, float bitstrength,float treshold) ;

0 commit comments

Comments
 (0)