本文整理汇总了Python中smsWavplayer.wavread函数的典型用法代码示例。如果您正苦于以下问题:Python wavread函数的具体用法?Python wavread怎么用?Python wavread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wavread函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: defaultTest
def defaultTest():
str_time = time.time()
(fs, x) = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../sounds/oboe-A4.wav'))
w = np.hamming(511)
N = 512
H = 256
y = stft(x, fs, w, N, H)
print "time taken for computation " + str(time.time()-str_time)
开发者ID:Polanko2k,项目名称:sms-tools,代码行数:8,代码来源:stft.py
示例2: defaultTest
def defaultTest():
str_time = time.time()
(fs, x) = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../sounds/mridangam.wav'))
w = np.blackman(901)
N = 1024
t = -70
y, ys, yr = sprModel(x, fs, w, N, t)
print "time taken for computation " + str(time.time()-str_time)
开发者ID:Polanko2k,项目名称:sms-tools,代码行数:8,代码来源:sprModel.py
示例3: defaultTest
def defaultTest():
str_time = time.time()
(fs, x) = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../sounds/ocean.wav'))
w = np.hamming(512)
N = 512
H = 256
stocf = 0.5
y = stochasticModel(x, w, N, H, stocf)
print "time taken for computation " + str(time.time()-str_time)
开发者ID:Polanko2k,项目名称:sms-tools,代码行数:9,代码来源:stochasticModel.py
示例4: defaultTest
def defaultTest():
str_time = time.time()
(fs, x) = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../sounds/mridangam.wav'))
w = np.blackman(601)
N = 2048
t = -70
stocf = 0.2
y, ys, yst = spsModel(x, fs, w, N, t, stocf)
print "time taken for computation " + str(time.time()-str_time)
开发者ID:Polanko2k,项目名称:sms-tools,代码行数:9,代码来源:spsModel.py
示例5: defaultTest
def defaultTest():
str_time = time.time()
(fs, x) = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../sounds/oboe.wav'))
w = np.hamming(511)
N = 512
t = -60
fig = plt.figure()
y = sineModel(x, fs, w, N, t)
print "time taken for computation " + str(time.time()-str_time)
开发者ID:AdriaMallol,项目名称:sms-tools,代码行数:10,代码来源:sineModel.py
示例6: defaultTest
def defaultTest():
str_time = time.time()
(fs, x) = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../sounds/oboe-A4.wav'))
w = np.hamming(801)
N = 1024
H = 200
t = -70
y = stftPeaksModel(x, fs, w, N, H, t)
print "time taken for computation " + str(time.time()-str_time)
开发者ID:Polanko2k,项目名称:sms-tools,代码行数:11,代码来源:stftPeaksModel.py
示例7: defaultTest
def defaultTest():
str_time = time.time()
(fs, x) = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../sounds/sax-phrase-short.wav'))
w = np.blackman(701)
N = 1024
t = -80
nH = 30
minf0 = 400
maxf0 = 700
f0et = 5
maxhd = 0.2
y = harmonicModel(x, fs, w, N, t, nH, minf0, maxf0, f0et, maxhd)
print "time taken for computation " + str(time.time()-str_time)
开发者ID:Polanko2k,项目名称:sms-tools,代码行数:13,代码来源:harmonicModel.py
示例8: defaultTest
def defaultTest():
str_time = time.time()
(fs, x) = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../sounds/speech-female.wav'))
w = np.hamming(601)
N = 1024
t = -80
nH = 30
minf0 = 200
maxf0 = 500
f0et = 2
maxhd = 0.2
y = harmonicModel(x, fs, w, N, t, nH, minf0, maxf0, f0et, maxhd)
print "time taken for computation " + str(time.time()-str_time)
开发者ID:AdriaMallol,项目名称:sms-tools,代码行数:13,代码来源:harmonicModel.py
示例9: defaultTest
def defaultTest():
str_time = time.time()
(fs, x) = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../sounds/speech-female.wav'))
w = np.hamming(801)
N = 1024
t = -120
maxnS = 30
stocf = 0.5
y, yh, ys = sps(x, fs, w, N, t, maxnS, stocf)
print "time taken for computation " + str(time.time()-str_time)
开发者ID:AdriaMallol,项目名称:sms-tools,代码行数:13,代码来源:sps.py
示例10: defaultTest
def defaultTest():
str_time = time.time()
fs, x = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../sounds/soprano-E4.wav'))
fs, x2 = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../sounds/violin-B3.wav'))
w = np.hamming(1025)
N = 2048
t = -150
nH = 200
minf0 = 100
maxf0 = 400
f0et = 5
maxhd = 0.2
stocf = 0.1
dur = x.size/fs
f0intp = np.array([[ 0, dur], [0, 1]])
htintp = np.array([[ 0, dur], [0, 1]])
rintp = np.array([[ 0, dur], [0, 1]])
y, yh, ys = hpsMorph(x, x2, fs, w, N, t, nH, minf0, maxf0, f0et, maxhd, stocf, f0intp, htintp, rintp)
print "time taken for computation " + str(time.time()-str_time)
开发者ID:Polanko2k,项目名称:sms-tools,代码行数:23,代码来源:hpsMorph.py
示例11: defaultTest
def defaultTest():
str_time = time.time()
(fs, x) = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../sounds/sax-phrase-short.wav'))
w = np.blackman(801)
N = 1024
t = -90
nH = 50
minf0 = 350
maxf0 = 700
f0et = 10
maxhd = 0.2
stocf = 0.2
y, yh, yst = hpsModel(x, fs, w, N, t, nH, minf0, maxf0, f0et, maxhd, stocf)
print "time taken for computation " + str(time.time()-str_time)
开发者ID:Polanko2k,项目名称:sms-tools,代码行数:14,代码来源:hpsModel.py
示例12: defaultTest
def defaultTest():
str_time = time.time()
(fs, x) = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../sounds/speech-female.wav"))
w = np.blackman(801)
N = 1024
t = -90
nH = 50
minf0 = 350
maxf0 = 700
f0et = 10
maxhd = 0.2
stocf = 0.5
maxnpeaksTwm = 5
y, yh, ys = hps(x, fs, w, N, t, nH, minf0, maxf0, f0et, maxhd, stocf, maxnpeaksTwm)
print "time taken for computation " + str(time.time() - str_time)
开发者ID:platmusf,项目名称:sms-tools,代码行数:15,代码来源:hps.py
示例13: defaultTest
def defaultTest():
str_time = time.time()
(fs, x) = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../sounds/oboe-A4.wav'))
w = np.blackman(801)
N = 1024
t = -80
nH = 30
minf0 = 400
maxf0 = 600
f0et = 5
maxhd = 0.2
stocf = 0.5
y, yh, ys = hpsModel(x, fs, w, N, t, nH, minf0, maxf0, f0et, maxhd, stocf)
print "time taken for computation " + str(time.time()-str_time)
开发者ID:Polanko2k,项目名称:sms-tools,代码行数:17,代码来源:hpsModelPlot.py
示例14: defaultTest
def defaultTest():
str_time = time.time()
(fs, x) = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../sounds/speech-female.wav'))
w = np.hamming(1025)
N = 1024
t = -120
nH = 30
minf0 = 200
maxf0 = 500
f0et = 5
maxhd = 0.2
stocf = 0.5
y, yh, ys = hpsModel(x, fs, w, N, t, nH, minf0, maxf0, f0et, maxhd, stocf)
print "time taken for computation " + str(time.time()-str_time)
开发者ID:AdriaMallol,项目名称:sms-tools,代码行数:17,代码来源:hpsModel.py
示例15: defaultTest
def defaultTest():
str_time = time.time()
#(fs, x) = wp.wavread('../../sounds/oboe.wav')
(fs, x) = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../sounds/oboe.wav'))
w = np.hamming(1025)
N = 1024
t = -120
nH = 30
minf0 = 200
maxf0 = 500
f0et = 2
maxhd = 0.2
y, yh, yr = hprModel(x, fs, w, N, t, nH, minf0, maxf0, f0et, maxhd)
print "time taken for computation " + str(time.time()-str_time)
开发者ID:AdriaMallol,项目名称:sms-tools,代码行数:17,代码来源:hprModel.py
示例16: hpsModel
N = 1024
t = -80
nH = 30
minf0 = 400
maxf0 = 600
f0et = 5
maxhd = 0.2
stocf = 0.5
y, yh, ys = hpsModel(x, fs, w, N, t, nH, minf0, maxf0, f0et, maxhd, stocf)
print "time taken for computation " + str(time.time()-str_time)
if __name__ == '__main__':
(fs, x) = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../sounds/oboe-A4.wav'))
w = np.blackman(801)
N = 1024
t = -80
nH = 30
minf0 = 400
maxf0 = 600
f0et = 5
maxhd = 0.2
stocf = 0.5
y, yh, ys = hpsModel(x[0:44100], fs, w, N, t, nH, minf0, maxf0, f0et, maxhd, stocf)
wp.play(y, fs)
wp.play(yh, fs)
wp.play(ys, fs)
开发者ID:Polanko2k,项目名称:sms-tools,代码行数:31,代码来源:hpsModelPlot.py
示例17: harmonicModelPlot
final_peaks = hloc[ind]
parray = np.zeros([final_peaks.size,2])
parray[:,0]=pin/float(fs)
parray[:,1]=final_peaks*float(fs)/N
specPeaks = np.append(specPeaks, parray,axis=0)
pin += H
frmNum += 1
frmTime = np.array(frmTime) # The time at the centre of the frames
plt.hold(True)
plt.pcolormesh(frmTime,binFreq,YSpec)
plt.scatter(specPeaks[:,0]+(0.5*H/float(fs)), specPeaks[:,1], s=10, marker='x')
plt.xlabel('Time(s)')
plt.ylabel('Frequency(Hz)')
plt.autoscale(tight=True)
plt.show()
return YSpec
# example call of sineModelPlot function
if __name__ == '__main__':
(fs, x) = wp.wavread('../../../../sounds/sax-phrase-short.wav')
w = np.blackman(901)
N = 2048
t = -70
nH = 10
minf0 = 300
maxf0 = 650
f0et = 4
maxhd = 0.2
maxFreq = fs/15.0
YSpec = harmonicModelPlot(x,fs,w,N,t,nH, minf0, maxf0, f0et, maxhd, maxFreq)
开发者ID:Polanko2k,项目名称:sms-tools,代码行数:30,代码来源:harmonics-on-spectrogram.py
示例18:
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hamming, triang, blackmanharris
from scipy.fftpack import fft, ifft, fftshift
import math
import sys, os, functools, time
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../code/spectralModels/'))
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../code/basicFunctions/'))
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../code/spectralModelsPlotting/'))
import hprModel, hpsModel, hprModelSpectrogramPlot
import smsWavplayer as wp
if __name__ == '__main__':
(fs, x) = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../sounds/speech-male.wav'))
w = np.blackman(1001)
N = 1024
t = -90
nH = 100
minf0 = 60
maxf0 = 180
f0et = 3
maxhd = 0.2
maxFreq = 1000
start = 0*fs
end = x.size
maxnpeaksTwm = 5
stocf = .2
#y, yh, yr = hprModel.hprModel(x[start:end], fs, w, N, t, nH, minf0, maxf0, f0et, maxhd, maxnpeaksTwm)
hprModelSpectrogramPlot.hprModelPlot(x[start:end], fs, w, N, t, nH, minf0, maxf0, f0et, maxhd, maxFreq, maxnpeaksTwm)
开发者ID:Polanko2k,项目名称:sms-tools,代码行数:31,代码来源:speech-male.py
示例19: ifft
iploc, ipmag, ipphase = PP.peakInterp(mX, pX, ploc) # refine peak values by interpolation
#-----synthesis-----
plocs = iploc*Ns/N; # adapt peak locations to size of synthesis FFT
Y = GS.genSpecSines(plocs, ipmag, ipphase, Ns) # generate sines in the spectrum
fftbuffer = np.real( ifft(Y) ) # compute inverse FFT
yw[:hNs-1] = fftbuffer[hNs+1:] # undo zero-phase window
yw[hNs-1:] = fftbuffer[:hNs+1]
y[pin-hNs:pin+hNs] += sw*yw # overlap-add and apply a synthesis window
pin += H # advance sound pointer
return y
def defaultTest():
str_time = time.time()
(fs, x) = wp.wavread(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../sounds/oboe-A4.wav'))
w = np.hamming(511)
N = 1024
t = -60
y = sineModel(x, fs, w, N, t)
print "time taken for computation " + str(time.time()-str_time)
# example call of sineModel function
if __name__ == '__main__':
(fs, x) = wp.wavread('../../sounds/oboe-A4.wav')
w = np.hamming(511)
N = 1024
t = -60
y = sineModel(x, fs, w, N, t)
wp.play(y, fs)
开发者ID:Polanko2k,项目名称:sms-tools,代码行数:31,代码来源:sineModel.py
示例20: ifft
fftbuffer = np.real( ifft(Y) ) # inverse FFT
y[pin-hM:pin+hM] += H*ws*fftbuffer # overlap-add
pin += H
frmNum += 1
frmTime = np.array(frmTime) # The time at the centre of the frames
plt.figure(1)
plt.subplot(2,1,1)
plt.pcolormesh(frmTime,binFreq,XSpec)
plt.autoscale(tight=True)
plt.title('X spectrogram')
plt.subplot(2,1,2)
plt.pcolormesh(frmTime,binFreq,YSpec)
plt.autoscale(tight=True)
plt.title('X stochastic approx. spectrogram')
plt.show()
return y
# example call of stochasticModel function
if __name__ == '__main__':
(fs, x) = wp.wavread('../../sounds/ocean.wav')
w = np.hamming(1024)
N = 1024
H = 512
stocf = 0.3
maxFreq = fs
y = stochasticModelSpectrogramPlot(x, w, N, H, stocf, maxFreq)
wp.play(y, fs)
开发者ID:Polanko2k,项目名称:sms-tools,代码行数:30,代码来源:stochasticModelSpectrogranPlot.py
注:本文中的smsWavplayer.wavread函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论