Skip to main content

JJY signal emulator using python and pyaudio

Project description

pyjjy

電波時計の時刻合わせに使用される標準電波JJYをPythonとPyAudioで再現するスクリプトです。 shogo82148氏のweb-jjyと同様に、一般的な機器で出力可能な13.333kHzを出力し、第3高調波がJJYおおたかどや山標準電波送信所の送信波周波数である40kHzとなることを利用しています。 PortAudioとPyAudioに依存します。 動作させるPCの時刻を出力するため、標準時からずれる場合があります。

インストール

PyIPから最新版をインストール可能です。

pip install pyjjy --upgrade

使い方

10分間のJJY信号を送信する実行方法の例を以下に示します。

$ python -m pyjjy -d 600

Python内からの呼び出しも可能です。

>>> from pyjjy import JJYsignal
>>> jj = JJYsignal(duration=600)
>>> jj.play()

Mac環境では、例えば次のような運用により自動時刻合わせも可能です。

  1. 音声出力を"外部ヘッドフォン"に切り替えた後にスリープさせる(Automatorでapp化を推奨)
  2. 自動受信時刻前にスリープを解除するようスケジュール設定する
  3. cronやlaunchdを用いてJJYシグナルを出すスクリプトを自動実行し、"外部ヘッドフォン"からJJY信号を出力する
  4. cronやlaunchdを用いてスリープに入るAppleScriptを自動実行する

動作環境

以下の環境で動作と受信を確認しています。

  • Mac mini (M1, 2020)
  • macOS Monterey 12.0.1
  • portaudio 19.7.0 (installed via homebrew)
  • Python 3.7.6 (installed via miniconda)
  • PyAudio 0.2.11 (installed via conda)
  • アンテナ (AMループアンテナを鉄釘に巻き直したバーアンテナ)
  • 電波時計 (CITIZEN AT8181-63E)

また、次の環境でも信号出力を確認しています。

  • MacBook Air (Mid 2013)
  • macOS Catalina 10.15.5
  • Python 3.9.7 (installed via miniconda)
  • PyAudio 0.2.11 (installed via pip)

Windows環境でも信号出力を確認しています。

  • Windows 11 Pro 21H2
  • Python 3.8.12 (installed via miniconda)
  • PyAudio 0.2.11 (installed via conda)

免責事項

利用の結果生じた損害について、一切責任を負いません。

ライセンス

MITライセンスです。LICENSEを参照ください。

Project details


Release history Release notifications | RSS feed

This version

0.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyjjy-0.2.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyjjy-0.2-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file pyjjy-0.2.tar.gz.

File metadata

  • Download URL: pyjjy-0.2.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for pyjjy-0.2.tar.gz
Algorithm Hash digest
SHA256 254d080aae3debd5e568bf528b844e5fe5cef0a48ae5821833e4dcdb7c5a2805
MD5 10a4b7b0b445bcc31fae0a3f071a3a2e
BLAKE2b-256 8e39c07157787f7c20e91132f474274edc0fc8159177316b2905dab04eef59f9

See more details on using hashes here.

File details

Details for the file pyjjy-0.2-py3-none-any.whl.

File metadata

  • Download URL: pyjjy-0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7

File hashes

Hashes for pyjjy-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 11860bde2ccb9e3b905969480c3bcfdfcc2b9f94ca9eb5ab4375bc4e947d6c90
MD5 dcb8c6cc5fa092f7f3af5ce5a4ef479b
BLAKE2b-256 8b131a7510b34675b1cc1c4320ddb6436fb8531aed47d0f2a75bb486bd0ede5b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page