-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from N0BOY/dev
Dev 0.89 -> Release
- Loading branch information
Showing
537 changed files
with
8,842 additions
and
1,602 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
26 changes: 0 additions & 26 deletions
26
ft8CN/app/src/androidTest/java/com/bg7yoz/ft8cn/ExampleInstrumentedTest.java
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
关于音频输出设置 | ||
|
||
采样位深:也称采样精度,FT8CN只有16位整型和32位浮点可选。采样位数是表示声音强度量化后的精细程度,它的数值越大,波动幅度的分辨率也就越高,所发出声音的能力越强。 | ||
|
||
采样率:也称取样频率, 指每秒钟取得声音样本的次数。采样频率越高,声音的质量也就越好,但占的资源也多。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Audio Output Setting | ||
|
||
Bit depth: Choose 16-bit int or 32-bit float. Bit depth dictates the number of possible amplitude values of audio sample. A higher bit depth will produce a higher resolution audio. | ||
|
||
Sample rate: Sample rate refers to the number of samples that are present within one second of digital audio. Higher sample rate provides more accurate audio waveform, but consume more system resources. |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
关于解码模式 | ||
快速解码:沿用原来FT8CN的解码,对接收到的音频做一次性的解码。 | ||
多次解码:在快速解码的基础上,再做多次的解码,增加迭代的次数,并尝试解码频率有叠加的信号。 | ||
注:多次解码增加的运算量,总的解码时间会变长,会缩短设备的续航时间。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Decode mode: | ||
Fast decode: Default mode, one decoding pass on received audio. | ||
Deep decode: Recursive decoding that process received audio in multiple passes . | ||
* Note: Deep decoding requires longer decoding time and more battery consumption. |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
|
||
# For more information about using CMake with Android Studio, read the | ||
# documentation: https://d.android.com/studio/projects/add-native-code.html | ||
|
||
# Sets the minimum version of CMake required to build the native library. | ||
|
||
cmake_minimum_required(VERSION 3.18.1) | ||
|
||
# Declares and names the project. | ||
|
||
project("ft8cn") | ||
|
||
# Creates and names a library, sets it as either STATIC | ||
# or SHARED, and provides the relative paths to its source code. | ||
# You can define multiple libraries, and CMake builds them for you. | ||
# Gradle automatically packages shared libraries with your APK. | ||
|
||
add_library( # Sets the name of the library. | ||
ft8cn | ||
|
||
# Sets the library as a shared library. | ||
SHARED | ||
|
||
# Provides a relative path to your source file(s). | ||
|
||
generate_ft8.cpp | ||
ft8Listener.cpp | ||
ft8Spectrum.cpp | ||
fft/kiss_fftr.c | ||
fft/kiss_fft.c | ||
|
||
ft8/decode.c | ||
ft8/crc.c | ||
ft8/constants.c | ||
ft8/ldpc.c | ||
ft8/unpack.c | ||
ft8/text.c | ||
ft8/hash22.c | ||
ft8/encode.c | ||
ft8/pack.c | ||
monitor_opr.c | ||
ft8Decoder.c | ||
ft8Encoder.c | ||
spectrum_data.c | ||
) | ||
|
||
# Searches for a specified prebuilt library and stores the path as a | ||
# variable. Because CMake includes system libraries in the search path by | ||
# default, you only need to specify the name of the public NDK library | ||
# you want to add. CMake verifies that the library exists before | ||
# completing its build. | ||
|
||
find_library( # Sets the name of the path variable. | ||
log-lib | ||
|
||
# Specifies the name of the NDK library that | ||
# you want CMake to locate. | ||
log ) | ||
|
||
# Specifies libraries CMake should link to your target library. You | ||
# can link multiple libraries, such as libraries you define in this | ||
# build script, prebuilt third-party libraries, or system libraries. | ||
|
||
target_link_libraries( # Specifies the target library. | ||
ft8cn | ||
|
||
# Links the target library to the log library | ||
# included in the NDK. | ||
${log-lib} ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// | ||
// Created by jmsmf on 2022/4/22. | ||
// | ||
|
||
#ifndef NATIVEC_COMM_STR_H | ||
#define NATIVEC_COMM_STR_H | ||
|
||
#endif //NATIVEC_COMM_STR_H | ||
const char ERROR_FILE_NAME_IS_NULL[] = "error:wav_path is null!!!"; | ||
const char ERROR_OPEN_FILE_FAILED[] ="Error : the content of the file does not meet the requirements."; | ||
const char INFO_DECODE_OK[] ="decode OK!!!"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#ifndef M_PI | ||
#define M_PI 3.14159265358979323846 | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#pragma once | ||
|
||
#include <stdio.h> | ||
|
||
#include<android/log.h> | ||
|
||
#define LOG_DEBUG 0 | ||
#define LOG_INFO 1 | ||
#define LOG_WARN 2 | ||
#define LOG_ERROR 3 | ||
#define LOG_FATAL 4 | ||
#define LOG_LEVEL LOG_DEBUG | ||
//#define LOG_LEVEL LOG_INFO | ||
|
||
//#define LOG(level, ...) if (level >= LOG_LEVEL) fprintf(stderr, __VA_ARGS__) | ||
#define TAG "FT8_DECODER" // 这个是自定义的LOG的标识 | ||
#define LOG(level, ...) if (level >= LOG_LEVEL) __android_log_print(ANDROID_LOG_INFO,TAG ,__VA_ARGS__) | ||
#define LOG_PRINTF(...) __android_log_print(ANDROID_LOG_INFO,TAG ,__VA_ARGS__) | ||
|
||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,TAG ,__VA_ARGS__) // 定义LOGD类型 | ||
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,TAG ,__VA_ARGS__) // 定义LOGI类型 | ||
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN,TAG ,__VA_ARGS__) // 定义LOGW类型 | ||
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,TAG ,__VA_ARGS__) // 定义LOGE类型 | ||
#define LOGF(...) __android_log_print(ANDROID_LOG_FATAL,TAG ,__VA_ARGS__) // 定义LOGF类型 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
#include "wave.h" | ||
|
||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <stdio.h> | ||
|
||
#include <stdint.h> | ||
|
||
// Save signal in floating point format (-1 .. +1) as a WAVE file using 16-bit signed integers. | ||
void save_wav(const float* signal, int num_samples, int sample_rate, const char* path) | ||
{ | ||
char subChunk1ID[4] = { 'f', 'm', 't', ' ' }; | ||
uint32_t subChunk1Size = 16; // 16 for PCM | ||
uint16_t audioFormat = 1; // PCM = 1 | ||
uint16_t numChannels = 1; | ||
uint16_t bitsPerSample = 16; | ||
uint32_t sampleRate = sample_rate; | ||
uint16_t blockAlign = numChannels * bitsPerSample / 8; | ||
uint32_t byteRate = sampleRate * blockAlign; | ||
|
||
char subChunk2ID[4] = { 'd', 'a', 't', 'a' }; | ||
uint32_t subChunk2Size = num_samples * blockAlign; | ||
|
||
char chunkID[4] = { 'R', 'I', 'F', 'F' }; | ||
uint32_t chunkSize = 4 + (8 + subChunk1Size) + (8 + subChunk2Size); | ||
char format[4] = { 'W', 'A', 'V', 'E' }; | ||
|
||
int16_t* raw_data = (int16_t*)malloc(num_samples * blockAlign); | ||
for (int i = 0; i < num_samples; i++) | ||
{ | ||
float x = signal[i]; | ||
if (x > 1.0) | ||
x = 1.0; | ||
else if (x < -1.0) | ||
x = -1.0; | ||
raw_data[i] = (int)(x * 32767.0); | ||
} | ||
|
||
FILE* f = fopen(path, "wb"); | ||
|
||
// NOTE: works only on little-endian architecture | ||
fwrite(chunkID, sizeof(chunkID), 1, f); | ||
fwrite(&chunkSize, sizeof(chunkSize), 1, f); | ||
fwrite(format, sizeof(format), 1, f); | ||
|
||
fwrite(subChunk1ID, sizeof(subChunk1ID), 1, f); | ||
fwrite(&subChunk1Size, sizeof(subChunk1Size), 1, f); | ||
fwrite(&audioFormat, sizeof(audioFormat), 1, f); | ||
fwrite(&numChannels, sizeof(numChannels), 1, f); | ||
fwrite(&sampleRate, sizeof(sampleRate), 1, f); | ||
fwrite(&byteRate, sizeof(byteRate), 1, f); | ||
fwrite(&blockAlign, sizeof(blockAlign), 1, f); | ||
fwrite(&bitsPerSample, sizeof(bitsPerSample), 1, f); | ||
|
||
fwrite(subChunk2ID, sizeof(subChunk2ID), 1, f); | ||
fwrite(&subChunk2Size, sizeof(subChunk2Size), 1, f); | ||
|
||
fwrite(raw_data, blockAlign, num_samples, f); | ||
|
||
fclose(f); | ||
|
||
free(raw_data); | ||
} | ||
|
||
// Load signal in floating point format (-1 .. +1) as a WAVE file using 16-bit signed integers. | ||
int load_wav(float* signal, int* num_samples, int* sample_rate, const char* path) | ||
{ | ||
char subChunk1ID[4]; // = {'f', 'm', 't', ' '}; | ||
uint32_t subChunk1Size; // = 16; // 16 for PCM | ||
uint16_t audioFormat; // = 1; // PCM = 1 | ||
uint16_t numChannels; // = 1; | ||
uint16_t bitsPerSample; // = 16; | ||
uint32_t sampleRate; | ||
uint16_t blockAlign; // = numChannels * bitsPerSample / 8; | ||
uint32_t byteRate; // = sampleRate * blockAlign; | ||
|
||
char subChunk2ID[4]; // = {'d', 'a', 't', 'a'}; | ||
uint32_t subChunk2Size; // = num_samples * blockAlign; | ||
|
||
char chunkID[4]; // = {'R', 'I', 'F', 'F'}; | ||
uint32_t chunkSize; // = 4 + (8 + subChunk1Size) + (8 + subChunk2Size); | ||
char format[4]; // = {'W', 'A', 'V', 'E'}; | ||
|
||
FILE* f = fopen(path, "rb"); | ||
if (f==NULL){ | ||
return -1; | ||
} | ||
|
||
// NOTE: works only on little-endian architecture | ||
fread((void*)chunkID, sizeof(chunkID), 1, f); | ||
fread((void*)&chunkSize, sizeof(chunkSize), 1, f); | ||
fread((void*)format, sizeof(format), 1, f); | ||
|
||
fread((void*)subChunk1ID, sizeof(subChunk1ID), 1, f); | ||
fread((void*)&subChunk1Size, sizeof(subChunk1Size), 1, f); | ||
if (subChunk1Size != 16) | ||
return -1; | ||
|
||
fread((void*)&audioFormat, sizeof(audioFormat), 1, f); | ||
fread((void*)&numChannels, sizeof(numChannels), 1, f); | ||
fread((void*)&sampleRate, sizeof(sampleRate), 1, f); | ||
fread((void*)&byteRate, sizeof(byteRate), 1, f); | ||
fread((void*)&blockAlign, sizeof(blockAlign), 1, f); | ||
fread((void*)&bitsPerSample, sizeof(bitsPerSample), 1, f); | ||
|
||
if (audioFormat != 1 || numChannels != 1 || bitsPerSample != 16) | ||
return -1; | ||
|
||
fread((void*)subChunk2ID, sizeof(subChunk2ID), 1, f); | ||
fread((void*)&subChunk2Size, sizeof(subChunk2Size), 1, f); | ||
|
||
if (subChunk2Size / blockAlign > *num_samples) | ||
return -2; | ||
|
||
*num_samples = subChunk2Size / blockAlign; | ||
*sample_rate = sampleRate; | ||
|
||
int16_t* raw_data = (int16_t*)malloc(*num_samples * blockAlign); | ||
|
||
fread((void*)raw_data, blockAlign, *num_samples, f); | ||
for (int i = 0; i < *num_samples; i++) | ||
{ | ||
signal[i] = raw_data[i] / 32768.0f; | ||
} | ||
|
||
free(raw_data); | ||
|
||
fclose(f); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef _INCLUDE_WAVE_H_ | ||
#define _INCLUDE_WAVE_H_ | ||
|
||
// Save signal in floating point format (-1 .. +1) as a WAVE file using 16-bit signed integers. | ||
void save_wav(const float* signal, int num_samples, int sample_rate, const char* path); | ||
|
||
// Load signal in floating point format (-1 .. +1) as a WAVE file using 16-bit signed integers. | ||
int load_wav(float* signal, int* num_samples, int* sample_rate, const char* path); | ||
|
||
#endif // _INCLUDE_WAVE_H_ |
Oops, something went wrong.