Skip to content

Commit

Permalink
first bad compile (very large app)
Browse files Browse the repository at this point in the history
  • Loading branch information
PasaOpasen committed May 22, 2020
1 parent b27cad4 commit 38ec8a6
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\FirstTry\app\
3 changes: 2 additions & 1 deletion FirstTry/text_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ def do_log_with_recognition(stop_word = '+', lang_list = ['en','ru','fa'], ends=

#do_log()

do_log_with_recognition()
if __name__ == '__main__':
do_log_with_recognition()


#input('Press any key...')
Expand Down
37 changes: 37 additions & 0 deletions FirstTry/text_logger.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# -*- mode: python ; coding: utf-8 -*-

block_cipher = None


a = Analysis(['text_logger.py'],
pathex=['C:\\Users\\qtckp\\OneDrive\\Рабочий стол\\SpeechLogger\\FirstTry'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='text_logger',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='text_logger')
Binary file added SecondTry/__pycache__/soundcard.cpython-37.pyc
Binary file not shown.
23 changes: 23 additions & 0 deletions SecondTry/detect_available_devices.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
"""
Created on Thu May 21 22:31:00 2020
@author: qtckp
"""


import pyaudio

# detect devices:
p = pyaudio.PyAudio()
host_info = p.get_host_api_info_by_index(0)
device_count = host_info.get('deviceCount')
devices = []

# iterate between devices:
for i in range(0, device_count):
device = p.get_device_info_by_host_api_device_index(0, i)
devices.append(device['name'])

print(devices)

Binary file added SecondTry/output.wav
Binary file not shown.
43 changes: 43 additions & 0 deletions SecondTry/soundcardtest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
"""
Created on Thu May 21 23:15:43 2020
@author: qtckp
https://pypi.org/project/SoundCard/
"""


import soundcard as sc


# get a list of all speakers:
speakers = sc.all_speakers()
# get the current default speaker on your system:
default_speaker = sc.default_speaker()
# get a list of all microphones:
mics = sc.all_microphones()
# get the current default microphone on your system:
default_mic = sc.default_microphone()


import numpy

# record and play back one second of audio:
data = default_mic.record(samplerate=48000, numframes=48000)
default_speaker.play(data/numpy.max(data), samplerate=48000)


# alternatively, get a `Recorder` and `Player` object
# and play or record continuously:
with default_mic.recorder(samplerate=48000) as mic, default_speaker.player(samplerate=48000) as sp:
for _ in range(100):
data = mic.record(numframes=1024)
sp.play(data)






51 changes: 51 additions & 0 deletions SecondTry/speaker1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# -*- coding: utf-8 -*-
"""
Created on Thu May 21 22:13:51 2020
@author: qtckp
https://stackoverflow.com/questions/26573556/record-speakers-output-with-pyaudio
"""


"""PyAudio example: Record a few seconds of audio and save to a WAVE file."""

import pyaudio
import wave

CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 44100
RECORD_SECONDS = 5
WAVE_OUTPUT_FILENAME = "output.wav"

p = pyaudio.PyAudio()

stream = p.open(format=FORMAT,
channels=CHANNELS,
rate=RATE,
input=True,
frames_per_buffer=CHUNK)

print("* recording")

frames = []

for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):
data = stream.read(CHUNK)
frames.append(data)

print("* done recording")

stream.stop_stream()
stream.close()
p.terminate()

wf = wave.open(WAVE_OUTPUT_FILENAME, 'wb')
wf.setnchannels(CHANNELS)
wf.setsampwidth(p.get_sample_size(FORMAT))
wf.setframerate(RATE)
wf.writeframes(b''.join(frames))
wf.close()

0 comments on commit 38ec8a6

Please sign in to comment.