Skip to content

Read an audio file or generate sound, compute it, and write to file.

License

Notifications You must be signed in to change notification settings

macrat/PyGenSound

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyGenSound

Read an audio file or generate sound, compute it, and write to file.

ファイルから音を読み込んだり周波数から生成して、重ねたり繋げたりして、ファイルに保存するやつ。

Build Status Code Climate Coverage Status

install

$ git clone http://github.com/macrat/PyGenSound
$ cd PyGenSound
$ pip3 install .

uninstall

$ pip3 uninstall PyGenSound

example

This is code for generating time signal sound of NHK.

NHKの時報を作るやつ。

import gensound


wait = gensound.Sound.silence(duration=0.9)  # Generate 0.9 seconds silence
a = gensound.Sound.from_sinwave(440, duration=0.1, volume=1.0).concat(wait)  # Generate 440Hz sin wave 0.1 seconds, and 0.9 seconds silence
b = gensound.Sound.from_sinwave(880, duration=1.0, volume=1.0)  # Generate 880Hz sin wave 1 seconds

time_signal = gensound.concat(a, a, a, b)  # Concatenate those

time_signal.write('test.wav')  # Save to test.wav
time_signal.play()  # Play sound

commandline interface

This example is generating time signal sound of NHK by command-line and play it.

コマンドラインからNHKの時報を作って鳴らすやつ。

$ gensound silence -d 0.9 -o silence.wav
$ gensound sine 440 -d 0.1 | gensound fadeout -o 440.wav
$ gensound sine 880 -d 2.0 | gensound fadeout -o 880.wav
$ gensound concat 440.wav silence.wav | gensound concat - - - 880.wav | mplayer -cache 1024 -

requirements

  • python3.5+
  • numpy
  • scipy
  • PySoundFile
  • PyAudio

License

MIT License

About

Read an audio file or generate sound, compute it, and write to file.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages