예제 #1
0
 def load(self, fileName=None):
     if fileName is None:
         print("Please, insert a file name: ")
         fileName = input()
     if fileName == '-exit':
         self.exit()
     self.file = fileName
     self.audio = pytta.read_wav(self.file)
     self.streaming = pytta.generate.stream('O', excitation=self.audio)
     print("Opened file", self.file)
     print("Available commands are:\n", "-play;\n", "-pause;\n", "-stop.")
     return
예제 #2
0
파일: waterfall.py 프로젝트: Chum4k3r/PyTTa
"""
@authors: rinaldipp
"""

import pytta
import os

if __name__ == "__main__":

    path = 'RIS' + os.sep
    name = 'scene9_RIR_LS1_MP1_Dodecahedron'
    wav = '.wav'

    myIRsignal = pytta.read_wav(path + name + wav)

    figs = pytta.plot_waterfall(myIRsignal,
                                fmin=100,
                                fmax=4000,
                                tmax=2,
                                delta=60,
                                step=2**11,
                                n=2**11,
                                freq_tick=None,
                                time_tick=None,
                                mag_tick=None,
                                show=True,
                                fill_value='pmin',
                                fill_below=True,
                                figRatio=[1, 1, 1],
                                camera=[2, 1, 2],
                                saveFig='example')
예제 #3
0
#%% Cria objeto para stream de dados com o LabJack U3 com o sensor de temperatura e umidade EI1050

tempHumid = lju3ei1050.main()
#tempHumid = None # Para testes com LabJack offline

#%% Carrega sinais de excitação
excitationSignals = {}
excitationSignals['varredura'] = pytta.generate.sweep(freqMin=20, # Geração do sweep (também pode ser carregado projeto prévio)
                            freqMax=20000,
                            fftDegree=18,
                            startMargin=0.2,
                            stopMargin=1.4,
                            method='logarithmic',
                            windowing='hann')
excitationSignals['musica'] = pytta.read_wav('Piano Over the rainbow Mic2 SHORT_edited.wav') # Carregando sinal de música
excitationSignals['fala'] = pytta.read_wav('Voice Sabine Short_edited.WAV') # Carregando sinal de fala

#%% Cria novo Setup de Medição
SM = m.newMeasurement(name = 'med-sala_conselhos', # Nome da medição
#                      Sintaxe : device = [<entrada>,<saida>] ou <entrada/saida>
#                      Utilize pytta.list_devices() para listar os dispositivos do seu computador. 
#                     device = [0,1], # PC laza Seleciona dispositivo listado em pytta.list_devices()
#                     device = 4, # Saffire Pro 40 laza Seleciona dispositivo listado em pytta.list_devices()
                     device = [1,3], # PC Leo Seleciona dispositivo listado em pytta.list_devices()
#                     device = 0, # Firebox laza Seleciona dispositivo listado em pytta.list_devices()
#                     device = [1,4], # PC laza Seleciona dispositivo listado em pytta.list_devices()
                     excitationSignals=excitationSignals, # Sinais de excitação
                     samplingRate = 44100, # [Hz]
                     freqMin = 20, # [Hz]
                     freqMax = 20000, # [Hz]
예제 #4
0
    stopMargin=3,
    method='logarithmic',
    windowing='hann',
    samplingRate=44100)
excitationSignals['varredura17'] = pytta.generate.sweep(
    # Geração do sweep (também pode ser carregado projeto prévio)
    freqMin=20,
    freqMax=20000,
    fftDegree=17,
    startMargin=0.05,
    stopMargin=1,
    method='logarithmic',
    windowing='hann',
    samplingRate=44100)
# Carregando sinal de música
excitationSignals['musica'] = pytta.read_wav(
    'audio/Piano Over the rainbow Mic2 SHORT_edited.wav')
# Carregando sinal de fala
excitationSignals['fala'] = pytta.read_wav(
    'audio/Voice Sabine Short_edited.WAV')

# %% Carrega sensibilidade do microfone para compensação na cadeia de entrada
loadtxt = np.loadtxt(fname='14900_no_header.txt')
mSensFreq = loadtxt[:, 0]
mSensdBMag = loadtxt[:, 1]
# plt.semilogx(mSensFreq, mSensdBMag)

# %% Carrega resposta da fonte para compensação na cadeia de saida
matLoad = io.loadmat('hcorrDodecCTISM2m_Brum.mat')
ir = pytta.SignalObj(matLoad['hcorrDodecCTISM2m'], 'time', 44100)
sSensFreq = ir.freqVector
sourceSens = 1 / np.abs(ir.freqSignal)[:, 0]
예제 #5
0
#!/usr/bin/env python3
# -*-coding = utf-8 -*-

# TO DO: create unit test from this and move to tests folder at bib root

# %%
import pytta
import matplotlib.pyplot as plt
import numpy as np
from timeit import timeit

# %% Loading IR
path = pytta.__path__[0] + '/examples/RIS/'
file = 'scene9_RIR_LS1_MP1_Dodecahedron.wav'
myarr = pytta.read_wav(path + file)

# %% Analyse
an = pytta.rooms.analyse(myarr,
                         'RT',
                         20,
                         nthOct=3,
                         minFreq=60,
                         maxFreq=20000,
                         plotLundebyResults=False,
                         IREndManualCut=2)
# %%
an.plot(title='Tempo de reverberação', yLabel='TR [s]', xLabel='Bandas [Hz]')
#an.plot(title='Tempo de reverberação')

# %% Ita result
an_ita = pytta.Analysis(anType='RT',
예제 #6
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Room Parameters.

Demonstration of how to use the new RoomParameters class.

@author: João Vitor Gutkoski Paes.
"""
import pytta

# myMonoIR = pytta.load("SOME_SAVED_SIGNALOBJ_WITH_IR.hdf5")
myMonoIR = pytta.read_wav("RIS/scene9_RIR_LS1_MP1_Dodecahedron.wav")

room = pytta.RoomAnalysis(myMonoIR, nthOct=3, minFreq=50., maxFreq=16e3)

print()
print("Parameters from impulse response are:")
print("\n", room.parameters, "\n")
print("Access directly by RoomAnalysis().PNAME")
print("Or view it in a bar plot by RoomAnalysis().plot_PNAME")
print("where PNAME is the name of the desired parameter, as shown above.")
print()
print(f"{room.T20=}")

fig = room.plot_EDT()
fig.show()