Python在gst插件中未检测到soundtouch元素(bpmdetect和pitch)

Python在gst插件中未检测到soundtouch元素(bpmdetect和pitch),python,gstreamer,pitch,audio-processing,soundtouch,Python,Gstreamer,Pitch,Audio Processing,Soundtouch,我已经安装了gstreamer,gst插件bad及其python绑定 下面的代码从给定目录中选择一首歌曲并播放 import pygst pygst.require("0.10") import gst import pygtk import gtk import os class Main: def __init__(self): self.pipeline = gst.Pipeline("mypipeline") self.musicFiles =

我已经安装了
gstreamer
gst插件bad
及其python绑定

下面的代码从给定目录中选择一首歌曲并播放

import pygst
pygst.require("0.10")
import gst
import pygtk
import gtk
import os

class Main:
    def __init__(self):
        self.pipeline = gst.Pipeline("mypipeline")

        self.musicFiles = os.listdir("musicFiles")

        self.currentSong = self.musicFiles[0]

        self.findFile = gst.element_factory_make("filesrc", "file")
        self.findFile.set_property("location", "musicFiles/" + self.currentSong)
        self.pipeline.add(self.findFile)

        self.mad = gst.element_factory_make("mad", "mad")
        self.pipeline.add(self.mad)

        self.findFile.link(self.mad)

        self.audioconvert = gst.element_factory_make("audioconvert", "convert")
        self.pipeline.add(self.audioconvert)

        self.mad.link(self.audioconvert)

        self.audioresample = gst.element_factory_make("audioresample", "resample")
        self.pipeline.add(self.audioresample)

        self.audioconvert.link(self.audioresample)

        self.getbpm = gst.element_factory_make("bpmdetect", "bpm")
        self.pipeline.add(self.getbpm)

        self.audioresample.link(self.getbpm)

        self.sink = gst.element_factory_make("playsink", "sink")
        self.pipeline.add(self.sink)

        self.audioresample.link(self.sink)

        self.pipeline.set_state(gst.STATE_PLAYING)

start=Main()
gtk.main()
但是,当我尝试创建
bpmdetect
元素时,它会出现以下错误:

Traceback (most recent call last):
  File "/Users/shubhitsingh/Desktop/Stuff/COLLEGE/US/Carnegie Mellon/Fall '12/15-112/Term Project/Practice/gstreamertutorial-1.py", line 49, in <module>
    start=Main()
  File "/Users/shubhitsingh/Desktop/Stuff/COLLEGE/US/Carnegie Mellon/Fall '12/15-112/Term Project/Practice/gstreamertutorial-1.py", line 37, in __init__
    self.getbpm = gst.element_factory_make("bpmdetect", "bpm")
ElementNotFoundError: bpmdetect
回溯(最近一次呼叫最后一次):
文件“/Users/shubhitsingh/Desktop/Stuff/COLLEGE/US/Carnegie-Mellon/Fall'12/15-112/Term Project/Practice/gstreamertutorial-1.py”,第49行,在
start=Main()
文件“/Users/shubhitsingh/Desktop/Stuff/COLLEGE/US/Carnegie-Mellon/Fall'12/15-112/Term-Project/Practice/gstreamertutorial-1.py”,第37行,在__
self.getbpm=gst.element\u factory\u make(“bpmdetect”、“bpm”)
ElementNotFoundError:bpmdetect

gst plugins bad
中的其他元素可以毫无问题地创建。只有
soundtouch
bpmdetect
pitch
)下的两个元素无法创建。帮助?

无法帮助解决bpm错误,但您的代码中存在链接错误,函数中从第二行到最后一行调用了错误的元素进行链接。1)尝试使用env.variable
GST\u DEBUG=3
或更高版本(最多7行可能是合理的)运行它,您可能会看到它失败的确切位置。2) 运行:
gst inspect bpmdetect