diff --git a/.gitignore b/.gitignore index 7efd8bb..2a98046 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ -src/???.wav +src/waveform_*.wav src/pydemod +src/test +*.o + diff --git a/src/Makefile b/src/Makefile index 559695a..1558298 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,11 +4,14 @@ CFLAGS=-Wall -std=c99 -c -g all: rds.o waveforms.o $(CC) -o test rds.o waveforms.o -rds.o: rds.c +rds.o: rds.c waveforms.h $(CC) $(CFLAGS) rds.c waveforms.o: waveforms.c waveforms.h $(CC) $(CFLAGS) waveforms.c - + +waveforms.h: generate_waveforms.py + python generate_waveforms.py + clean: rm *.o \ No newline at end of file diff --git a/src/generate_waveforms.py b/src/generate_waveforms.py index 6fa4e90..b7bbe67 100755 --- a/src/generate_waveforms.py +++ b/src/generate_waveforms.py @@ -30,32 +30,27 @@ def format_number(x): else: return unicode(x) -def generate_bit_in_context(prev, current, next): - name = u"{}{}{}".format(prev, current, next) +def generate_bit_in_context(pattern, name): + offset = 240 + l = 96 + count = 2 + + shapedSamples = rds.unmodulated_signal(pattern, sample_rate) - shapedSamples = rds.unmodulated_signal([prev, current, next], sample_rate) - - out = am.modulate(shapedSamples, sample_rate, frequency=57000, phase=0) - - out = out[336:336+192] + out = shapedSamples[offset:offset+l*count] iout = (out * 20000./max(abs(out)) ).astype(numpy.dtype('>i2')) - wavfile.write(u"{}.wav".format(name), sample_rate, iout) + wavfile.write(u"waveform_{}.wav".format(name), sample_rate, iout) - outc.write(u"float symbol_{name}[] = {{{values}}};\n\n".format( + outc.write(u"float waveform_{name}[] = {{{values}}};\n\n".format( name = name, values = u", ".join(map(format_number, out)))) - #outh.write(u"extern float symbol_{name}[];\n".format(name=name)) + outh.write(u"extern float waveform_{name}[];\n".format(name=name)) -for prev in [0, 1]: - for current in [0, 1]: - for next in [0, 1]: - generate_bit_in_context(prev, current, next) - -outc.write(u"float *symbol_samples[2][2][2] = {{{symbol_000, symbol_001}, {symbol_010, symbol_011}}, {{symbol_100, symbol_101}, {symbol_110, symbol_111}}};\n") -outh.write(u"extern float *symbol_samples[2][2][2];\n") +generate_bit_in_context([0, 0, 0], "identical") +generate_bit_in_context([0, 1, 0], "different") outc.close() outh.close() \ No newline at end of file diff --git a/src/rds.c b/src/rds.c index 3f1ab3b..4289bd1 100644 --- a/src/rds.c +++ b/src/rds.c @@ -1,3 +1,23 @@ +/* + PiFmRds - FM/RDS transmitter for the Raspberry Pi + Copyright (C) 2014 Christophe Jacquet, F8FTK + + See https://github.com/ChristopheJacquet/PiFmRds + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + #include #include #include @@ -89,16 +109,23 @@ void get_rds_group(int *buffer) { } } +/* Get a number of RDS samples. This generates the envelope of the waveform using + pre-generated elementary waveform samples, and then it amplitude-modulates the + envelope with a 57 kHz carrier, which is very efficient as 57 kHz is 4 times the + sample frequency we are working at (228 kHz). + */ void get_rds_samples(float *buffer, int count) { static int bit_buffer[BITS_PER_GROUP]; static int bit_pos = BITS_PER_GROUP; - //static int prev_output = 0; + static int prev_output = 0; + static int cur_output = 0; static int prev_bit = 0; static int cur_bit = 0; - //static int cur_output = 0; - static int next_bit = 0; static int sample_pos = SAMPLES_PER_BIT; + static float *current_waveform = NULL; + static int inverting = 0; + static int phase = 0; for(int i=0; i= SAMPLES_PER_BIT) { @@ -106,29 +133,52 @@ void get_rds_samples(float *buffer, int count) { get_rds_group(bit_buffer); bit_pos = 0; } + + // do differential encoding prev_bit = cur_bit; - cur_bit = next_bit; - next_bit = bit_buffer[bit_pos]; - //prev_output = cur_output; - //cur_output = prev_output ^ cur_bit; + cur_bit = bit_buffer[bit_pos]; + prev_output = cur_output; + cur_output = prev_output ^ cur_bit; + + // select appropriate waveform + current_waveform = (prev_output == cur_output) ? + waveform_identical : waveform_different; + + inverting = (prev_output == 0) ? 1 : -1; bit_pos++; - //printf("%d", cur_bit); fflush(stdout); sample_pos = 0; + //printf("%d", cur_bit); fflush(stdout); } - float sample = symbol_samples[prev_bit][cur_bit][next_bit][sample_pos]; + float sample = current_waveform[sample_pos] * inverting; + + // modulate at 57 kHz + // use phase for this + switch(phase) { + case 0: + case 2: sample = 0; break; + case 1: break; + case 3: sample = -sample; break; + } + phase++; + if(phase >= 4) phase = 0; + *buffer++ = sample; - printf("%c", (((int)(sample*100)))); sample_pos++; } } +/* Simple test program */ int main(int argc, char **argv) { rds_params.pi = 0x1234; strncpy(rds_params.text, "Hello", 64); - float buffer[128000]; + float buffer[300000]; - get_rds_samples(buffer, 100000); + get_rds_samples(buffer, 300000); + + for(int i=0; i<300000; i++) { + printf("%c", (((int)(buffer[i]*50)))); + } } \ No newline at end of file diff --git a/src/waveforms.c b/src/waveforms.c index 5f898ff..d777a8d 100644 --- a/src/waveforms.c +++ b/src/waveforms.c @@ -4,20 +4,7 @@ Released under the GNU GPL v3 license. */ -float symbol_000[] = {0, -0.0688924767714, 0, 0.160476027168, 0, -0.251405034722, 0, 0.341307939122, 0, -0.429816470713, 0, 0.516566856073, 0, -0.601201031227, 0, 0.683367863703, 0, -0.76272438406, 0, 0.838937026839, 0, -0.911682880148, 0, 0.980650942258, 0, -1.04554338271, 0, 1.10607680447, 0, -1.16198350282, 0, 1.2130127156, 0, -1.25893185853, 0, 1.29952773851, 0, -1.33460773675, 0, 1.36400095304, 0, -1.38755930158, 0, 1.40515854821, 0, -1.41669927855, 0, 1.422107786, 0, -1.4209101738, 0, 1.41310777364, 0, -1.39917719852, 0, 1.37919502884, 0, -1.35326381164, 0, 1.3215112686, 0, -1.28408941638, 0, 1.24117360847, 0, -1.19296150733, 0, 1.13967199528, 0, -1.08154403238, 0, 1.01883546886, 0, -0.951821819184, 0, 0.880795004393, 0, -0.806062068456, 0, 0.72794387397, 0, -0.646773781723, 0, 0.562896318018, 0, -0.476665833037, 0, 0.388445152869, 0, -0.298604227296, 0, 0.207518774887, 0, -0.115568926523, 0, 0.0231378680857, 0, 0.0693895172325, 0, -0.161628006774, 0, 0.253193396276, 0, -0.343703857662, 0, 0.432781296583, 0, -0.520052709381, 0, 0.605151538892, 0, -0.687719028179, 0, 0.767405570842, 0, -0.843872056124, 0, 0.916791206429, 0, -0.985848904339, 0, 1.05074550545, 0, -1.11119713309, 0, 1.16693694952, 0, -1.21771639861, 0, 1.26330641337, 0, -1.30349858178, 0, 1.33810626336, 0, -1.3669656487, 0, 1.38993675357, 0, -1.40690433891, 0, 1.41777874782, 0, -1.42249665043, 0, 1.42017364013, 0, -1.41169144692, 0, 1.39711061857, 0, -1.37651782114, 0, 1.35002499518, 0, -1.31776842624, 0, 1.2799077409, 0, -1.23662483888, 0, 1.18812277181, 0, -1.13462457836, 0, 1.07637208496, 0, -1.01362468058, 0, 0.946658073004, 0, -0.875763033693, 0, 0.80124413653, 0, -0.723418495748, 0, 0.642614506708, 0, -0.559170592547, 0, 0.473433958761, 0, -0.385759356914, 0, 0.296507857888, 0, -0.206045634362, 0, 0.114742751598, 0, -0.0229719650907}; +float waveform_identical[] = {-0.0126499131387, 0.0343305815657, 0.0813699681631, 0.128412941973, 0.175404018104, 0.222287609096, 0.269008102599, 0.315509938949, 0.361737688529, 0.407636128811, 0.453150320949, 0.498225685819, 0.542808079393, 0.586843867343, 0.630279998762, 0.673064078904, 0.715144440843, 0.756470215951, 0.796991403091, 0.836658936453, 0.875424751921, 0.9132418519, 0.950064368511, 0.985847625093, 1.02054819583, 1.05412396373, 1.0865341764, 1.1177395, 1.14770207112, 1.17638554646, 1.20375515038, 1.22977772023, 1.25442174933, 1.27765742771, 1.29945668037, 1.31979320323, 1.33864249651, 1.35598189576, 1.37179060021, 1.38604969876, 1.39874219321, 1.40985301907, 1.41936906364, 1.42727918155, 1.43357420759, 1.43824696701, 1.44129228307, 1.42249665043, 1.422107786, 1.42017364013, 1.41669927855, 1.41169144692, 1.40515854821, 1.39711061857, 1.38755930158, 1.37651782114, 1.36400095304, 1.35002499518, 1.33460773675, 1.31776842624, 1.29952773851, 1.2799077409, 1.25893185853, 1.23662483888, 1.2130127156, 1.18812277181, 1.16198350282, 1.13462457836, 1.10607680447, 1.07637208496, 1.04554338271, 1.01362468058, 0.980650942258, 0.946658073004, 0.911682880148, 0.875763033693, 0.838937026839, 0.80124413653, 0.76272438406, 0.723418495748, 0.683367863703, 0.642614506708, 0.601201031227, 0.559170592547, 0.516566856073, 0.473433958761, 0.429816470713, 0.385759356914, 0.341307939122, 0.296507857888, 0.251405034722, 0.206045634362, 0.160476027168, 0.114742751598, 0.0688924767714, 0.0229719650907, -0.0229719650907, -0.0688924767714, -0.114742751598, -0.160476027168, -0.206045634362, -0.251405034722, -0.296507857888, -0.341307939122, -0.385759356914, -0.429816470713, -0.473433958761, -0.516566856073, -0.559170592547, -0.601201031227, -0.642614506708, -0.683367863703, -0.723418495748, -0.76272438406, -0.80124413653, -0.838937026839, -0.875763033693, -0.911682880148, -0.946658073004, -0.980650942258, -1.01362468058, -1.04554338271, -1.07637208496, -1.10607680447, -1.13462457836, -1.16198350282, -1.18812277181, -1.2130127156, -1.23662483888, -1.25893185853, -1.2799077409, -1.29952773851, -1.31776842624, -1.33460773675, -1.35002499518, -1.36400095304, -1.37651782114, -1.38755930158, -1.39711061857, -1.40515854821, -1.41169144692, -1.41669927855, -1.42017364013, -1.422107786, -1.42249665043, -1.4209101738, -1.41777874782, -1.41310777364, -1.40690433891, -1.39917719852, -1.38993675357, -1.37919502884, -1.3669656487, -1.35326381164, -1.33810626336, -1.3215112686, -1.30349858178, -1.28408941638, -1.26330641337, -1.24117360847, -1.21771639861, -1.19296150733, -1.16693694952, -1.13967199528, -1.11119713309, -1.08154403238, -1.05074550545, -1.01883546886, -0.985848904339, -0.951821819184, -0.916791206429, -0.880795004393, -0.843872056124, -0.806062068456, -0.767405570842, -0.72794387397, -0.687719028179, -0.646773781723, -0.605151538892, -0.562896318018, -0.520052709381, -0.476665833037, -0.432781296583, -0.388445152869, -0.343703857662, -0.298604227296, -0.253193396276, -0.207518774887, -0.161628006774, -0.115568926523, -0.0693895172325, -0.0231378680857}; -float symbol_001[] = {0, -0.0688924767714, 0, 0.160476027168, 0, -0.251405034722, 0, 0.341307939122, 0, -0.429816470713, 0, 0.516566856073, 0, -0.601201031227, 0, 0.683367863703, 0, -0.76272438406, 0, 0.838937026839, 0, -0.911682880148, 0, 0.980650942258, 0, -1.04554338271, 0, 1.10607680447, 0, -1.16198350282, 0, 1.2130127156, 0, -1.25893185853, 0, 1.29952773851, 0, -1.33460773675, 0, 1.36400095304, 0, -1.38755930158, 0, 1.40515854821, 0, -1.41669927855, 0, 1.422107786, 0, -1.46167439235, 0, 1.45404064154, 0, -1.43956092877, 0, 1.41828935759, 0, -1.39031738878, 0, 1.35577372442, 0, -1.31482394436, 0, 1.26766989019, 0, -1.21454879344, 0, 1.15573214697, 0, -1.09152432041, 0, 1.0222609228, 0, -0.948306917838, 0, 0.870054499449, 0, -0.787920737727, 0, 0.702345007717, 0, -0.613786215801, 0, 0.522719840769, 0, -0.429634808861, 0, 0.335030224189, 0, -0.239411977903, 0, 0.143289261321, 0, -0.0471710098037, 0, -0.0484376943631, 0, 0.143039230713, 0, -0.236147030654, 0, 0.327289117905, 0, -0.416011568082, 0, 0.501881856137, 0, -0.584492060718, 0, 0.663461895111, 0, -0.738441535427, 0, 0.809114217969, 0, -0.875198579363, 0, 0.936450714972, 0, -0.992665933357, 0, 1.043680187, 0, -1.08937116266, 0, 1.12965901699, 0, -1.16450674727, 0, 1.19392018979, 0, -1.21794764224, 0, 1.23667911027, 0, -1.2502451818, 0, 1.2588155368, 0, -1.26259710362, 0, 1.26183187709, 0, -1.29721507979, 0, 1.28787743776, 0, -1.27424291301, 0, 1.25667951096, 0, -1.23558399413, 0, 1.21137792785, 0, -1.18450348684, 0, 1.15541906265, 0, -1.1245947143, 0, 1.09250750617, 0, -1.05963677844, 0, 1.02645939621, 0, -0.993445023832, 0, 0.96105147071, 0, -0.929720154741, 0, 0.899871727579, 0, -0.871901905518, 0, 0.846177546948, 0, -0.823033015423, 0, 0.80276686443, 0, -0.785638876839, 0, 0.771867488518, 0, -0.761627621767, 0, 0.755048950196, 0, -0.752214612349}; +float waveform_different[] = {0.0601072886642, 0.107980295047, 0.155610770913, 0.202931965854, 0.249877864799, 0.296383330725, 0.342384245619, 0.387817649369, 0.432621876207, 0.476736688365, 0.520103406583, 0.562665037156, 0.60436639516, 0.645154223562, 0.684977307888, 0.723786586151, 0.761535253753, 0.798178863077, 0.833675417519, 0.867985459692, 0.901072153585, 0.932901360443, 0.963441708175, 0.992664654111, 1.02054454084, 1.04705864528, 1.07218722035, 1.09591352958, 1.1182238744, 1.13910761393, 1.15855717738, 1.1765680689, 1.19313886494, 1.20827120413, 1.22196976955, 1.23424226369, 1.24509937591, 1.25455474267, 1.26262490048, 1.26932923186, 1.27468990427, 1.2787318023, 1.28148245324, 1.28297194626, 1.28323284533, 1.28230009628, 1.28021092798, 1.29721507979, 1.29310514353, 1.28787743776, 1.28157500391, 1.27424291301, 1.26592815291, 1.25667951096, 1.24654745231, 1.23558399413, 1.22384257617, 1.21137792785, 1.19824593214, 1.18450348684, 1.17020836322, 1.15541906265, 1.14019467145, 1.1245947143, 1.1086790066, 1.09250750617, 1.07614016456, 1.05963677844, 1.04305684135, 1.02645939621, 1.009902889, 0.993445023832, 0.977142619896, 0.96105147071, 0.945226205683, 0.929720154741, 0.914585216098, 0.899871727579, 0.885628341798, 0.871901905518, 0.858737343471, 0.846177546948, 0.834263267412, 0.823033015423, 0.812522965109, 0.80276686443, 0.793795951449, 0.785638876839, 0.77832163279, 0.771867488518, 0.766296932528, 0.761627621767, 0.757874337815, 0.755048950196, 0.753160386924, 0.752214612349, 0.752214612349, 0.753160386924, 0.755048950196, 0.757874337815, 0.761627621767, 0.766296932528, 0.771867488518, 0.77832163279, 0.785638876839, 0.793795951449, 0.80276686443, 0.812522965109, 0.823033015423, 0.834263267412, 0.846177546948, 0.858737343471, 0.871901905518, 0.885628341798, 0.899871727579, 0.914585216098, 0.929720154741, 0.945226205683, 0.96105147071, 0.977142619896, 0.993445023832, 1.009902889, 1.02645939621, 1.04305684135, 1.05963677844, 1.07614016456, 1.09250750617, 1.1086790066, 1.1245947143, 1.14019467145, 1.15541906265, 1.17020836322, 1.18450348684, 1.19824593214, 1.21137792785, 1.22384257617, 1.23558399413, 1.24654745231, 1.25667951096, 1.26592815291, 1.27424291301, 1.28157500391, 1.28787743776, 1.29310514353, 1.25679441665, 1.25982881871, 1.26183187709, 1.26276641138, 1.26259710362, 1.26129058812, 1.2588155368, 1.2551427399, 1.2502451818, 1.24409811191, 1.23667911027, 1.227968148, 1.21794764224, 1.20660250556, 1.19392018979, 1.17989072409, 1.16450674727, 1.14776353433, 1.12965901699, 1.11019379855, 1.08937116266, 1.06719707633, 1.043680187, 1.01883181387, 0.992665933357, 0.965199158848, 0.936450714972, 0.906442406057, 0.875198579363, 0.842746082883, 0.809114217969, 0.77433468688, 0.738441535427, 0.701471090849, 0.663461895111, 0.624454633785, 0.584492060718, 0.543618918671, 0.501881856137, 0.459329340547, 0.416011568082, 0.371980370315, 0.327289117905, 0.281992621583, 0.236147030654, 0.189809729273, 0.143039230713, 0.0958950698886}; -float symbol_010[] = {0, 0.753160386924, 0, -0.757874337815, 0, 0.766296932528, 0, -0.77832163279, 0, 0.793795951449, 0, -0.812522965109, 0, 0.834263267412, 0, -0.858737343471, 0, 0.885628341798, 0, -0.914585216098, 0, 0.945226205683, 0, -0.977142619896, 0, 1.009902889, 0, -1.04305684135, 0, 1.07614016456, 0, -1.1086790066, 0, 1.14019467145, 0, -1.17020836322, 0, 1.19824593214, 0, -1.22384257617, 0, 1.24654745231, 0, -1.26592815291, 0, 1.28157500391, 0, -1.29310514353, 0, 1.25982881871, 0, -1.26276641138, 0, 1.26129058812, 0, -1.2551427399, 0, 1.24409811191, 0, -1.227968148, 0, 1.20660250556, 0, -1.17989072409, 0, 1.14776353433, 0, -1.11019379855, 0, 1.06719707633, 0, -1.01883181387, 0, 0.965199158848, 0, -0.906442406057, 0, 0.842746082883, 0, -0.77433468688, 0, 0.701471090849, 0, -0.624454633785, 0, 0.543618918671, 0, -0.459329340547, 0, 0.371980370315, 0, -0.281992621583, 0, 0.189809729273, 0, -0.0958950698886, 0, 0.000728354101177, 0, 0.0951978771733, 0, -0.191381821916, 0, 0.287316020235, 0, -0.382490961038, 0, 0.476398662257, 0, -0.568536195794, 0, 0.658409129628, 0, -0.74553486106, 0, 0.829445816782, 0, -0.909692497372, 0, 0.985846345847, 0, -1.05750242201, 0, 1.12428186692, 0, -1.1858341434, 0, 1.24183904185, 0, -1.29200844205, 0, 1.33608782467, 0, -1.37385752815, 0, 1.40513374882, 0, -1.42976928457, 0, 1.44765402418, 0, -1.4587151862, 0, 1.42249665043, 0, -1.42017364013, 0, 1.41169144692, 0, -1.39711061857, 0, 1.37651782114, 0, -1.35002499518, 0, 1.31776842624, 0, -1.2799077409, 0, 1.23662483888, 0, -1.18812277181, 0, 1.13462457836, 0, -1.07637208496, 0, 1.01362468058, 0, -0.946658073004, 0, 0.875763033693, 0, -0.80124413653, 0, 0.723418495748, 0, -0.642614506708, 0, 0.559170592547, 0, -0.473433958761, 0, 0.385759356914, 0, -0.296507857888, 0, 0.206045634362, 0, -0.114742751598, 0, 0.0229719650907}; - -float symbol_011[] = {0, 0.753160386924, 0, -0.757874337815, 0, 0.766296932528, 0, -0.77832163279, 0, 0.793795951449, 0, -0.812522965109, 0, 0.834263267412, 0, -0.858737343471, 0, 0.885628341798, 0, -0.914585216098, 0, 0.945226205683, 0, -0.977142619896, 0, 1.009902889, 0, -1.04305684135, 0, 1.07614016456, 0, -1.1086790066, 0, 1.14019467145, 0, -1.17020836322, 0, 1.19824593214, 0, -1.22384257617, 0, 1.24654745231, 0, -1.26592815291, 0, 1.28157500391, 0, -1.29310514353, 0, 1.30059303726, 0, -1.30369927929, 0, 1.30167431836, 0, -1.29423706865, 0, 1.28115168905, 0, -1.26223060382, 0, 1.23733703354, 0, -1.2063870058, 0, 1.16935082044, 0, -1.12625395025, 0, 1.07717736436, 0, -1.02225726781, 0, 0.961684257503, 0, -0.895701901113, 0, 0.824604752155, 0, -0.748735820626, 0, 0.668483524927, 0, -0.584278156535, 0, 0.496587894496, 0, -0.405914411867, 0, 0.312788120923, 0, -0.217763108016, 0, 0.121411812554, 0, -0.0243195074398, 0, -0.0729213593797, 0, 0.169716901053, 0, -0.265477543545, 0, 0.359623730655, 0, -0.451591520592, 0, 0.540838013594, 0, -0.626846552013, 0, 0.709131636876, 0, -0.787243508186, 0, 0.860772340021, 0, -0.929352005915, 0, 0.992663374866, 0, -1.05043710356, 0, 1.1024558965, 0, -1.14855621088, 0, 1.18862939052, 0, -1.22262221847, 0, 1.25053688514, 0, -1.27243037506, 0, 1.28841328192, 0, -1.2986480678, 0, 1.30334678889, 0, -1.30276831547, 0, 1.29721507979, 0, -1.28787743776, 0, 1.27424291301, 0, -1.25667951096, 0, 1.23558399413, 0, -1.21137792785, 0, 1.18450348684, 0, -1.15541906265, 0, 1.1245947143, 0, -1.09250750617, 0, 1.05963677844, 0, -1.02645939621, 0, 0.993445023832, 0, -0.96105147071, 0, 0.929720154741, 0, -0.899871727579, 0, 0.871901905518, 0, -0.846177546948, 0, 0.823033015423, 0, -0.80276686443, 0, 0.785638876839, 0, -0.771867488518, 0, 0.761627621767, 0, -0.755048950196, 0, 0.752214612349}; - -float symbol_100[] = {0, -0.0688924767714, 0, 0.160476027168, 0, -0.251405034722, 0, 0.341307939122, 0, -0.429816470713, 0, 0.516566856073, 0, -0.601201031227, 0, 0.683367863703, 0, -0.76272438406, 0, 0.838937026839, 0, -0.911682880148, 0, 0.980650942258, 0, -1.04554338271, 0, 1.10607680447, 0, -1.16198350282, 0, 1.2130127156, 0, -1.25893185853, 0, 1.29952773851, 0, -1.33460773675, 0, 1.36400095304, 0, -1.38755930158, 0, 1.40515854821, 0, -1.41669927855, 0, 1.422107786, 0, -1.4209101738, 0, 1.41310777364, 0, -1.39917719852, 0, 1.37919502884, 0, -1.35326381164, 0, 1.3215112686, 0, -1.28408941638, 0, 1.24117360847, 0, -1.19296150733, 0, 1.13967199528, 0, -1.08154403238, 0, 1.01883546886, 0, -0.951821819184, 0, 0.880795004393, 0, -0.806062068456, 0, 0.72794387397, 0, -0.646773781723, 0, 0.562896318018, 0, -0.476665833037, 0, 0.388445152869, 0, -0.298604227296, 0, 0.207518774887, 0, -0.115568926523, 0, 0.0231378680857, 0, 0.0693895172325, 0, -0.161628006774, 0, 0.253193396276, 0, -0.343703857662, 0, 0.432781296583, 0, -0.520052709381, 0, 0.605151538892, 0, -0.687719028179, 0, 0.767405570842, 0, -0.843872056124, 0, 0.916791206429, 0, -0.985848904339, 0, 1.05074550545, 0, -1.11119713309, 0, 1.16693694952, 0, -1.21771639861, 0, 1.26330641337, 0, -1.30349858178, 0, 1.33810626336, 0, -1.3669656487, 0, 1.38993675357, 0, -1.40690433891, 0, 1.41777874782, 0, -1.42249665043, 0, 1.42017364013, 0, -1.41169144692, 0, 1.39711061857, 0, -1.37651782114, 0, 1.35002499518, 0, -1.31776842624, 0, 1.2799077409, 0, -1.23662483888, 0, 1.18812277181, 0, -1.13462457836, 0, 1.07637208496, 0, -1.01362468058, 0, 0.946658073004, 0, -0.875763033693, 0, 0.80124413653, 0, -0.723418495748, 0, 0.642614506708, 0, -0.559170592547, 0, 0.473433958761, 0, -0.385759356914, 0, 0.296507857888, 0, -0.206045634362, 0, 0.114742751598, 0, -0.0229719650907}; - -float symbol_101[] = {0, -0.0688924767714, 0, 0.160476027168, 0, -0.251405034722, 0, 0.341307939122, 0, -0.429816470713, 0, 0.516566856073, 0, -0.601201031227, 0, 0.683367863703, 0, -0.76272438406, 0, 0.838937026839, 0, -0.911682880148, 0, 0.980650942258, 0, -1.04554338271, 0, 1.10607680447, 0, -1.16198350282, 0, 1.2130127156, 0, -1.25893185853, 0, 1.29952773851, 0, -1.33460773675, 0, 1.36400095304, 0, -1.38755930158, 0, 1.40515854821, 0, -1.41669927855, 0, 1.422107786, 0, -1.46167439235, 0, 1.45404064154, 0, -1.43956092877, 0, 1.41828935759, 0, -1.39031738878, 0, 1.35577372442, 0, -1.31482394436, 0, 1.26766989019, 0, -1.21454879344, 0, 1.15573214697, 0, -1.09152432041, 0, 1.0222609228, 0, -0.948306917838, 0, 0.870054499449, 0, -0.787920737727, 0, 0.702345007717, 0, -0.613786215801, 0, 0.522719840769, 0, -0.429634808861, 0, 0.335030224189, 0, -0.239411977903, 0, 0.143289261321, 0, -0.0471710098037, 0, -0.0484376943631, 0, 0.143039230713, 0, -0.236147030654, 0, 0.327289117905, 0, -0.416011568082, 0, 0.501881856137, 0, -0.584492060718, 0, 0.663461895111, 0, -0.738441535427, 0, 0.809114217969, 0, -0.875198579363, 0, 0.936450714972, 0, -0.992665933357, 0, 1.043680187, 0, -1.08937116266, 0, 1.12965901699, 0, -1.16450674727, 0, 1.19392018979, 0, -1.21794764224, 0, 1.23667911027, 0, -1.2502451818, 0, 1.2588155368, 0, -1.26259710362, 0, 1.26183187709, 0, -1.29721507979, 0, 1.28787743776, 0, -1.27424291301, 0, 1.25667951096, 0, -1.23558399413, 0, 1.21137792785, 0, -1.18450348684, 0, 1.15541906265, 0, -1.1245947143, 0, 1.09250750617, 0, -1.05963677844, 0, 1.02645939621, 0, -0.993445023832, 0, 0.96105147071, 0, -0.929720154741, 0, 0.899871727579, 0, -0.871901905518, 0, 0.846177546948, 0, -0.823033015423, 0, 0.80276686443, 0, -0.785638876839, 0, 0.771867488518, 0, -0.761627621767, 0, 0.755048950196, 0, -0.752214612349}; - -float symbol_110[] = {0, 0.753160386924, 0, -0.757874337815, 0, 0.766296932528, 0, -0.77832163279, 0, 0.793795951449, 0, -0.812522965109, 0, 0.834263267412, 0, -0.858737343471, 0, 0.885628341798, 0, -0.914585216098, 0, 0.945226205683, 0, -0.977142619896, 0, 1.009902889, 0, -1.04305684135, 0, 1.07614016456, 0, -1.1086790066, 0, 1.14019467145, 0, -1.17020836322, 0, 1.19824593214, 0, -1.22384257617, 0, 1.24654745231, 0, -1.26592815291, 0, 1.28157500391, 0, -1.29310514353, 0, 1.25982881871, 0, -1.26276641138, 0, 1.26129058812, 0, -1.2551427399, 0, 1.24409811191, 0, -1.227968148, 0, 1.20660250556, 0, -1.17989072409, 0, 1.14776353433, 0, -1.11019379855, 0, 1.06719707633, 0, -1.01883181387, 0, 0.965199158848, 0, -0.906442406057, 0, 0.842746082883, 0, -0.77433468688, 0, 0.701471090849, 0, -0.624454633785, 0, 0.543618918671, 0, -0.459329340547, 0, 0.371980370315, 0, -0.281992621583, 0, 0.189809729273, 0, -0.0958950698886, 0, 0.000728354101177, 0, 0.0951978771733, 0, -0.191381821916, 0, 0.287316020235, 0, -0.382490961038, 0, 0.476398662257, 0, -0.568536195794, 0, 0.658409129628, 0, -0.74553486106, 0, 0.829445816782, 0, -0.909692497372, 0, 0.985846345847, 0, -1.05750242201, 0, 1.12428186692, 0, -1.1858341434, 0, 1.24183904185, 0, -1.29200844205, 0, 1.33608782467, 0, -1.37385752815, 0, 1.40513374882, 0, -1.42976928457, 0, 1.44765402418, 0, -1.4587151862, 0, 1.42249665043, 0, -1.42017364013, 0, 1.41169144692, 0, -1.39711061857, 0, 1.37651782114, 0, -1.35002499518, 0, 1.31776842624, 0, -1.2799077409, 0, 1.23662483888, 0, -1.18812277181, 0, 1.13462457836, 0, -1.07637208496, 0, 1.01362468058, 0, -0.946658073004, 0, 0.875763033693, 0, -0.80124413653, 0, 0.723418495748, 0, -0.642614506708, 0, 0.559170592547, 0, -0.473433958761, 0, 0.385759356914, 0, -0.296507857888, 0, 0.206045634362, 0, -0.114742751598, 0, 0.0229719650907}; - -float symbol_111[] = {0, 0.753160386924, 0, -0.757874337815, 0, 0.766296932528, 0, -0.77832163279, 0, 0.793795951449, 0, -0.812522965109, 0, 0.834263267412, 0, -0.858737343471, 0, 0.885628341798, 0, -0.914585216098, 0, 0.945226205683, 0, -0.977142619896, 0, 1.009902889, 0, -1.04305684135, 0, 1.07614016456, 0, -1.1086790066, 0, 1.14019467145, 0, -1.17020836322, 0, 1.19824593214, 0, -1.22384257617, 0, 1.24654745231, 0, -1.26592815291, 0, 1.28157500391, 0, -1.29310514353, 0, 1.30059303726, 0, -1.30369927929, 0, 1.30167431836, 0, -1.29423706865, 0, 1.28115168905, 0, -1.26223060382, 0, 1.23733703354, 0, -1.2063870058, 0, 1.16935082044, 0, -1.12625395025, 0, 1.07717736436, 0, -1.02225726781, 0, 0.961684257503, 0, -0.895701901113, 0, 0.824604752155, 0, -0.748735820626, 0, 0.668483524927, 0, -0.584278156535, 0, 0.496587894496, 0, -0.405914411867, 0, 0.312788120923, 0, -0.217763108016, 0, 0.121411812554, 0, -0.0243195074398, 0, -0.0729213593797, 0, 0.169716901053, 0, -0.265477543545, 0, 0.359623730655, 0, -0.451591520592, 0, 0.540838013594, 0, -0.626846552013, 0, 0.709131636876, 0, -0.787243508186, 0, 0.860772340021, 0, -0.929352005915, 0, 0.992663374866, 0, -1.05043710356, 0, 1.1024558965, 0, -1.14855621088, 0, 1.18862939052, 0, -1.22262221847, 0, 1.25053688514, 0, -1.27243037506, 0, 1.28841328192, 0, -1.2986480678, 0, 1.30334678889, 0, -1.30276831547, 0, 1.29721507979, 0, -1.28787743776, 0, 1.27424291301, 0, -1.25667951096, 0, 1.23558399413, 0, -1.21137792785, 0, 1.18450348684, 0, -1.15541906265, 0, 1.1245947143, 0, -1.09250750617, 0, 1.05963677844, 0, -1.02645939621, 0, 0.993445023832, 0, -0.96105147071, 0, 0.929720154741, 0, -0.899871727579, 0, 0.871901905518, 0, -0.846177546948, 0, 0.823033015423, 0, -0.80276686443, 0, 0.785638876839, 0, -0.771867488518, 0, 0.761627621767, 0, -0.755048950196, 0, 0.752214612349}; - -float *symbol_samples[2][2][2] = {{{symbol_000, symbol_001}, {symbol_010, symbol_011}}, {{symbol_100, symbol_101}, {symbol_110, symbol_111}}}; diff --git a/src/waveforms.h b/src/waveforms.h index d368b99..80b05e0 100644 --- a/src/waveforms.h +++ b/src/waveforms.h @@ -4,4 +4,5 @@ Released under the GNU GPL v3 license. */ -extern float *symbol_samples[2][2][2]; +extern float waveform_identical[]; +extern float waveform_different[];