cduck / morse

Morse code audio generation tool
MIT License
20 stars 9 forks source link

A lot of white background noise #2

Open NaNasuuAkiaa opened 2 years ago

NaNasuuAkiaa commented 2 years ago

Hello, when i try generating a file, either wav or mp3, when i reproduce it, it is filled with super loud white noise. Any idea of what is going on?

cduck commented 2 years ago

Thanks for the report. Can you give a few more details to help determine the issue?

In case this is an interaction with another package, could you also create a fresh Python virtual environment, install only necessary packages, then try again?

NaNasuuAkiaa commented 2 years ago

Command im running: echo "Morse code message." |py play.py -f 750 --wpm 10 -o output.wav OS: win 10 home 20h2 Python version: 3.9.7 Packages:


aiohttp==3.7.4.post0
aiohttp-socks==0.7.1
altgraph==0.17.2
appdirs==1.4.4
astunparse==1.6.3
async-timeout==3.0.1
attrs==21.2.0
auto-py-to-exe==2.10.1
beautifulsoup4==4.10.0
Bext==0.0.6
bottle==0.12.19
bottle-websocket==0.2.9
cachetools==4.2.4
cattrs==1.8.0
certifi==2021.5.30
cffi==1.14.6
chardet==4.0.0
charset-normalizer==2.0.6
click==8.0.2
CoinMarketCapAPI==0.5
colorama==0.4.4
commonmark==0.9.1
comtypes==1.1.10
configparser==5.0.2
cryptocompare==0.7.5
DateTime==4.3
discord==1.7.3
discord-webhook==0.14.0
discord.py==1.7.3
Eel==0.12.4
flatbuffers==2.0
future==0.18.2
gast==0.4.0
gevent==21.8.0
gevent-websocket==0.10.1
google-auth==2.3.3
google-auth-oauthlib==0.4.6
google-pasta==0.2.0
GPUtil==1.4.0
greenlet==1.1.2
grpcio==1.41.1
gTTS==2.2.3
h5py==3.5.0
idna==3.2
keras==2.7.0
Keras-Preprocessing==1.1.2
keyboard==0.13.5
libclang==12.0.0
mailer==0.8.1
Markdown==3.3.4
maxminddb==2.2.0
MouseInfo==0.1.3
mss==6.1.0
multidict==5.1.0
numpy==1.21.2
oauthlib==3.1.1
opencv-python==4.5.4.60
opt-einsum==3.3.0
pandas==1.3.3
Pastebin==1.1.2
pefile==2021.9.3
Pillow==8.3.2
plyer==2.0.0
protobuf==3.19.1
proxyscrape==0.3.0
psutil==5.9.0
py-cpuinfo==8.0.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
PyAutoGUI==0.9.53
pycparser==2.20
PyDirectInput==1.0.4
pyfiglet==0.8.post1
pygame==2.0.1
PyGetWindow==0.0.9
Pygments==2.11.2
pyinstaller==4.5.1
pyinstaller-hooks-contrib==2021.3
PyMsgBox==1.0.9
pynput==1.7.3
pyperclip==1.8.2
pypiwin32==223
PyRect==0.1.4
PyScreeze==0.1.28
PySocks==1.7.1
python-coinmarketcap==0.3
python-dateutil==2.8.2
python-socks==2.0.3
python-vlc==3.0.12118
pytweening==1.0.4
pytz==2021.3
pywin32==301
pywin32-ctypes==0.2.0
pywinauto==0.6.8
quick-mailer==0.1.0
ratelimit==2.2.1
requests==2.26.0
requests-cache==0.8.1
requests-futures==1.0.0
requests-oauthlib==1.3.0
rich==11.1.0
rsa==4.7.2
scipy==1.8.0
selenium==3.141.0
six==1.16.0
sounddevice==0.4.4
soupsieve==2.2.1
stem==1.8.0
tabulate==0.8.9
tensorboard==2.7.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.0
tensorflow==2.7.0
tensorflow-estimator==2.7.0
tensorflow-io-gcs-filesystem==0.22.0
termcolor==1.1.0
torrequest==0.1.0
typing-extensions==3.10.0.2
uptime==3.0.1
url-normalize==1.4.3
urllib3==1.26.6
vboxapi==1.0
Werkzeug==2.0.2
whichcraft==0.6.1
wikipedia==1.4.0
wrapt==1.13.3
yarl==1.6.3
zope.event==4.5.0
zope.interface==5.4.0```
cduck commented 2 years ago

Thanks. I don't have Windows so I can't confirm but my guess is this is a Windows+scipy issue. I assume when you don't specify an output file, it plays correctly? The noise only occurs in the output.wav file?

To confirm my guess, please try running the code example at the end of this page:

import numpy as np
from scipy.io.wavfile import write
samplerate = 8000
fs = 440
t = np.linspace(0., 1., samplerate)
amplitude = np.iinfo(np.int16).max
data = amplitude * np.sin(2. * np.pi * fs * t)
write("example.wav", samplerate, data.astype(np.int16))