开发者

With Python/PySide/PyQt/Phonon how to control a USB Soundcards output sample clock rate?

开发者 https://www.devze.com 2023-04-03 14:15 出处:网络
I am trying to O/P audio to a USB soundcard (Lindy PnP SoundCard device) via Python/PySide/PyQT by the use of Phonon and/or QTMultimedia.

I am trying to O/P audio to a USB soundcard (Lindy PnP SoundCard device) via Python/PySide/PyQT by the use of Phonon and/or QTMultimedia.

I can O/P the aduio (mp3/wav) which is no problem - the issue is that I want to control the USB's output sample clock rate, I need to be able to change this from 44.1 to 48 kHz. The soundcard comes with its own s/w that allows this so it is possible.

I can play Audio through Phonon like so..

self.mediaObj=phonon.Phonon.MediaObject(self)
self.audioSink=Phonon.AudioOutput(Phonon.MusicCategory, self)
self.audioPath=Phonon.createPath(self.mediaObj, self.audioSink)
self.audioSink.setVolume(0.3)

However I do not see any way to change the sample clock rate of the USB device from lookin开发者_StackOverflow中文版g at the Class Reference doc's it seems its not possible.

http://www.pyside.org/docs/pyside/PySide/phonon/index.html

So then I have tried to use Qt Multimedia to change the USB soundcards O/P clock rate..

format = QtMultimedia.QAudioFormat()
format.setChannels(2)
format.setFrequency(44100)
format.setSampleSize(16)
format.setByteOrder(QtMultimedia.QAudioFormat.LittleEndian)
format.setSampleType(QtMultimedia.QAudioFormat.SignedInt)

This has no effect. Does anyone know how I would do this and if it is even possible with Phonon/PyQT? I am guessing I need to go lower and try find the USB Soundcard directly which will be messy..

Much appeciate any help!!

Alan

0

精彩评论

暂无评论...
验证码 换一张
取 消