Skip to content

Commit 46031c6

Browse files
committed
initial commit
0 parents  commit 46031c6

File tree

15 files changed

+945
-0
lines changed

15 files changed

+945
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

LICENSE.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2017 Albin Stigö
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# AFSK AX.25 Erlang port
2+
3+
This is an Erlang [port](http://erlang.org/doc/reference_manual/ports.html) program written in plain C for decoding AX.25 frames sent using 1200 baud AFSK (Audio Frequency Shift Keying). This is most frequently (no pun intended) used today for APRS (Automatic Packet Reporting System).
4+
5+
The decoded frames are written raw to `stdout` in the `{packet,2}` format.
6+
7+
The idea here is to take advantage of Erlangs excellent facilities for parsing binary data into packets.
8+
9+
## Getting Started
10+
11+
I have not yet incorporated the code for reading real time samples from audio hardware. I'm testing the program using recorded APRS traffic recorded by WA8LMF. More info below.
12+
13+
### Prerequisites
14+
15+
Right now, to build this early version of the project, you need `Xcode` and `libsndfile`. I'm planning a Linux version.
16+
17+
## Testing
18+
19+
I have been testing this program with the *excellent* test data provided by **WA8LMF Stephen Smith**.
20+
21+
Stephen has created a TNC test CD that you can download [here](http://wa8lmf.net/TNCtest/).
22+
23+
The downloaded `.zip` file contains a `.bin` and `.cue` file for burning to CD. You can convert it to wav files that are more practical these days, using the excellent `bchunk` found [here](http://he.fi/bchunk/).
24+
25+
Convert to wave files:
26+
27+
`$ bchunk -w TNC_Test_Ver-1.1.bin TNC_Test_Ver-1.1.cue TNC_Test`
28+
29+
Remove one channel to make it mono, downsample to 24k/s and trim the first 4.75s of speech / silence.
30+
31+
`$ sox TNC_Test01.wav TNC_Test01-mono242.wav remix 1 rate 24k trim 4.75`
32+
33+
Then give the path to one of these files as the first argument of the program. The program will try to decode any afsk ax.25 frames.
34+
35+
## Built With
36+
37+
* AFSK AX.25 code heavily inspired by [multimon-ng](https://github.com/EliasOenal/multimon-ng)
38+
* [libsndfile](http://www.mega-nerd.com/libsndfile/)
39+
* CRC code from [WAMPES](https://github.com/dieterdeyke/WAMPES) by Dieter Deyke
40+
41+
## Contributing
42+
43+
I'd be happy to receive ideas and suggetions!
44+
45+
## Authors
46+
47+
* **Albin Stigö** - *Initial work* - [albinstigo.me](http://albinstigo.me)
48+
49+
## License
50+
51+
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
52+
53+
## Acknowledgments
54+
55+
* The ring buffer code was inspired by [Juho Snellman](https://www.snellman.net/blog/archive/2016-12-13-ring-buffers/)
56+
* The DSP code was inspired by [The Scientist and Engineer's Guide to Digital Signal Processing](http://www.dspguide.com), an amazing book!

afsk.xcodeproj/project.pbxproj

+318
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,318 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 46;
7+
objects = {
8+
9+
/* Begin PBXBuildFile section */
10+
B14511C51EEA8AD700FCDD10 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = B14511C41EEA8AD700FCDD10 /* main.c */; };
11+
B14511CD1EEA8CE600FCDD10 /* libsndfile.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B14511CC1EEA8CE600FCDD10 /* libsndfile.dylib */; };
12+
B1DDB1401EEAA1DA00350DFC /* ringbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = B1DDB13F1EEAA1DA00350DFC /* ringbuffer.c */; };
13+
B1DDB1461EEAB97400350DFC /* hdlc.c in Sources */ = {isa = PBXBuildFile; fileRef = B1DDB1441EEAB97400350DFC /* hdlc.c */; };
14+
B1DDB1491EEB39F000350DFC /* crc.c in Sources */ = {isa = PBXBuildFile; fileRef = B1DDB1471EEB39F000350DFC /* crc.c */; };
15+
/* End PBXBuildFile section */
16+
17+
/* Begin PBXCopyFilesBuildPhase section */
18+
B14511BF1EEA8AD700FCDD10 /* CopyFiles */ = {
19+
isa = PBXCopyFilesBuildPhase;
20+
buildActionMask = 2147483647;
21+
dstPath = /usr/share/man/man1/;
22+
dstSubfolderSpec = 0;
23+
files = (
24+
);
25+
runOnlyForDeploymentPostprocessing = 1;
26+
};
27+
/* End PBXCopyFilesBuildPhase section */
28+
29+
/* Begin PBXFileReference section */
30+
B141CC4E1F0A939400717404 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
31+
B141CC4F1F0A93A900717404 /* LICENSE.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = LICENSE.md; sourceTree = "<group>"; };
32+
B14511C11EEA8AD700FCDD10 /* afsk */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = afsk; sourceTree = BUILT_PRODUCTS_DIR; };
33+
B14511C41EEA8AD700FCDD10 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
34+
B14511CC1EEA8CE600FCDD10 /* libsndfile.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsndfile.dylib; path = ../../../../../usr/local/lib/libsndfile.dylib; sourceTree = "<group>"; };
35+
B14511CF1EEA960500FCDD10 /* ringbuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ringbuffer.h; sourceTree = "<group>"; };
36+
B1DDB13F1EEAA1DA00350DFC /* ringbuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ringbuffer.c; sourceTree = "<group>"; };
37+
B1DDB1441EEAB97400350DFC /* hdlc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hdlc.c; sourceTree = "<group>"; };
38+
B1DDB1451EEAB97400350DFC /* hdlc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hdlc.h; sourceTree = "<group>"; };
39+
B1DDB1471EEB39F000350DFC /* crc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crc.c; sourceTree = "<group>"; };
40+
B1DDB1481EEB39F000350DFC /* crc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = crc.h; sourceTree = "<group>"; };
41+
/* End PBXFileReference section */
42+
43+
/* Begin PBXFrameworksBuildPhase section */
44+
B14511BE1EEA8AD700FCDD10 /* Frameworks */ = {
45+
isa = PBXFrameworksBuildPhase;
46+
buildActionMask = 2147483647;
47+
files = (
48+
B14511CD1EEA8CE600FCDD10 /* libsndfile.dylib in Frameworks */,
49+
);
50+
runOnlyForDeploymentPostprocessing = 0;
51+
};
52+
/* End PBXFrameworksBuildPhase section */
53+
54+
/* Begin PBXGroup section */
55+
B14511B81EEA8AD700FCDD10 = {
56+
isa = PBXGroup;
57+
children = (
58+
B141CC4F1F0A93A900717404 /* LICENSE.md */,
59+
B141CC4E1F0A939400717404 /* README.md */,
60+
B14511C31EEA8AD700FCDD10 /* afsk */,
61+
B14511C21EEA8AD700FCDD10 /* Products */,
62+
B14511CB1EEA8CE600FCDD10 /* Frameworks */,
63+
);
64+
sourceTree = "<group>";
65+
};
66+
B14511C21EEA8AD700FCDD10 /* Products */ = {
67+
isa = PBXGroup;
68+
children = (
69+
B14511C11EEA8AD700FCDD10 /* afsk */,
70+
);
71+
name = Products;
72+
sourceTree = "<group>";
73+
};
74+
B14511C31EEA8AD700FCDD10 /* afsk */ = {
75+
isa = PBXGroup;
76+
children = (
77+
B14511C41EEA8AD700FCDD10 /* main.c */,
78+
B1DDB14F1EEBE21B00350DFC /* hdlc */,
79+
B1DDB14D1EEBE20500350DFC /* ringbuffer */,
80+
);
81+
path = afsk;
82+
sourceTree = "<group>";
83+
};
84+
B14511CB1EEA8CE600FCDD10 /* Frameworks */ = {
85+
isa = PBXGroup;
86+
children = (
87+
B14511CC1EEA8CE600FCDD10 /* libsndfile.dylib */,
88+
);
89+
name = Frameworks;
90+
sourceTree = "<group>";
91+
};
92+
B1DDB14D1EEBE20500350DFC /* ringbuffer */ = {
93+
isa = PBXGroup;
94+
children = (
95+
B14511CF1EEA960500FCDD10 /* ringbuffer.h */,
96+
B1DDB13F1EEAA1DA00350DFC /* ringbuffer.c */,
97+
);
98+
name = ringbuffer;
99+
sourceTree = "<group>";
100+
};
101+
B1DDB14F1EEBE21B00350DFC /* hdlc */ = {
102+
isa = PBXGroup;
103+
children = (
104+
B1DDB1501EEBE22400350DFC /* crc */,
105+
B1DDB1441EEAB97400350DFC /* hdlc.c */,
106+
B1DDB1451EEAB97400350DFC /* hdlc.h */,
107+
);
108+
name = hdlc;
109+
sourceTree = "<group>";
110+
};
111+
B1DDB1501EEBE22400350DFC /* crc */ = {
112+
isa = PBXGroup;
113+
children = (
114+
B1DDB1471EEB39F000350DFC /* crc.c */,
115+
B1DDB1481EEB39F000350DFC /* crc.h */,
116+
);
117+
name = crc;
118+
sourceTree = "<group>";
119+
};
120+
/* End PBXGroup section */
121+
122+
/* Begin PBXNativeTarget section */
123+
B14511C01EEA8AD700FCDD10 /* afsk */ = {
124+
isa = PBXNativeTarget;
125+
buildConfigurationList = B14511C81EEA8AD700FCDD10 /* Build configuration list for PBXNativeTarget "afsk" */;
126+
buildPhases = (
127+
B14511BD1EEA8AD700FCDD10 /* Sources */,
128+
B14511BE1EEA8AD700FCDD10 /* Frameworks */,
129+
B14511BF1EEA8AD700FCDD10 /* CopyFiles */,
130+
);
131+
buildRules = (
132+
);
133+
dependencies = (
134+
);
135+
name = afsk;
136+
productName = afsk;
137+
productReference = B14511C11EEA8AD700FCDD10 /* afsk */;
138+
productType = "com.apple.product-type.tool";
139+
};
140+
/* End PBXNativeTarget section */
141+
142+
/* Begin PBXProject section */
143+
B14511B91EEA8AD700FCDD10 /* Project object */ = {
144+
isa = PBXProject;
145+
attributes = {
146+
LastUpgradeCheck = 0830;
147+
ORGANIZATIONNAME = "Albin Stigo";
148+
TargetAttributes = {
149+
B14511C01EEA8AD700FCDD10 = {
150+
CreatedOnToolsVersion = 8.3.2;
151+
ProvisioningStyle = Automatic;
152+
};
153+
};
154+
};
155+
buildConfigurationList = B14511BC1EEA8AD700FCDD10 /* Build configuration list for PBXProject "afsk" */;
156+
compatibilityVersion = "Xcode 3.2";
157+
developmentRegion = English;
158+
hasScannedForEncodings = 0;
159+
knownRegions = (
160+
en,
161+
);
162+
mainGroup = B14511B81EEA8AD700FCDD10;
163+
productRefGroup = B14511C21EEA8AD700FCDD10 /* Products */;
164+
projectDirPath = "";
165+
projectRoot = "";
166+
targets = (
167+
B14511C01EEA8AD700FCDD10 /* afsk */,
168+
);
169+
};
170+
/* End PBXProject section */
171+
172+
/* Begin PBXSourcesBuildPhase section */
173+
B14511BD1EEA8AD700FCDD10 /* Sources */ = {
174+
isa = PBXSourcesBuildPhase;
175+
buildActionMask = 2147483647;
176+
files = (
177+
B14511C51EEA8AD700FCDD10 /* main.c in Sources */,
178+
B1DDB1401EEAA1DA00350DFC /* ringbuffer.c in Sources */,
179+
B1DDB1491EEB39F000350DFC /* crc.c in Sources */,
180+
B1DDB1461EEAB97400350DFC /* hdlc.c in Sources */,
181+
);
182+
runOnlyForDeploymentPostprocessing = 0;
183+
};
184+
/* End PBXSourcesBuildPhase section */
185+
186+
/* Begin XCBuildConfiguration section */
187+
B14511C61EEA8AD700FCDD10 /* Debug */ = {
188+
isa = XCBuildConfiguration;
189+
buildSettings = {
190+
ALWAYS_SEARCH_USER_PATHS = NO;
191+
CLANG_ANALYZER_NONNULL = YES;
192+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
193+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
194+
CLANG_CXX_LIBRARY = "libc++";
195+
CLANG_ENABLE_MODULES = YES;
196+
CLANG_ENABLE_OBJC_ARC = YES;
197+
CLANG_WARN_BOOL_CONVERSION = YES;
198+
CLANG_WARN_CONSTANT_CONVERSION = YES;
199+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
200+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
201+
CLANG_WARN_EMPTY_BODY = YES;
202+
CLANG_WARN_ENUM_CONVERSION = YES;
203+
CLANG_WARN_INFINITE_RECURSION = YES;
204+
CLANG_WARN_INT_CONVERSION = YES;
205+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
206+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
207+
CLANG_WARN_UNREACHABLE_CODE = YES;
208+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
209+
CODE_SIGN_IDENTITY = "-";
210+
COPY_PHASE_STRIP = NO;
211+
DEBUG_INFORMATION_FORMAT = dwarf;
212+
ENABLE_STRICT_OBJC_MSGSEND = YES;
213+
ENABLE_TESTABILITY = YES;
214+
GCC_C_LANGUAGE_STANDARD = gnu99;
215+
GCC_DYNAMIC_NO_PIC = NO;
216+
GCC_NO_COMMON_BLOCKS = YES;
217+
GCC_OPTIMIZATION_LEVEL = 0;
218+
GCC_PREPROCESSOR_DEFINITIONS = (
219+
"DEBUG=1",
220+
"$(inherited)",
221+
);
222+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
223+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
224+
GCC_WARN_UNDECLARED_SELECTOR = YES;
225+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
226+
GCC_WARN_UNUSED_FUNCTION = YES;
227+
GCC_WARN_UNUSED_VARIABLE = YES;
228+
MACOSX_DEPLOYMENT_TARGET = 10.12;
229+
MTL_ENABLE_DEBUG_INFO = YES;
230+
ONLY_ACTIVE_ARCH = YES;
231+
SDKROOT = macosx;
232+
};
233+
name = Debug;
234+
};
235+
B14511C71EEA8AD700FCDD10 /* Release */ = {
236+
isa = XCBuildConfiguration;
237+
buildSettings = {
238+
ALWAYS_SEARCH_USER_PATHS = NO;
239+
CLANG_ANALYZER_NONNULL = YES;
240+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
241+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
242+
CLANG_CXX_LIBRARY = "libc++";
243+
CLANG_ENABLE_MODULES = YES;
244+
CLANG_ENABLE_OBJC_ARC = YES;
245+
CLANG_WARN_BOOL_CONVERSION = YES;
246+
CLANG_WARN_CONSTANT_CONVERSION = YES;
247+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
248+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
249+
CLANG_WARN_EMPTY_BODY = YES;
250+
CLANG_WARN_ENUM_CONVERSION = YES;
251+
CLANG_WARN_INFINITE_RECURSION = YES;
252+
CLANG_WARN_INT_CONVERSION = YES;
253+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
254+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
255+
CLANG_WARN_UNREACHABLE_CODE = YES;
256+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
257+
CODE_SIGN_IDENTITY = "-";
258+
COPY_PHASE_STRIP = NO;
259+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
260+
ENABLE_NS_ASSERTIONS = NO;
261+
ENABLE_STRICT_OBJC_MSGSEND = YES;
262+
GCC_C_LANGUAGE_STANDARD = gnu99;
263+
GCC_NO_COMMON_BLOCKS = YES;
264+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
265+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
266+
GCC_WARN_UNDECLARED_SELECTOR = YES;
267+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
268+
GCC_WARN_UNUSED_FUNCTION = YES;
269+
GCC_WARN_UNUSED_VARIABLE = YES;
270+
MACOSX_DEPLOYMENT_TARGET = 10.12;
271+
MTL_ENABLE_DEBUG_INFO = NO;
272+
SDKROOT = macosx;
273+
};
274+
name = Release;
275+
};
276+
B14511C91EEA8AD700FCDD10 /* Debug */ = {
277+
isa = XCBuildConfiguration;
278+
buildSettings = {
279+
HEADER_SEARCH_PATHS = /usr/local/include;
280+
LIBRARY_SEARCH_PATHS = /usr/local/lib;
281+
PRODUCT_NAME = "$(TARGET_NAME)";
282+
};
283+
name = Debug;
284+
};
285+
B14511CA1EEA8AD700FCDD10 /* Release */ = {
286+
isa = XCBuildConfiguration;
287+
buildSettings = {
288+
HEADER_SEARCH_PATHS = /usr/local/include;
289+
LIBRARY_SEARCH_PATHS = /usr/local/lib;
290+
PRODUCT_NAME = "$(TARGET_NAME)";
291+
};
292+
name = Release;
293+
};
294+
/* End XCBuildConfiguration section */
295+
296+
/* Begin XCConfigurationList section */
297+
B14511BC1EEA8AD700FCDD10 /* Build configuration list for PBXProject "afsk" */ = {
298+
isa = XCConfigurationList;
299+
buildConfigurations = (
300+
B14511C61EEA8AD700FCDD10 /* Debug */,
301+
B14511C71EEA8AD700FCDD10 /* Release */,
302+
);
303+
defaultConfigurationIsVisible = 0;
304+
defaultConfigurationName = Release;
305+
};
306+
B14511C81EEA8AD700FCDD10 /* Build configuration list for PBXNativeTarget "afsk" */ = {
307+
isa = XCConfigurationList;
308+
buildConfigurations = (
309+
B14511C91EEA8AD700FCDD10 /* Debug */,
310+
B14511CA1EEA8AD700FCDD10 /* Release */,
311+
);
312+
defaultConfigurationIsVisible = 0;
313+
defaultConfigurationName = Release;
314+
};
315+
/* End XCConfigurationList section */
316+
};
317+
rootObject = B14511B91EEA8AD700FCDD10 /* Project object */;
318+
}

afsk.xcodeproj/project.xcworkspace/contents.xcworkspacedata

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)