定制 jblond/morse 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jblond/morse

最新稳定版本:1.2.3

Composer 安装命令:

composer require jblond/morse

包简介

PHP morse code and wav(e) sound file generation

README 文档

README

Supported character sets

  • Arabic, Cyrillic, Greek (needs conversion to upper case letters (function included)), Hebrew, Japanese Korean, Latin, Persian, and Thai.

composer require jblond/morse

Example UI: https://github.com/JBlond/maas Morse as a Service

Examples

<?php

use jblond\morse\Morse;
use jblond\morse\Wave;

require './vendor/autoload.php';

$morse = new Morse();
$morseBinary = $morse->stringToMorse('SOS');
$morse = $morse->dotDash($morseBinary);
echo $morse;
$wave = new Wave();
file_put_contents('sos.wav', $wave->generate('SOS'));

Non latin example

<?php

use jblond\morse\Morse;

require './vendor/autoload.php';

$morse = new Morse();
$morse->setLetters('Cyrillic');
$morse->stringToMorse('Запомнить');

Morse API

  • setLetters Change the origin character set (letters / language)
    • available: Arabic, Cyrillic, Greek, Hebrew, Japanese, Korean (SKATS), Latin (default), Persian, and Thai.
  • getLetters Get an array of the current selected character set
  • getCharacter Convert a single character into morse binary code. An invalid character will return a #.
  • stringToMorse Convert a string into binary morse code.
  • dotDash Convert binary morse code into dot and dash / dit and dah.

Greek characters

Since the PHP strtoupper function fails for Greek, an extra function to do so has been added.

<?php
use jblond\morse\Morse;
use jblond\morse\CharacterSet\Greek;

require './vendor/autoload.php';

$morse = new Morse();
$morse->setLetters('Greek');
$morse->stringToMorse((new Greek())->stringToUpper('Τέλος εκπομπής'));

Wav(e) API

  • setCwSpeed set words per minute (cw speed). Default is 25.
  • setSampleRate default is 11050. An audio CD would be 44100 aka 44.1 kHz (16 bit).
  • setFrequency set the tone height. Default is 700 (cw tone).
  • generate get the audio as binary.

License: MIT

统计信息

  • 总下载量: 22
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-07