wavegen.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:cebl 作者: idfah 项目源码 文件源码
def __init__(self, mgr, sampRate=128,
                 chans=[str(n)+'x' for n in np.power(2, np.arange(8))/2.0],
                 waveform='sinusoid', freq=1.0, mix='none', pollSize=2):
        """
        Construct a new wave generator source.

        Args:
            sampRate:   Floating point value of the initial sampling frequency.

            chans:      Tuple of strings containing the initial channel
                        configuration.

            waveform:   String describing the type of waveform to produce.
                        May be 'sinusoid' or 'sawtooth' or 'square'

            freq:       Base frequency.  Each channel is a power-of-two
                        multiple of this frequency.

            pollSize:    Number of data samples collected during each poll.
                        Higher values result in better timing and marker
                        resolution but more CPU usage while higher values
                        typically use less CPU but worse timing results.
        """

        self.waveform = mp.Value('I', 0)
        self.freq = mp.Value('d', freq)
        self.t0 = mp.Value('d', 0.0)
        self.t0.value = 0.0
        self.pollSize = pollSize
        self.lock = mp.Lock()

        Source.__init__(self, mgr=mgr, sampRate=sampRate, chans=chans,
            configPanelClass=WaveGenConfigPanel)

        self.setWaveform(waveform)

        self.mixArr = mp.Array('d', self.getNChan()*self.getNChan())
        self.mixMat = (np.frombuffer(self.mixArr.get_obj())
                        .reshape((-1,self.getNChan())))
        self.setMix(mix)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号