Shahabks / my-voice-analysis

My-Voice Analysis is a Python library for the analysis of voice (simultaneous speech, high entropy) without the need of a transcription. It breaks utterances and detects syllable boundaries, fundamental frequency contours, and formants.
https://shahabks.github.io/my-voice-analysis/
MIT License
296 stars 91 forks source link

Error: Try again the sound of the audio was not clear #2

Closed federicozanini closed 5 years ago

federicozanini commented 5 years ago

Hi! I'm recording a file audio with this code in order to have a 44khz 16bit .wav file:

`import pyaudio import wave

CHUNK = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 2 RATE = 44000 RECORD_SECONDS = 20 WAVE_OUTPUT_FILENAME = "/Users/federicozanini/Desktop/TesiMello/SpeechLearning/AudioFile/output2.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() `

But when I try to analyze the file with your library with this code:

`import os import sys import io import Functions as myLib mysp=import("my-voice-analysis")

p="output2.wav" # Audio File title c=r"/Users/federicozanini/Desktop/TesiMello/SpeechLearning/AudioFile" # Path to the Audio_File directory (Python 3.7) mysp.myspgend(p,c) mysp.mysptotal(p,c) `

I keep getting the same error: "Try again the sound of the audio was not clear"

can you help me? sorry I'm new to python so I could have made any stupid or very basic error. thanks for your help in advance!

federicozanini commented 5 years ago

ok the library actually just worked! sorry :)

wil2210 commented 5 years ago

Hi @federicozanini could you please detail what have you done to fix this issue please ? I am having the same troubles but I cant figure out how to pass through

federicozanini commented 5 years ago

Hi, I don't really remember how I did it because it was 2 months ago but I have two ideas: 1) I was using python 2.7 and I was probably doing the 'import' in the wrong way, do it in this way instead: mysp=import("my-voice-analysis")

2) the second option was probably a problem due to the channels selected in my audio recorder script: try to set "CHANNELS = 1". if this don't work, set it back to 2.

Sorry if I'm not very helpful but let me know :)