我的流程图中有3-4个不同的音频源。我想要播放每个源背对背(而不是覆盖在对方之上),而不必手动启动和停止每个源。本质上表现得像个计时器。例如,播放源1然后停止,等待15秒,播放源2,等待30秒,等等……流程图中是否有可以这样做的块,或者是否有人已经有这样做的python块,或者类似的东西?
发布于 2020-12-07 19:19:23
在我自己的同类of...basically上,我制作了自己的嵌入式python块,它将我想要的输入延迟很多秒。以下是我想出的:
import time
import numpy as np
from gnuradio import gr
class blk(gr.sync_block):
"""Embedded Python Block that time delays the input file"""
# initializes the GRC Block input, output, block title, and parameters
def __init__(self, delay = 0):
gr.sync_block.__init__(
self,
name='Time Delayed Input',
in_sig=[np.float32],
out_sig=[np.float32]
)
# sets a callback for time delay in seconds specified in the GRC block
self.delay = time.sleep(delay)
def work(self, input_items, output_items):
# sets output equal to the input to just pass through the block
output_items[0][:] = input_items[0]
# calls a time delay in seconds
sleep.delay
# returns the input as the output after the specified delay
return len(output_items[0])https://stackoverflow.com/questions/65110965
复制相似问题