ソフトウェアラジオとC++ そしてFMエアチェックのための信号解析と数値計算にまつわるよもやま話 / Software radio and C++

ソフトウェアラジオとC++ そしてFMエアチェックのための信号解析と数値計算にまつわるよもやま話 / Software radio and C++

A presentation for Kichijoji.pm 20, Freakout Holdings, Inc., Minato-ku, Tokyo, Japan, 22-NOV-2019

Fc3b290038a97f5df6fec7660c357ef4?s=128

Kenji Rikitake

November 22, 2019
Tweet

Transcript

  1. ιϑτ΢ΣΞϥδΦͱC++ 1 ͦͯ͠FMΤΞνΣοΫͷͨΊͷ৴߸ղੳͱ਺஋ܭࢉʹ·ͭΘΔΑ΋΍·࿩ 1 ͜ͷൃදͰͷC++͸C++11Ҏ߱ͷ࢓༷Λલఏͱ͍ͯ͠·͢ɻ Kenji Rikitake / Kichijoji.pm 20

    1
  2. Kenji Rikitake Γ͖͚ͨ ͚Μ͡ ྗ෢ ݈࣍ 22-NOV-2019 kichijoji.pm 20 Freakout

    Holdings, Inc. Minato-ku, Tokyo, Japan @jj1bdx Kenji Rikitake / Kichijoji.pm 20 2
  3. ٕज़࢜ʢ৘ใ޻ֶ෦໳ʣ ྗ෢݈ٕ࣍ज़࢜ࣄ຿ॴ ॴ௕ ৘ใॲཧ҆શ֬อࢧԉ࢜ ϖύϘݚڀॴ ٬һݚڀһ ୈҰڃ཮্ແઢٕज़࢜ ୈҰڃΞϚνϡΞແઢٕ࢜ ΞϚνϡΞແઢྺ 43೥8ϲ݄

    Cྺ 33೥ɺC++11ྺ ͨͬͨͷ3೥ ຊݚڀ΁ͷϖύϘݚڀॴͷ͝ࢧԉʹਂ͘ײँ͠·͢ Kenji Rikitake / Kichijoji.pm 20 3
  4. Kenji Rikitake / Kichijoji.pm 20 4

  5. 1970೥୅ྲྀߦͬͨFMΤΞνΣοΫ FM์ૹ͸Իָͷࢁͩͬͨ ࢲ΋͍ͬͺ͍ϥδΧη2Ͱ࿥Իͯ͠·ͨ͠ ʢ2019೥ͷࠓͰ΋࿥Ի͍ͯ͠Δਓୡ͸͍ͬͺ͍͍·͢ʣ 2 Puding Jahodový, Public domain, h4ps:/

    /commons.wikimedia.org/wiki/File:Sharp_5P-37G_wiki.jpg, via Wikimedia Commons Kenji Rikitake / Kichijoji.pm 20 5
  6. Kenji Rikitake / Kichijoji.pm 20 6

  7. 21ੈلͷϥδΦ͸ιϑτ΢ΣΞ USBσόΠε3Ͱप೾਺ม׵ͱଳҬ੍ݶ ม׵ͨ͠৴߸͸ ιϑτ΢ΣΞ Ͱॲཧ ίʔυ͕ॻ͚Ε͹͋ͳͨ΋ϥδΦ͕࡞ΕΔ! ΤΞνΣοΫͨ͠MP3ϑΝΠϧ΋εϚϗͰฉ͖์୊! 3 Photo of

    Airspy HF+ Dual Port by Kenji Rikitake Kenji Rikitake / Kichijoji.pm 20 7
  8. प೾਺ม׵ͱଳҬ੍ݶͷྫ 82.5MHzΛத৺ͱ͢ΔFM์ૹͷ৔߹ 82.308MHz - 82.692MHz ↓ -0.192MHz - 0.192MHz ±192kHzͷ384kHz෯ͷ৴߸ʹม׵

    Kenji Rikitake / Kichijoji.pm 20 8
  9. ෛͷप೾਺ ࣮਺ͷ৴߸: ࣮ࡍͷՄೳੑ(1): ࣮ࡍͷՄೳੑ(2): ཧ༝: …ͳͷͰ࣮਺ͷ৴߸͚ͩͰ͸৴߸ͷҐ૬ΛಛఆͰ͖·ͤΜ ෛͷप೾਺Λߟ͑ͯ΍Δඞཁ͕͋Γ·͢ Kenji Rikitake /

    Kichijoji.pm 20 9
  10. IQ৴߸: ࣮਺৴߸Λෳૉ਺ʹม׵ ࣮਺ͷ৴߸: ͔ΒҎԼͷ৴߸Λੜ੒͠·͢ ରԠ͢ΔIQ৴߸: ͨͩ͠ ʢͳͥ͜Ε͕ Ͱͳ͍͔ͱ͍͏ͱిؾͰ͸ ͸ిྲྀͷҙຯͳͷͰ͢ʣ ͜ΕΛॻ͖௚͢ͱ

    ʢۃ࠲ඪʣ I৴߸ʢ࣮਺෦ʣ: Q৴߸ʢڏ਺෦ʣ: Kenji Rikitake / Kichijoji.pm 20 10
  11. IQ৴߸ͩͱԿ͕͏Ε͍͔͠ IQ৴߸: std::complex<float> IQsample ͱͯ͠ఆٛ ৴߸ͷৼ෯ ͸ std::abs(IQsample) ৴߸ͷҐ૬ ͸

    std::arg(IQsample) std::arg(z) = std::atan2(z.imag(), z.real()) AM์ૹͳΒ ͦͷ΋ͷɺFM์ૹͳΒ Λඍ෼͢Ε͹෮ௐͰ͖Δ Kenji Rikitake / Kichijoji.pm 20 11
  12. 50೥લͷFM์ૹ։͔࢝࣌Βͷ೰·͍͠໰୊: FMͷ ඼࣭Լ͛Δ Ϛϧνύε Kenji Rikitake / Kichijoji.pm 20 12

  13. Ϛϧνύε ෳ਺ܦ࿏Λ௨Δి೾ͷׯব ৼ෯΍Ґ૬͕มԽͯ͠࿪Ή Ґ૬͕࿪ΉͱFM์ૹͩͱͱͯ΋ෆշͳԻ͕͢Δ ैདྷͷରԠ: Ξϯςφͷࢦ޲ੑͷมԽ͙Β͍͔͠Ͱ͖ͳ͔ͬͨ Kenji Rikitake / Kichijoji.pm

    20 13
  14. ϚϧνύεͰຊདྷͳ͍৴߸͕ݟ͑Δྫ4 4 Lithium57, English transla3on: MichaelBillington, h:ps:/ /commons.wikimedia.org/wiki/ File:Mul3path_propaga3on_diagram_en.svg from

    Wikimedia Commons, public domain Kenji Rikitake / Kichijoji.pm 20 14
  15. ϚϧνύεʹΑΔৼ෯ͷมԽ5 5 Audacity simula.on and graphics by Kenji Rikitake Kenji

    Rikitake / Kichijoji.pm 20 15
  16. Ϛϧνύε͸஗Ԇ೾ͷ৞ΈࠐΈ6 6 I, Cantalamessa, h.ps:/ /commons.wikimedia.org/wiki/File:Mul>path_impulse_response.png from Wikimedia Commons, licensed

    CC BY 2.5 Kenji Rikitake / Kichijoji.pm 20 16
  17. ஗ԆΛϞσϦϯάͯ͠ٯԋࢉ͢Δ FM৴߸: ৼ෯͸ҰఆɺҐ૬/प೾਺ͷΈมԽ ৼ෯ͷมԽ→৴߸͕࿪ΜͰ͍Δ มԽͨ͠ৼ෯Λ໭͢Α͏ͳ৞ΈࠐΈΛड৴ଆ Ͱ΍ͬͯ͠·͑͹Α͍ ʢLeast Mean Square /

    Constant Modulus Algorithmʣ Kenji Rikitake / Kichijoji.pm 20 17
  18. ٯԋࢉͷͨΊͷFIRϑΟϧλ (airspy-fmradion) using IQSample = std::complex<float>; using IQSampleVector = std::vector<IQSample>;

    inline IQSample MultipathFilter::single_process(const IQSample filter_input) { m_state.emplace_back(filter_input); m_state.erase(m_state.begin()); IQSample output = IQSample(0, 0); // for (unsigned int i = 0; i < m_filter_order; i++) { // output += m_state[i] * m_coeff[i]; // } volk_32fc_x2_dot_prod_32fc(&output, m_state.data(), m_coeff.data(), m_filter_order); return output; } Kenji Rikitake / Kichijoji.pm 20 18
  19. Vector Op*mized Library of Kernels (VOLK) x86/ARMͷ৴߸ॲཧͷͨΊͷϥΠϒϥϦ SIMD໋ྩ౳ͰΧϦΧϦͷϋϯυνϡʔχϯά h"p:/ /libvolk.org/

    ʢFM෮ௐઐ༻ͷؔ਺͕͋ͬͨΓ͢Δ͘Β͍ΨνͰ͢ʣ Kenji Rikitake / Kichijoji.pm 20 19
  20. ྗ෢ͷGPLv3࣮૷ = airspy-fmradion h"ps:/ /github.com/jj1bdx/airspy-fmradion ΋ͱ΋ͱ͸So#FMͱ͍͏FMड৴ઐ༻ػ ࠓ͸த೾୹೾AM/FM/SSB/CWͳΜͰ΋͟͝ΕʹਐԽ ͓ͦΒ͘ੈքॳͷOSSͰ࣮૷ͨ͠ϚϧνύεϑΟϧλ macOSͱLinuxͱRaspberry PiͰಈ͖·͢

    ʢGUIෆಘҙͳͷͰʣίϚϯυϥΠϯπʔϧ Ͱ͢ Kenji Rikitake / Kichijoji.pm 20 20
  21. ࠷ޙʹҰ۟ ౙͷ໷ʹ ཕΛ఻͑Δ ి཭૚ ʢౙͷ໷ʹ֤஍Ͱൃੜ͢Δཕ͕ి཭૚Λհͯ͠த೾์ૹ΍3.9MHzʢ75mόϯυʣͷ୹೾์ૹͰ೔ຊதʹ͘·ͳ͘఻ΘΔ༷Λࣔͨ͠Ұ۟ɻͳ͓ɺཕʢΒ͍ʣ͸ຊདྷՆͷقޠɻʣ Kenji Rikitake / Kichijoji.pm 20

    21
  22. ܾҙද໌ 2020೥ʹ౦ژʹ໭ͬͨΒ ؤுͬͯ΋ͬͱՔ͍Ͱ ΑΓΑ͍ݚڀͱٕज़Ͱ ࣾձʹߩݙ͠·͢ Kenji Rikitake / Kichijoji.pm 20

    22
  23. Thank you Ques%ons? Kenji Rikitake / Kichijoji.pm 20 23