mcpField
S
sound-effects-generator

sound-effects-generator

github.com/dkyazzentwatwaクリエイティブ・メディア12476 回インストール29 週間前に更新
リポジトリ

sound-effects-generator について

sound-effects-generator は、テスト音やアラート、音声キューを作るための Python ライブラリとコマンドラインツールです。トーン、ノイズ、DTMF 信号やシーケンスを生成し、基本的な効果を加えて WAV または MP3 に書き出せます。

主な機能

  1. 01正弦波、矩形波、のこぎり波、三角波のトーン
  2. 02ホワイト、ピンク、ブラウンノイズ
  3. 03DTMF トーンとシーケンス
  4. 04複数音のビープシーケンス
  5. 05フェードと音量調整
  6. 06WAV と MP3 への書き出し

活用シーン

  1. 01アラートや通知音の作成
  2. 02音声テストトーンや周波数スイープの生成
  3. 03DTMF による電話番号音声の作成

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/dkyazzentwatwa/chatgpt-skills --skill sound-effects-generator

インストール後、Claude Code で/sound-effects-generatorを入力して読み込まれたか確認します。

同梱ファイルscripts/requirements.txtscripts/sfx_generator.py

詳細

効果音ジェネレーター

純音、各種ノイズ、DTMF 信号、シンプルな効果音をプログラムで生成します。テスト、アラート、オーディオキュー、仮の音声に最適です。

クイックスタート

from scripts.sfx_generator import SoundEffectsGenerator

# Generate a tone
sfx = SoundEffectsGenerator()
sfx.tone(440, duration=1000).save("a440.wav")

# Generate white noise
sfx.noise("white", duration=2000).save("whitenoise.wav")

# Create a beep sequence
sfx.beep_sequence([440, 880, 440], durations=200, gap=100).save("alert.wav")

機能

  • トーン:サイン波、矩形波、のこぎり波、三角波
  • ノイズ:ホワイトノイズ、ピンクノイズ、ブラウンノイズ/レッドノイズ
  • DTMF:電話のダイヤルトーン
  • シーケンス:複数のトーンパターン
  • エフェクト:フェード、音量調整
  • エクスポート:WAV、MP3

API リファレンス

初期化
sfx = SoundEffectsGenerator(sample_rate=44100)
トーンの生成
# Pure sine wave
sfx.tone(frequency=440, duration=1000)

# Different waveforms
sfx.tone(440, duration=1000, waveform="sine")      # Default
sfx.tone(440, duration=1000, waveform="square")
sfx.tone(440, duration=1000, waveform="sawtooth")
sfx.tone(440, duration=1000, waveform="triangle")

# With volume (0.0 to 1.0)
sfx.tone(440, duration=1000, volume=0.5)
ノイズの生成
# White noise (equal energy all frequencies)
sfx.noise("white", duration=2000)

# Pink noise (1/f, natural sounding)
sfx.noise("pink", duration=2000)

# Brown noise (1/f^2, deeper)
sfx.noise("brown", duration=2000)

# With volume
sfx.noise("white", duration=1000, volume=0.3)
DTMF トーン
# Single digit
sfx.dtmf("5", duration=200)

# Sequence (phone number)
sfx.dtmf_sequence("5551234", tone_duration=150, gap=50)
ビープ音シーケンス
# Single beep
sfx.beep(frequency=800, duration=200)

# Multiple beeps (same frequency)
sfx.beep_sequence([800, 800, 800], durations=100, gap=100)

# Melody (different frequencies)
sfx.beep_sequence([523, 659, 784, 1047], durations=200, gap=50)

# Varying durations
sfx.beep_sequence(
    frequencies=[440, 880],
    durations=[300, 500],
    gap=100
)
無音
# Generate silence
sfx.silence(duration=1000)
エフェクト
# Fade in/out
sfx.tone(440, 2000).fade_in(200).fade_out(500)

# Volume adjustment
sfx.tone(440, 1000).volume(0.5)
メソッドチェーン
# Combine multiple sounds
sfx.tone(440, 500) \
   .silence(200) \
   .tone(880, 500) \
   .save("two_tones.wav")
保存
# Save to WAV
sfx.save("output.wav")

# Save to MP3 (requires pydub)
sfx.save("output.mp3", bitrate=192)

CLI の使用方法

# Generate tone
python sfx_generator.py --tone 440 --duration 1000 --output tone.wav

# Generate noise
python sfx_generator.py --noise white --duration 2000 --output noise.wav

# Generate DTMF
python sfx_generator.py --dtmf "5551234" --output phone.wav

# Generate beep pattern
python sfx_generator.py --beeps "800,800,800" --duration 100 --gap 100 --output alert.wav

# With waveform
python sfx_generator.py --tone 440 --waveform square --duration 1000 --output square.wav
CLI 引数
引数説明デフォルト
--tone周波数(Hz)-
--noiseノイズの種類(white、pink、brown)-
--dtmfDTMF の数字-
--beepsカンマ区切りの周波数-
--duration長さ(ms)1000
--gap音の間隔(ms)100
--waveformトーンの波形sine
--volume音量(0.0~1.0)0.8
--sample-rateサンプルレート44100
--output出力ファイル必須

例

アラート音
sfx = SoundEffectsGenerator()
sfx.beep_sequence(
    frequencies=[880, 1100, 880, 1100],
    durations=150,
    gap=50
)
sfx.fade_out(100)
sfx.save("alert.wav")
通知チャイム
sfx = SoundEffectsGenerator()

# C-E-G chord progression
notes = [523, 659, 784]  # C5, E5, G5
for freq in notes:
    sfx.tone(freq, 200)
    sfx.silence(50)

sfx.fade_out(200)
sfx.save("chime.wav")
ホワイトノイズのバックグラウンド音
sfx = SoundEffectsGenerator()
sfx.noise("brown", duration=60000)  # 1 minute
sfx.volume(0.3)  # Quiet
sfx.fade_in(2000)
sfx.fade_out(2000)
sfx.save("background.mp3", bitrate=128)
DTMF の電話番号
sfx = SoundEffectsGenerator()
sfx.dtmf_sequence("18005551234", tone_duration=180, gap=80)
sfx.save("phone_dial.wav")
テストトーンのスイープ
sfx = SoundEffectsGenerator()

# Generate tones from 100Hz to 1000Hz
for freq in range(100, 1001, 100):
    sfx.tone(freq, 200)
    sfx.silence(50)

sfx.save("sweep.wav")

よく使われる周波数

名前周波数(Hz)
A4(コンサートピッチ)440
中央のド(C4)261.63
C5523.25
標準のダイヤルトーン350 + 440
通話中音480 + 620
音符(A4 = 440Hz)
音符周波数
C4261.63
D4293.66
E4329.63
F4349.23
G4392.00
A4440.00
B4493.88
C5523.25

依存関係

numpy>=1.24.0
scipy>=1.10.0
soundfile>=0.12.0

オプション:pydub(MP3 エクスポート用)

制限事項

  • 複雑な合成には対応していません(ADSR エンベロープなし)
  • ステレオパンニングには対応していません
  • 基本的な波形に限定されています
  • MP3 エクスポートには pydub と FFmpeg が必要です

コメント