我正在尝试确定是否可以使用AVAudioPlayer
该类切换AirPlay支持.
据我所读:
AirPlay是一项技术,可让您的应用程序将音频流传输到Apple TV和第三方AirPlay扬声器和接收器.AirPlay支持内置于
AV Foundation
框架和Core Audio
框架系列中.您使用这些框架播放的任何音频内容都自动符合AirPlay发行的条件.用户选择使用AirPlay播放音频后,系统会自动路由.[ 参考 ]
根据这些信息; 它应该与AVAudioPlayer一起使用,因为它是AVFoundation
框架的一部分; 但我似乎无法找到支持这一假设的任何文件.
我还发现了一些文档说它可以用MPMoviePlayerViewController
:
MPMoviePlayerController
课程中包括使用AirPlay播放视频的支持.此支持允许您在支持AirPlay的硬件(如Apple TV)上播放基于视频的内容.当allowsAirPlay
活动MPMoviePlayerController
对象的属性设置为YES
并且设备在启用AirPlay的硬件的范围内时,电影播放器向用户呈现用于将视频发送到该硬件的控件.[ 参考 ]
似乎这里有一些相互矛盾的信息.有谁知道它是否可能用于AVAudioPlayer
路由到AirPlay或我们被迫使用MPMoviePlayerController
该类?
非常感谢.
既然H2 1.4还没有测试版,我想将旧的1.3.175数据库迁移到1.4.195.
背景资料:
那么,推荐的迁移方式是什么?
其他方面/奖金问题:
我应该启用MVStore还是坚持使用PageStore(优点/缺点)?哪一个提供更好的性能(多线程对我来说并不重要),哪一个更好的稳定性,特别是对抗OutOfMemoryErrors
?
Librosa 和 Scipy 都有这个fft
功能,但是,即使输入相同的信号,它们也会给我不同的频谱图输出。
我正在尝试使用以下代码获取频谱图
import numpy as np # fast vectors and matrices
import matplotlib.pyplot as plt # plotting
from scipy import fft
X = np.sin(np.linspace(0,1e10,5*44100))
fs = 44100 # assumed sample frequency in Hz
window_size = 2048 # 2048-sample fourier windows
stride = 512 # 512 samples between windows
wps = fs/float(512) # ~86 windows/second
Xs = np.empty([int(2*wps),2048])
for i in range(Xs.shape[0]):
Xs[i] = np.abs(fft(X[i*stride:i*stride+window_size]))
fig = plt.figure(figsize=(20,7))
plt.imshow(Xs.T[0:150],aspect='auto')
plt.gca().invert_yaxis()
fig.axes[0].set_xlabel('windows (~86Hz)')
fig.axes[0].set_ylabel('frequency')
plt.show()
Run Code Online (Sandbox Code Playgroud)
然后我得到以下频谱图 …
我目前正在从我的婴儿哭声数据集中提取 mel 特征,wav 文件的采样率为 8kHz、16 位、单声道和大约 7 秒。
sr = 16000 时的梅尔谱图
sr = 44100 时的梅尔谱图
但是正如您所看到的,每当我以不同的采样率提取特征时sr
,梅尔谱图的值都会发生变化。我认为由于wav文件的采样率为8kHz,如果我将采样率设置为16kHz以上,赫兹的值必须相同。
我将 wav 文件的采样率 8kHz 转换为 44.1kHz 并再次提取,但没有任何变化。
这是我的代码:
import librosa.display
import matplotlib.pyplot as plt
import numpy as np
sr = 44100 # or 16000
frame_length = 0.1
frame_stride = 0.01
path = '...'
train = []
j, sr = librosa.load(path + '001.wav', sr, duration = 5.0)
input_nfft = int(round(sr*frame_length))
input_stride = int(round(sr*frame_stride))
mel = librosa.feature.melspectrogram(j, n_mels = 128, n_fft = input_nfft, …
Run Code Online (Sandbox Code Playgroud) 我有一个音频文件,我想每 2 秒分割一次。有没有办法用 librosa 做到这一点?
因此,如果我有一个 60 秒的文件,我会将其分成 30 个两秒的文件。
我正在尝试绘制 16000Hz 16 位 .wav 语音音频的波形图和频谱图。我已成功获得以下图:
但是,频谱图上的时间值不正确。我确信我的采样率在整个程序中是一致的(16000Hz),但我仍然无法获得频谱图的正确时间值。
下面是我的Python脚本:
import matplotlib.pyplot as plt
import librosa
import librosa.display
import numpy as np
y, sr = librosa.load('about_TTS_0792.wav', sr=16000)
print("Current audio sampling rate: ", sr)
print("Audio Duration:", librosa.get_duration(y=y, sr=sr))
D = librosa.stft(y, hop_length=64, win_length=256) # STFT of y
S_db = librosa.amplitude_to_db(np.abs(D), ref=np.max)
fig, ax = plt.subplots(nrows=2)
librosa.display.waveplot(y, sr=sr, ax=ax[0])
img = librosa.display.specshow(S_db, sr=sr, x_axis='s', y_axis='linear',ax=ax[1])
ax[1].set(title='Linear spectrogram')
fig.colorbar(img, ax=ax[1], format="%+2.f dB")
fig.tight_layout()
plt.show()
Run Code Online (Sandbox Code Playgroud)
此代码的输出:
Current audio sampling rate: 16000
Audio Duration: 0.792
Run Code Online (Sandbox Code Playgroud)
我不知道我错过了什么会导致 x …
我正在尝试使用以下代码从具有 13 个 MFCC 的音频文件中提取 MFCC 功能:
import librosa as l
x, sr = l.load('/home/user/Data/Audio/Tracks/Dev/FS_P01_dev_001.wav', sr = 8000)
n_fft = int(sr * 0.02)
hop_length = n_fft // 2
mfccs = l.feature.mfcc(x, sr=sr, n_mfcc=13, hop_length=hop_length, n_fft=n_fft)
Run Code Online (Sandbox Code Playgroud)
但它显示了这个警告。这是什么意思,我该如何摆脱它?
UserWarning: Empty filters detected in mel frequency basis. Some channels will produce empty responses. Try increasing your sampling rate (and fmax) or reducing n_mels.
warnings.warn('Empty filters detected in mel frequency basis. '
Run Code Online (Sandbox Code Playgroud) 当我从音频中提取 MFCC 时,输出为(13, 22)
. 数字代表什么?是时间范围吗?我用的是librosa。
使用的代码是:
mfccs = librosa.feature.mfcc(y=X, sr=sample_rate, n_mfcc=13, hop_length=256)
mfccs
print(mfccs.shape)
Run Code Online (Sandbox Code Playgroud)
输出是(13,22)
.
我在Objective C中使用了这段代码:
@implementation KDOrderInfo
- (id)performDefaultImplementation {
NSString *theRequest = [self directParameter];
NSDictionary *arguments = [self evaluatedArguments];
NSLog(@"arguments = %@ %ld",arguments, [arguments count]);
NSLog(@"theRequest----> %@",theRequest);
/*.......
.....*/
return @YES
}
Run Code Online (Sandbox Code Playgroud)
这段代码在Objective C中运行正常.我将此代码转换为Swift代码,如下所示:
class OrderInfo : NSScriptCommand {
override func performDefaultImplementation() -> AnyObject! {
let theRequest: AnyObject! = self.directParameter
let arguments = self.evaluatedArguments
println("arguments = \(arguments) argumentsCount = \(arguments.count)")
println("theRequest----> \(theRequest)")
/*.......
.....*/
return "OK"
}
}
Run Code Online (Sandbox Code Playgroud)
当我运行我的AppleScript然后我得到错误(InfoMaker是我的应用程序的名称):InfoMaker得到一个错误:处理程序某些对象未定义.
方法 :
override func application(theApp:NSApplication,delegateHandlesKey theKey:String) -> Bool{
println("scripting key = \(theKey)");
let …
Run Code Online (Sandbox Code Playgroud) 我尝试使用librosa 中的librosa 和pitch_shift。我录制了一些声音并使用了以下代码:
sampling_rate= 44100
y, sr = librosa.load(directory, sr=sampling_rate) # y is a numpy array of the wav file, sr = sample rate
y_shifted = librosa.effects.pitch_shift(y, sr, n_steps=4, bins_per_octave=24) # shifted by 4 half steps
librosa.output.write_wav(directory, y_shifted, sr=sampling_rate, norm=False)
Run Code Online (Sandbox Code Playgroud)
它工作得很好 - 几乎。
我在新声音中听到一些噪音(在变调之后)
有什么我需要使用的东西吗?
不带平移:
https://vocaroo.com/i/s1qEEDvzcUHN
使用平移(n_steps = 4):
我正在尝试librosa.load()
在.wav
文件上运行该命令。在.wav file
从通过YouTube视频下载的YouTube-DL并具有以下特性:
但是,该命令返回的时间序列librosa.load('file.wav')
如下:
(array([0., 0., 0., ..., 0., 0., 0.], dtype=float32), 22050)
Run Code Online (Sandbox Code Playgroud)
该.wav
文件肯定有很多噪音,所以我不太明白为什么输出是0
针对每一帧的。
我也试过运行librosa.load()
其他.wav
其他Youtube视频音频文件,并有同样的结果。
如果有人对导致此输出的原因有任何想法,请现在告诉我。提前致谢。
librosa ×8
python ×8
audio ×7
java ×3
macos ×2
mfcc ×2
spectrogram ×2
airplay ×1
apple-m1 ×1
applescript ×1
avfoundation ×1
database ×1
h2 ×1
ios ×1
javasound ×1
migration ×1
python-3.x ×1
scipy ×1
swift ×1
wav ×1
youtube-dl ×1