hexsha
stringlengths
40
40
repo
stringlengths
7
114
path
stringlengths
4
124
license
listlengths
1
9
language
stringclasses
1 value
identifier
stringlengths
1
71
return_type
stringlengths
1
749
⌀
original_string
stringlengths
76
22.7k
original_docstring
stringlengths
16
7.61k
docstring
stringlengths
16
2.47k
docstring_tokens
listlengths
6
477
code
stringlengths
14
10.2k
code_tokens
listlengths
6
996
short_docstring
stringlengths
2
644
short_docstring_tokens
listlengths
1
116
comment
listlengths
1
89
parameters
listlengths
0
64
docstring_params
dict
52990d3fcf3a3920824cb5eb29546a792b720461
TurtleP/luaprettydoc
luaprettydoc/luafile.py
[ "MIT" ]
Python
debug_export
None
def debug_export(self, visitor: Visitor, filepath: Path) -> None: """Exports the Lua File to YAML for debug purposes""" __directory = Path(LuaFile.TestFilePath) if filepath.parent.name != Path().cwd().name: __directory = Path( f"{LuaFile.TestFilePath}/{filepath.paren...
Exports the Lua File to YAML for debug purposes
Exports the Lua File to YAML for debug purposes
[ "Exports", "the", "Lua", "File", "to", "YAML", "for", "debug", "purposes" ]
def debug_export(self, visitor: Visitor, filepath: Path) -> None: __directory = Path(LuaFile.TestFilePath) if filepath.parent.name != Path().cwd().name: __directory = Path( f"{LuaFile.TestFilePath}/{filepath.parent.name}") __directory.mkdir(parents=True, exist_ok=True...
[ "def", "debug_export", "(", "self", ",", "visitor", ":", "Visitor", ",", "filepath", ":", "Path", ")", "->", "None", ":", "__directory", "=", "Path", "(", "LuaFile", ".", "TestFilePath", ")", "if", "filepath", ".", "parent", ".", "name", "!=", "Path", ...
Exports the Lua File to YAML for debug purposes
[ "Exports", "the", "Lua", "File", "to", "YAML", "for", "debug", "purposes" ]
[ "\"\"\"Exports the Lua File to YAML for debug purposes\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "visitor", "type": "Visitor" }, { "param": "filepath", "type": "Path" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "visitor", "type": "Visitor", "docstring": null, "docstring_to...
52990d3fcf3a3920824cb5eb29546a792b720461
TurtleP/luaprettydoc
luaprettydoc/luafile.py
[ "MIT" ]
Python
export
None
def export(self, version: str, date: str) -> None: """Exports the Lua File to Markdown""" if not self.output: return with open(self.outname, "w", encoding="utf-8") as file: print(f"{self.buffer}{LuaFile.Footer.format(version, date)}", file=file)
Exports the Lua File to Markdown
Exports the Lua File to Markdown
[ "Exports", "the", "Lua", "File", "to", "Markdown" ]
def export(self, version: str, date: str) -> None: if not self.output: return with open(self.outname, "w", encoding="utf-8") as file: print(f"{self.buffer}{LuaFile.Footer.format(version, date)}", file=file)
[ "def", "export", "(", "self", ",", "version", ":", "str", ",", "date", ":", "str", ")", "->", "None", ":", "if", "not", "self", ".", "output", ":", "return", "with", "open", "(", "self", ".", "outname", ",", "\"w\"", ",", "encoding", "=", "\"utf-8\...
Exports the Lua File to Markdown
[ "Exports", "the", "Lua", "File", "to", "Markdown" ]
[ "\"\"\"Exports the Lua File to Markdown\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "version", "type": "str" }, { "param": "date", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "version", "type": "str", "docstring": null, "docstring_tokens...
d94aeeaf368c4963c764afab9c8eec04f5b30e28
linuxaddict89/luminos-starter-react-webpack
myapp/myapp.py
[ "MIT" ]
Python
main
null
def main(): signal.signal(signal.SIGINT, sigint_handler) """ This attribute need to be set before QCoreApplication created, it will still show warning because QWebEngineView::initialize call this at the end. """ MyApp.setAttribute(Qt.AA_ShareOpenGLContexts, True) app = MyApp(sys.argv[1:...
This attribute need to be set before QCoreApplication created, it will still show warning because QWebEngineView::initialize call this at the end.
This attribute need to be set before QCoreApplication created, it will still show warning because QWebEngineView::initialize call this at the end.
[ "This", "attribute", "need", "to", "be", "set", "before", "QCoreApplication", "created", "it", "will", "still", "show", "warning", "because", "QWebEngineView", "::", "initialize", "call", "this", "at", "the", "end", "." ]
def main(): signal.signal(signal.SIGINT, sigint_handler) MyApp.setAttribute(Qt.AA_ShareOpenGLContexts, True) app = MyApp(sys.argv[1:]) timer = QTimer() timer.start(500) timer.timeout.connect(lambda: None) sys.exit(app.exec_())
[ "def", "main", "(", ")", ":", "signal", ".", "signal", "(", "signal", ".", "SIGINT", ",", "sigint_handler", ")", "MyApp", ".", "setAttribute", "(", "Qt", ".", "AA_ShareOpenGLContexts", ",", "True", ")", "app", "=", "MyApp", "(", "sys", ".", "argv", "["...
This attribute need to be set before QCoreApplication created, it will still show warning because QWebEngineView::initialize call this at the end.
[ "This", "attribute", "need", "to", "be", "set", "before", "QCoreApplication", "created", "it", "will", "still", "show", "warning", "because", "QWebEngineView", "::", "initialize", "call", "this", "at", "the", "end", "." ]
[ "\"\"\"\n This attribute need to be set before QCoreApplication created,\n it will still show warning because QWebEngineView::initialize\n call this at the end.\n \"\"\"", "# Python cannot handle signals while the Qt event loop is running.", "# so we need to use QTimer to let the interpreter run fro...
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
b96888bcb3022ecf9fc57ff88e14f62555d87642
jawats/tap-feed
tap_feed/streams.py
[ "Apache-2.0" ]
Python
schema
dict
def schema(self) -> dict: """Create a dynamic schema based on the tap configuration provided.""" feed_properties: list = [ th.Property("feed_url", th.StringType), ] feed_properties.extend( [ th.Property(f"feed_{name}", th.StringType) ...
Create a dynamic schema based on the tap configuration provided.
Create a dynamic schema based on the tap configuration provided.
[ "Create", "a", "dynamic", "schema", "based", "on", "the", "tap", "configuration", "provided", "." ]
def schema(self) -> dict: feed_properties: list = [ th.Property("feed_url", th.StringType), ] feed_properties.extend( [ th.Property(f"feed_{name}", th.StringType) for name in self.config["feed_fields"] ] ) feed_p...
[ "def", "schema", "(", "self", ")", "->", "dict", ":", "feed_properties", ":", "list", "=", "[", "th", ".", "Property", "(", "\"feed_url\"", ",", "th", ".", "StringType", ")", ",", "]", "feed_properties", ".", "extend", "(", "[", "th", ".", "Property", ...
Create a dynamic schema based on the tap configuration provided.
[ "Create", "a", "dynamic", "schema", "based", "on", "the", "tap", "configuration", "provided", "." ]
[ "\"\"\"Create a dynamic schema based on the tap configuration provided.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b96888bcb3022ecf9fc57ff88e14f62555d87642
jawats/tap-feed
tap_feed/streams.py
[ "Apache-2.0" ]
Python
parse_response
Iterable[dict]
def parse_response(self, response: requests.Response) -> Iterable[dict]: """Parse the response and return an iterator of result rows.""" feed = feedparser.parse(response.text) rep_key = FeedStream.replication_key[6:] entries = sorted( feed["entries"], key=lambda d: datetime_p...
Parse the response and return an iterator of result rows.
Parse the response and return an iterator of result rows.
[ "Parse", "the", "response", "and", "return", "an", "iterator", "of", "result", "rows", "." ]
def parse_response(self, response: requests.Response) -> Iterable[dict]: feed = feedparser.parse(response.text) rep_key = FeedStream.replication_key[6:] entries = sorted( feed["entries"], key=lambda d: datetime_parser.parse(d[rep_key]) ) feed_url = response.url ...
[ "def", "parse_response", "(", "self", ",", "response", ":", "requests", ".", "Response", ")", "->", "Iterable", "[", "dict", "]", ":", "feed", "=", "feedparser", ".", "parse", "(", "response", ".", "text", ")", "rep_key", "=", "FeedStream", ".", "replica...
Parse the response and return an iterator of result rows.
[ "Parse", "the", "response", "and", "return", "an", "iterator", "of", "result", "rows", "." ]
[ "\"\"\"Parse the response and return an iterator of result rows.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "response", "type": "requests.Response" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "response", "type": "requests.Response", "docstring": null, "d...
a35a77d141573766f5f3bb60672e19d651184a13
jawats/tap-feed
tap_feed/tap.py
[ "Apache-2.0" ]
Python
discover_streams
List[Stream]
def discover_streams(self) -> List[Stream]: """Return a list of discovered streams.""" FeedStream.replication_key = ( f"entry_{self.config['feed_entry_replication_key']}" ) return [FeedStream(tap=self)]
Return a list of discovered streams.
Return a list of discovered streams.
[ "Return", "a", "list", "of", "discovered", "streams", "." ]
def discover_streams(self) -> List[Stream]: FeedStream.replication_key = ( f"entry_{self.config['feed_entry_replication_key']}" ) return [FeedStream(tap=self)]
[ "def", "discover_streams", "(", "self", ")", "->", "List", "[", "Stream", "]", ":", "FeedStream", ".", "replication_key", "=", "(", "f\"entry_{self.config['feed_entry_replication_key']}\"", ")", "return", "[", "FeedStream", "(", "tap", "=", "self", ")", "]" ]
Return a list of discovered streams.
[ "Return", "a", "list", "of", "discovered", "streams", "." ]
[ "\"\"\"Return a list of discovered streams.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c4338979d54c720e3a3ef47f8d987aec19ccb02a
joker-i5700/BaiduPCS-Py
baidupcs_py/common/downloader.py
[ "MIT" ]
Python
download
null
def download( self, localpath: PathLike, task_id: Optional[TaskID], continue_: bool = False, done_callback: Optional[Callable[[Future], Any]] = None, ): """ Download the url content to `localpath` The downloading work executing in the class ThreadPool...
Download the url content to `localpath` The downloading work executing in the class ThreadPoolExecutor Args: continue_ (bool): If set to True, only downloading the remain content depended on the size of `localpath`
Download the url content to `localpath` The downloading work executing in the class ThreadPoolExecutor continue_ (bool): If set to True, only downloading the remain content depended on the size of `localpath`
[ "Download", "the", "url", "content", "to", "`", "localpath", "`", "The", "downloading", "work", "executing", "in", "the", "class", "ThreadPoolExecutor", "continue_", "(", "bool", ")", ":", "If", "set", "to", "True", "only", "downloading", "the", "remain", "c...
def download( self, localpath: PathLike, task_id: Optional[TaskID], continue_: bool = False, done_callback: Optional[Callable[[Future], Any]] = None, ): self._task_id = task_id if continue_: _path = Path(localpath) _offset = _path.stat(...
[ "def", "download", "(", "self", ",", "localpath", ":", "PathLike", ",", "task_id", ":", "Optional", "[", "TaskID", "]", ",", "continue_", ":", "bool", "=", "False", ",", "done_callback", ":", "Optional", "[", "Callable", "[", "[", "Future", "]", ",", "...
Download the url content to `localpath` The downloading work executing in the class ThreadPoolExecutor
[ "Download", "the", "url", "content", "to", "`", "localpath", "`", "The", "downloading", "work", "executing", "in", "the", "class", "ThreadPoolExecutor" ]
[ "\"\"\"\n Download the url content to `localpath`\n\n The downloading work executing in the class ThreadPoolExecutor\n\n Args:\n continue_ (bool): If set to True, only downloading the remain content depended on\n the size of `localpath`\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "localpath", "type": "PathLike" }, { "param": "task_id", "type": "Optional[TaskID]" }, { "param": "continue_", "type": "bool" }, { "param": "done_callback", "type": "Optional[Callable[[Future], Any]]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "localpath", "type": "PathLike", "docstring": null, "docstring...
e4e01c61773cb3d0a02877d4815fa4fc02dbb8cb
joker-i5700/BaiduPCS-Py
baidupcs_py/app/app.py
[ "MIT" ]
Python
_recent_api
Optional[BaiduPCSApi]
def _recent_api(ctx) -> Optional[BaiduPCSApi]: """Return recent user's `BaiduPCSApi`""" am = ctx.obj.account_manager account = am.who() if not account: print("[italic red]No recent user, please adding or selecting one[/]") return None return account.pcsapi()
Return recent user's `BaiduPCSApi`
Return recent user's `BaiduPCSApi`
[ "Return", "recent", "user", "'", "s", "`", "BaiduPCSApi", "`" ]
def _recent_api(ctx) -> Optional[BaiduPCSApi]: am = ctx.obj.account_manager account = am.who() if not account: print("[italic red]No recent user, please adding or selecting one[/]") return None return account.pcsapi()
[ "def", "_recent_api", "(", "ctx", ")", "->", "Optional", "[", "BaiduPCSApi", "]", ":", "am", "=", "ctx", ".", "obj", ".", "account_manager", "account", "=", "am", ".", "who", "(", ")", "if", "not", "account", ":", "print", "(", "\"[italic red]No recent u...
Return recent user's `BaiduPCSApi`
[ "Return", "recent", "user", "'", "s", "`", "BaiduPCSApi", "`" ]
[ "\"\"\"Return recent user's `BaiduPCSApi`\"\"\"" ]
[ { "param": "ctx", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e4e01c61773cb3d0a02877d4815fa4fc02dbb8cb
joker-i5700/BaiduPCS-Py
baidupcs_py/app/app.py
[ "MIT" ]
Python
_pwd
Path
def _pwd(ctx) -> Path: """Return recent user's pwd""" am = ctx.obj.account_manager return Path(am.pwd)
Return recent user's pwd
Return recent user's pwd
[ "Return", "recent", "user", "'", "s", "pwd" ]
def _pwd(ctx) -> Path: am = ctx.obj.account_manager return Path(am.pwd)
[ "def", "_pwd", "(", "ctx", ")", "->", "Path", ":", "am", "=", "ctx", ".", "obj", ".", "account_manager", "return", "Path", "(", "am", ".", "pwd", ")" ]
Return recent user's pwd
[ "Return", "recent", "user", "'", "s", "pwd" ]
[ "\"\"\"Return recent user's pwd\"\"\"" ]
[ { "param": "ctx", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ctx", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6053269b00f3dbe28adba7d10d30e6c0dc05718f
palicao/logclouseau
src/logclouseau.py
[ "MIT" ]
Python
evaluate_files
None
def evaluate_files(self) -> None: """ Evaluates each file in a different thread """ files = self._config['file'] executor = ThreadPoolExecutor(len(files)) with executor as thread: thread.map(self.evaluate_file, files.items())
Evaluates each file in a different thread
Evaluates each file in a different thread
[ "Evaluates", "each", "file", "in", "a", "different", "thread" ]
def evaluate_files(self) -> None: files = self._config['file'] executor = ThreadPoolExecutor(len(files)) with executor as thread: thread.map(self.evaluate_file, files.items())
[ "def", "evaluate_files", "(", "self", ")", "->", "None", ":", "files", "=", "self", ".", "_config", "[", "'file'", "]", "executor", "=", "ThreadPoolExecutor", "(", "len", "(", "files", ")", ")", "with", "executor", "as", "thread", ":", "thread", ".", "...
Evaluates each file in a different thread
[ "Evaluates", "each", "file", "in", "a", "different", "thread" ]
[ "\"\"\"\n Evaluates each file in a different thread\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6053269b00f3dbe28adba7d10d30e6c0dc05718f
palicao/logclouseau
src/logclouseau.py
[ "MIT" ]
Python
load_config
Dict[str, Any]
def load_config(config_file: str) -> Dict[str, Any]: """ Loads a config file from a toml file and asserts it's valid. In order to be valid, a config must have at least 3 keys: channel, file, alert. Each one of them has its own format. The validation of the format is left ...
Loads a config file from a toml file and asserts it's valid. In order to be valid, a config must have at least 3 keys: channel, file, alert. Each one of them has its own format. The validation of the format is left at the consumer.
Loads a config file from a toml file and asserts it's valid. In order to be valid, a config must have at least 3 keys: channel, file, alert. Each one of them has its own format. The validation of the format is left at the consumer.
[ "Loads", "a", "config", "file", "from", "a", "toml", "file", "and", "asserts", "it", "'", "s", "valid", ".", "In", "order", "to", "be", "valid", "a", "config", "must", "have", "at", "least", "3", "keys", ":", "channel", "file", "alert", ".", "Each", ...
def load_config(config_file: str) -> Dict[str, Any]: config: Dict[str, Any] = toml.load(config_file) utils.assert_dict_contains_keys(config, {'channel', 'file', 'alert'}) return config
[ "def", "load_config", "(", "config_file", ":", "str", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "config", ":", "Dict", "[", "str", ",", "Any", "]", "=", "toml", ".", "load", "(", "config_file", ")", "utils", ".", "assert_dict_contains_keys",...
Loads a config file from a toml file and asserts it's valid.
[ "Loads", "a", "config", "file", "from", "a", "toml", "file", "and", "asserts", "it", "'", "s", "valid", "." ]
[ "\"\"\"\n Loads a config file from a toml file and asserts it's valid.\n In order to be valid, a config must have at least 3 keys:\n channel, file, alert.\n Each one of them has its own format.\n The validation of the format is left at the consumer.\n \"\"\"" ]
[ { "param": "config_file", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "config_file", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4aa9244b85398c274b1b98d775bcd6f9839945ca
palicao/logclouseau
src/alert.py
[ "MIT" ]
Python
__send_alert
None
def __send_alert(self, tokens: Dict[str, Any], line: str) -> None: """ Sends an alert if it's not in the grace_time and if it happened at least min_occurrences """ ident = self._identifier.format(**tokens) msg = self._message.format(**tokens) try: self...
Sends an alert if it's not in the grace_time and if it happened at least min_occurrences
Sends an alert if it's not in the grace_time and if it happened at least min_occurrences
[ "Sends", "an", "alert", "if", "it", "'", "s", "not", "in", "the", "grace_time", "and", "if", "it", "happened", "at", "least", "min_occurrences" ]
def __send_alert(self, tokens: Dict[str, Any], line: str) -> None: ident = self._identifier.format(**tokens) msg = self._message.format(**tokens) try: self._occurrence[ident] += 1 except KeyError: self._occurrence[ident] = 1 if self._occurrence[ident] < se...
[ "def", "__send_alert", "(", "self", ",", "tokens", ":", "Dict", "[", "str", ",", "Any", "]", ",", "line", ":", "str", ")", "->", "None", ":", "ident", "=", "self", ".", "_identifier", ".", "format", "(", "**", "tokens", ")", "msg", "=", "self", "...
Sends an alert if it's not in the grace_time and if it happened at least min_occurrences
[ "Sends", "an", "alert", "if", "it", "'", "s", "not", "in", "the", "grace_time", "and", "if", "it", "happened", "at", "least", "min_occurrences" ]
[ "\"\"\"\n Sends an alert if it's not in the grace_time and if it happened at\n least min_occurrences\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "tokens", "type": "Dict[str, Any]" }, { "param": "line", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tokens", "type": "Dict[str, Any]", "docstring": null, "docstr...
a49a2cf04d77435d3cab943d1faa2a6aafb12fdd
vt-vl-lab/video-data-aug
mmaction/models/recognizers/base_semi.py
[ "Apache-2.0" ]
Python
_parse_losses
<not_specific>
def _parse_losses(losses): """Parse the raw outputs (losses) of the network. Args: losses (dict): Raw output of the network, which usually contain losses and other necessary information. Returns: tuple[Tensor, dict]: (loss, log_vars), loss is the loss te...
Parse the raw outputs (losses) of the network. Args: losses (dict): Raw output of the network, which usually contain losses and other necessary information. Returns: tuple[Tensor, dict]: (loss, log_vars), loss is the loss tensor which may be a we...
Parse the raw outputs (losses) of the network.
[ "Parse", "the", "raw", "outputs", "(", "losses", ")", "of", "the", "network", "." ]
def _parse_losses(losses): log_vars = OrderedDict() for loss_name, loss_value in losses.items(): if isinstance(loss_value, torch.Tensor): log_vars[loss_name] = loss_value.mean() elif isinstance(loss_value, list): log_vars[loss_name] = sum(_loss.mea...
[ "def", "_parse_losses", "(", "losses", ")", ":", "log_vars", "=", "OrderedDict", "(", ")", "for", "loss_name", ",", "loss_value", "in", "losses", ".", "items", "(", ")", ":", "if", "isinstance", "(", "loss_value", ",", "torch", ".", "Tensor", ")", ":", ...
Parse the raw outputs (losses) of the network.
[ "Parse", "the", "raw", "outputs", "(", "losses", ")", "of", "the", "network", "." ]
[ "\"\"\"Parse the raw outputs (losses) of the network.\n\n Args:\n losses (dict): Raw output of the network, which usually contain\n losses and other necessary information.\n\n Returns:\n tuple[Tensor, dict]: (loss, log_vars), loss is the loss tensor\n ...
[ { "param": "losses", "type": null } ]
{ "returns": [ { "docstring": "(loss, log_vars), loss is the loss tensor\nwhich may be a weighted sum of all losses, log_vars contains\nall the variables to be sent to the logger.", "docstring_tokens": [ "(", "loss", "log_vars", ")", "loss", "is", ...
a49a2cf04d77435d3cab943d1faa2a6aafb12fdd
vt-vl-lab/video-data-aug
mmaction/models/recognizers/base_semi.py
[ "Apache-2.0" ]
Python
forward
<not_specific>
def forward(self, imgs, label=None, return_loss=True, imgs_weak=None, imgs_strong=None, label_unlabeled=None, human_mask=None, imagenet_prob=None): """Define the computation performed at every call.""" if return_loss: if label is None: raise ValueError('Label should not be No...
Define the computation performed at every call.
Define the computation performed at every call.
[ "Define", "the", "computation", "performed", "at", "every", "call", "." ]
def forward(self, imgs, label=None, return_loss=True, imgs_weak=None, imgs_strong=None, label_unlabeled=None, human_mask=None, imagenet_prob=None): if return_loss: if label is None: raise ValueError('Label should not be None.') if imgs_weak is None or imgs_strong is None ...
[ "def", "forward", "(", "self", ",", "imgs", ",", "label", "=", "None", ",", "return_loss", "=", "True", ",", "imgs_weak", "=", "None", ",", "imgs_strong", "=", "None", ",", "label_unlabeled", "=", "None", ",", "human_mask", "=", "None", ",", "imagenet_pr...
Define the computation performed at every call.
[ "Define", "the", "computation", "performed", "at", "every", "call", "." ]
[ "\"\"\"Define the computation performed at every call.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "imgs", "type": null }, { "param": "label", "type": null }, { "param": "return_loss", "type": null }, { "param": "imgs_weak", "type": null }, { "param": "imgs_strong", "type": null }, { "param":...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "imgs", "type": null, "docstring": null, "docstring_tokens": [...
a49a2cf04d77435d3cab943d1faa2a6aafb12fdd
vt-vl-lab/video-data-aug
mmaction/models/recognizers/base_semi.py
[ "Apache-2.0" ]
Python
train_step
<not_specific>
def train_step(self, data_batch_labeled, data_batch_unlabeled, optimizer, **kwargs): """The iteration step during training. This method defines an iteration step during training, except for the back propagation and optimizer updating, which are done in an optimizer hook. Note that in so...
The iteration step during training. This method defines an iteration step during training, except for the back propagation and optimizer updating, which are done in an optimizer hook. Note that in some complicated cases or models, the whole process including back propagation and optimiz...
The iteration step during training. This method defines an iteration step during training, except for the back propagation and optimizer updating, which are done in an optimizer hook. Note that in some complicated cases or models, the whole process including back propagation and optimizer updating is also defined in th...
[ "The", "iteration", "step", "during", "training", ".", "This", "method", "defines", "an", "iteration", "step", "during", "training", "except", "for", "the", "back", "propagation", "and", "optimizer", "updating", "which", "are", "done", "in", "an", "optimizer", ...
def train_step(self, data_batch_labeled, data_batch_unlabeled, optimizer, **kwargs): imgs = data_batch_labeled['imgs'] label = data_batch_labeled['label'] imgs_weak = data_batch_unlabeled['imgs_weak'] imgs_strong = data_batch_unlabeled['imgs_strong'] if self.actor_cutmix and np.r...
[ "def", "train_step", "(", "self", ",", "data_batch_labeled", ",", "data_batch_unlabeled", ",", "optimizer", ",", "**", "kwargs", ")", ":", "imgs", "=", "data_batch_labeled", "[", "'imgs'", "]", "label", "=", "data_batch_labeled", "[", "'label'", "]", "imgs_weak"...
The iteration step during training.
[ "The", "iteration", "step", "during", "training", "." ]
[ "\"\"\"The iteration step during training.\n\n This method defines an iteration step during training, except for the\n back propagation and optimizer updating, which are done in an optimizer\n hook. Note that in some complicated cases or models, the whole process\n including back propaga...
[ { "param": "self", "type": null }, { "param": "data_batch_labeled", "type": null }, { "param": "data_batch_unlabeled", "type": null }, { "param": "optimizer", "type": null } ]
{ "returns": [ { "docstring": "It should contain at least 3 keys: ``loss``, ``log_vars``,\n``num_samples``.\n``loss`` is a tensor for back propagation, which can be a\nweighted sum of multiple losses.\n``log_vars`` contains all the variables to be sent to the\nlogger.\n``num_samples`` indicates the batch si...
0ac67417c55979f27b51849ef72959a35be9f82e
vt-vl-lab/video-data-aug
mmaction/models/recognizers/recognizer3d_semi.py
[ "Apache-2.0" ]
Python
forward_train
<not_specific>
def forward_train(self, imgs, labels, imgs_weak, imgs_strong, labels_unlabeled, human_mask=None, imagenet_prob=None): """Defines the computation performed at every call when training.""" bz_labeled = imgs.shape[0] bz_unlabeled = imgs_weak.shape[0] imgs_all = torch.cat([imgs, imgs_weak, i...
Defines the computation performed at every call when training.
Defines the computation performed at every call when training.
[ "Defines", "the", "computation", "performed", "at", "every", "call", "when", "training", "." ]
def forward_train(self, imgs, labels, imgs_weak, imgs_strong, labels_unlabeled, human_mask=None, imagenet_prob=None): bz_labeled = imgs.shape[0] bz_unlabeled = imgs_weak.shape[0] imgs_all = torch.cat([imgs, imgs_weak, imgs_strong], dim=0) imgs_all = imgs_all.reshape((-1, ) + imgs_all.sha...
[ "def", "forward_train", "(", "self", ",", "imgs", ",", "labels", ",", "imgs_weak", ",", "imgs_strong", ",", "labels_unlabeled", ",", "human_mask", "=", "None", ",", "imagenet_prob", "=", "None", ")", ":", "bz_labeled", "=", "imgs", ".", "shape", "[", "0", ...
Defines the computation performed at every call when training.
[ "Defines", "the", "computation", "performed", "at", "every", "call", "when", "training", "." ]
[ "\"\"\"Defines the computation performed at every call when training.\"\"\"", "# TODO: If we forward imgs_weak with no_grad, and then jointly forward imgs and imgs_strong,", "# we might be able to save memory for a larger batch size? But not sure if this has", "# negative impact on batch-norm.", "# NOTE: pr...
[ { "param": "self", "type": null }, { "param": "imgs", "type": null }, { "param": "labels", "type": null }, { "param": "imgs_weak", "type": null }, { "param": "imgs_strong", "type": null }, { "param": "labels_unlabeled", "type": null }, { "p...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "imgs", "type": null, "docstring": null, "docstring_tokens": [...
e595788262b8654012aec37df8f67b44f0acb4e8
vt-vl-lab/video-data-aug
mmaction/core/evaluation/accuracy.py
[ "Apache-2.0" ]
Python
plot_confusion_matrix
<not_specific>
def plot_confusion_matrix(cm, class_names, figsize=(10,10), save_path=None, normalize=False): """ Returns a matplotlib figure containing the plotted confusion matrix. Args: cm (array, shape = [n, n]): a confusion matrix of integer classes class_names (array, shape = [n]): String names of th...
Returns a matplotlib figure containing the plotted confusion matrix. Args: cm (array, shape = [n, n]): a confusion matrix of integer classes class_names (array, shape = [n]): String names of the integer classes figsize: figure pannel size save_path: the path to save the confusi...
Returns a matplotlib figure containing the plotted confusion matrix.
[ "Returns", "a", "matplotlib", "figure", "containing", "the", "plotted", "confusion", "matrix", "." ]
def plot_confusion_matrix(cm, class_names, figsize=(10,10), save_path=None, normalize=False): figure = plt.figure(figsize=figsize) plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues) plt.title("Confusion matrix") plt.colorbar() tick_marks = np.arange(len(class_names)) plt.xticks(tick_mark...
[ "def", "plot_confusion_matrix", "(", "cm", ",", "class_names", ",", "figsize", "=", "(", "10", ",", "10", ")", ",", "save_path", "=", "None", ",", "normalize", "=", "False", ")", ":", "figure", "=", "plt", ".", "figure", "(", "figsize", "=", "figsize",...
Returns a matplotlib figure containing the plotted confusion matrix.
[ "Returns", "a", "matplotlib", "figure", "containing", "the", "plotted", "confusion", "matrix", "." ]
[ "\"\"\"\n Returns a matplotlib figure containing the plotted confusion matrix.\n\n Args:\n cm (array, shape = [n, n]): a confusion matrix of integer classes\n class_names (array, shape = [n]): String names of the integer classes\n figsize: figure pannel size\n save_path: the path t...
[ { "param": "cm", "type": null }, { "param": "class_names", "type": null }, { "param": "figsize", "type": null }, { "param": "save_path", "type": null }, { "param": "normalize", "type": null } ]
{ "returns": [ { "docstring": "matplotlib figure of the confusion matrix", "docstring_tokens": [ "matplotlib", "figure", "of", "the", "confusion", "matrix" ], "type": "figure" } ], "raises": [], "params": [ { "identifier":...
cad03bcf8194b18ccb4796abdba31b4d63b2e9db
vt-vl-lab/video-data-aug
mmaction/datasets/rawframe_dataset_unlabeled.py
[ "Apache-2.0" ]
Python
load_detections
null
def load_detections(self, det_file): """Load human detection results and merge it with self.video_infos""" dets = np.load(det_file, allow_pickle=True).item() if 'kinetics' in det_file: for idx in range(len(self.video_infos)): seq_name = self.video_infos[idx]['frame_di...
Load human detection results and merge it with self.video_infos
Load human detection results and merge it with self.video_infos
[ "Load", "human", "detection", "results", "and", "merge", "it", "with", "self", ".", "video_infos" ]
def load_detections(self, det_file): dets = np.load(det_file, allow_pickle=True).item() if 'kinetics' in det_file: for idx in range(len(self.video_infos)): seq_name = self.video_infos[idx]['frame_dir'].split('/')[-1][:11] self.video_infos[idx]['all_detections'...
[ "def", "load_detections", "(", "self", ",", "det_file", ")", ":", "dets", "=", "np", ".", "load", "(", "det_file", ",", "allow_pickle", "=", "True", ")", ".", "item", "(", ")", "if", "'kinetics'", "in", "det_file", ":", "for", "idx", "in", "range", "...
Load human detection results and merge it with self.video_infos
[ "Load", "human", "detection", "results", "and", "merge", "it", "with", "self", ".", "video_infos" ]
[ "\"\"\"Load human detection results and merge it with self.video_infos\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "det_file", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "det_file", "type": null, "docstring": null, "docstring_tokens...
cad03bcf8194b18ccb4796abdba31b4d63b2e9db
vt-vl-lab/video-data-aug
mmaction/datasets/rawframe_dataset_unlabeled.py
[ "Apache-2.0" ]
Python
load_imagenet_scores
null
def load_imagenet_scores(self, cls_file): """Load ImageNet pre-trained model scores and merge it with self.video_infos""" cls = np.load(cls_file, allow_pickle=True).item() if 'kinetics' in cls_file: for idx in range(len(self.video_infos)): seq_name = self.video_infos[...
Load ImageNet pre-trained model scores and merge it with self.video_infos
Load ImageNet pre-trained model scores and merge it with self.video_infos
[ "Load", "ImageNet", "pre", "-", "trained", "model", "scores", "and", "merge", "it", "with", "self", ".", "video_infos" ]
def load_imagenet_scores(self, cls_file): cls = np.load(cls_file, allow_pickle=True).item() if 'kinetics' in cls_file: for idx in range(len(self.video_infos)): seq_name = self.video_infos[idx]['frame_dir'].split('/')[-1][:11] self.video_infos[idx]['imagenet_sc...
[ "def", "load_imagenet_scores", "(", "self", ",", "cls_file", ")", ":", "cls", "=", "np", ".", "load", "(", "cls_file", ",", "allow_pickle", "=", "True", ")", ".", "item", "(", ")", "if", "'kinetics'", "in", "cls_file", ":", "for", "idx", "in", "range",...
Load ImageNet pre-trained model scores and merge it with self.video_infos
[ "Load", "ImageNet", "pre", "-", "trained", "model", "scores", "and", "merge", "it", "with", "self", ".", "video_infos" ]
[ "\"\"\"Load ImageNet pre-trained model scores and merge it with self.video_infos\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "cls_file", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cls_file", "type": null, "docstring": null, "docstring_tokens...
cad03bcf8194b18ccb4796abdba31b4d63b2e9db
vt-vl-lab/video-data-aug
mmaction/datasets/rawframe_dataset_unlabeled.py
[ "Apache-2.0" ]
Python
prepare_train_frames
<not_specific>
def prepare_train_frames(self, idx): """Prepare the frames for training given the index.""" results = copy.deepcopy(self.video_infos[idx]) results['filename_tmpl'] = self.filename_tmpl results['modality'] = self.modality results['start_index'] = self.start_index output = ...
Prepare the frames for training given the index.
Prepare the frames for training given the index.
[ "Prepare", "the", "frames", "for", "training", "given", "the", "index", "." ]
def prepare_train_frames(self, idx): results = copy.deepcopy(self.video_infos[idx]) results['filename_tmpl'] = self.filename_tmpl results['modality'] = self.modality results['start_index'] = self.start_index output = dict() results_weak = self.pipeline_weak(results) ...
[ "def", "prepare_train_frames", "(", "self", ",", "idx", ")", ":", "results", "=", "copy", ".", "deepcopy", "(", "self", ".", "video_infos", "[", "idx", "]", ")", "results", "[", "'filename_tmpl'", "]", "=", "self", ".", "filename_tmpl", "results", "[", "...
Prepare the frames for training given the index.
[ "Prepare", "the", "frames", "for", "training", "given", "the", "index", "." ]
[ "\"\"\"Prepare the frames for training given the index.\"\"\"", "# Step1: Sample frame and resizing", "# Step2: Strong augmentation", "# NOTE: For ImageNet knowledge distillation", "# Randomly sample 1 frame for distillation", "# NOTE: For Kinetics-100, we only have prob for some of the frames only", "#...
[ { "param": "self", "type": null }, { "param": "idx", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "idx", "type": null, "docstring": null, "docstring_tokens": []...
eef09c11ee9194da181a679f66d683ee2c88d1dc
vt-vl-lab/video-data-aug
mmaction/models/recognizers/recognizer3d_supervised_aug.py
[ "Apache-2.0" ]
Python
forward_train
<not_specific>
def forward_train(self, imgs, labels): """Defines the computation performed at every call when training.""" # NOTE: Get human_mask if len(imgs.shape) == 7: human_mask = imgs[1] imgs = imgs[0] else: human_mask = None imgs = imgs.reshape((-1, ) ...
Defines the computation performed at every call when training.
Defines the computation performed at every call when training.
[ "Defines", "the", "computation", "performed", "at", "every", "call", "when", "training", "." ]
def forward_train(self, imgs, labels): if len(imgs.shape) == 7: human_mask = imgs[1] imgs = imgs[0] else: human_mask = None imgs = imgs.reshape((-1, ) + imgs.shape[2:]) x = self.extract_feat(imgs) cls_score = self.cls_head(x) gt_labels ...
[ "def", "forward_train", "(", "self", ",", "imgs", ",", "labels", ")", ":", "if", "len", "(", "imgs", ".", "shape", ")", "==", "7", ":", "human_mask", "=", "imgs", "[", "1", "]", "imgs", "=", "imgs", "[", "0", "]", "else", ":", "human_mask", "=", ...
Defines the computation performed at every call when training.
[ "Defines", "the", "computation", "performed", "at", "every", "call", "when", "training", "." ]
[ "\"\"\"Defines the computation performed at every call when training.\"\"\"", "# NOTE: Get human_mask" ]
[ { "param": "self", "type": null }, { "param": "imgs", "type": null }, { "param": "labels", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "imgs", "type": null, "docstring": null, "docstring_tokens": [...
49da8550b02c666fdf0c62264cc1f96beaaa3d39
vt-vl-lab/video-data-aug
tools/data/parse_file_list.py
[ "Apache-2.0" ]
Python
line_to_map
<not_specific>
def line_to_map(line): """A function to map line string to vid and label. Args: line (str): A long directory path, which is a text path. Returns: tuple[str, str]: (vid, label), vid is the video id, label is the video label. """ items = li...
A function to map line string to vid and label. Args: line (str): A long directory path, which is a text path. Returns: tuple[str, str]: (vid, label), vid is the video id, label is the video label.
A function to map line string to vid and label.
[ "A", "function", "to", "map", "line", "string", "to", "vid", "and", "label", "." ]
def line_to_map(line): items = line.strip().split() vid = osp.splitext(items[0])[0] if level == 1: vid = osp.basename(vid) label = items[0] elif level == 2: vid = osp.join(osp.basename(osp.dirname(vid)), osp.basename(vid)) label = class_map...
[ "def", "line_to_map", "(", "line", ")", ":", "items", "=", "line", ".", "strip", "(", ")", ".", "split", "(", ")", "vid", "=", "osp", ".", "splitext", "(", "items", "[", "0", "]", ")", "[", "0", "]", "if", "level", "==", "1", ":", "vid", "=",...
A function to map line string to vid and label.
[ "A", "function", "to", "map", "line", "string", "to", "vid", "and", "label", "." ]
[ "\"\"\"A function to map line string to vid and label.\n\n Args:\n line (str): A long directory path, which is a text path.\n\n Returns:\n tuple[str, str]: (vid, label), vid is the video id,\n label is the video label.\n \"\"\"" ]
[ { "param": "line", "type": null } ]
{ "returns": [ { "docstring": "(vid, label), vid is the video id,\nlabel is the video label.", "docstring_tokens": [ "(", "vid", "label", ")", "vid", "is", "the", "video", "id", "label", "is", "the", ...
49da8550b02c666fdf0c62264cc1f96beaaa3d39
vt-vl-lab/video-data-aug
tools/data/parse_file_list.py
[ "Apache-2.0" ]
Python
generate_class_index_file
null
def generate_class_index_file(): """This function will generate a `ClassInd.txt` for HMDB51 in a format like UCF101, where class id starts with 1.""" frame_path = 'data/hmdb51/rawframes' annotation_dir = 'data/hmdb51/annotations' class_list = sorted(os.listdir(frame_path)) ...
This function will generate a `ClassInd.txt` for HMDB51 in a format like UCF101, where class id starts with 1.
This function will generate a `ClassInd.txt` for HMDB51 in a format like UCF101, where class id starts with 1.
[ "This", "function", "will", "generate", "a", "`", "ClassInd", ".", "txt", "`", "for", "HMDB51", "in", "a", "format", "like", "UCF101", "where", "class", "id", "starts", "with", "1", "." ]
def generate_class_index_file(): frame_path = 'data/hmdb51/rawframes' annotation_dir = 'data/hmdb51/annotations' class_list = sorted(os.listdir(frame_path)) class_dict = dict() with open(class_index_file, 'w') as f: content = [] for class_id, class_name in...
[ "def", "generate_class_index_file", "(", ")", ":", "frame_path", "=", "'data/hmdb51/rawframes'", "annotation_dir", "=", "'data/hmdb51/annotations'", "class_list", "=", "sorted", "(", "os", ".", "listdir", "(", "frame_path", ")", ")", "class_dict", "=", "dict", "(", ...
This function will generate a `ClassInd.txt` for HMDB51 in a format like UCF101, where class id starts with 1.
[ "This", "function", "will", "generate", "a", "`", "ClassInd", ".", "txt", "`", "for", "HMDB51", "in", "a", "format", "like", "UCF101", "where", "class", "id", "starts", "with", "1", "." ]
[ "\"\"\"This function will generate a `ClassInd.txt` for HMDB51 in a format\n like UCF101, where class id starts with 1.\"\"\"", "# like `ClassInd.txt` in UCF-101, the class_id begins with 1" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
3eb8b3a0751a8e062c886655c0a0bfc1f84b264b
monarrk/python-audio-synth
pysynth/output/modules.py
[ "MIT" ]
Python
add_converter
null
def add_converter(self, conv): """ Adds the given converter to the output module. The converter MUST inherit BaseConverter, or an exception will be raised. :param conv: Converter to add :type conv: BaseConverter """ # Check if the converter inherits Ba...
Adds the given converter to the output module. The converter MUST inherit BaseConverter, or an exception will be raised. :param conv: Converter to add :type conv: BaseConverter
Adds the given converter to the output module. The converter MUST inherit BaseConverter, or an exception will be raised.
[ "Adds", "the", "given", "converter", "to", "the", "output", "module", ".", "The", "converter", "MUST", "inherit", "BaseConverter", "or", "an", "exception", "will", "be", "raised", "." ]
def add_converter(self, conv): assert isinstance(conv, BaseConverter), "Converter MUST inherit BaseConverter!" self.convert = conv
[ "def", "add_converter", "(", "self", ",", "conv", ")", ":", "assert", "isinstance", "(", "conv", ",", "BaseConverter", ")", ",", "\"Converter MUST inherit BaseConverter!\"", "self", ".", "convert", "=", "conv" ]
Adds the given converter to the output module.
[ "Adds", "the", "given", "converter", "to", "the", "output", "module", "." ]
[ "\"\"\"\n Adds the given converter to the output module.\n\n The converter MUST inherit BaseConverter,\n or an exception will be raised.\n\n :param conv: Converter to add\n :type conv: BaseConverter\n \"\"\"", "# Check if the converter inherits BaseConverter", "# Otherw...
[ { "param": "self", "type": null }, { "param": "conv", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "conv", "type": null, "docstring": "Converter to add", "docstr...
3eb8b3a0751a8e062c886655c0a0bfc1f84b264b
monarrk/python-audio-synth
pysynth/output/modules.py
[ "MIT" ]
Python
add_input
null
def add_input(self, inp): """ Adds the given input to the audio queue. This probably should only be called by 'Output', but if developers has a use for adding values, and can properly handle any issues that may arise, then it should be okay to do so. :param inp...
Adds the given input to the audio queue. This probably should only be called by 'Output', but if developers has a use for adding values, and can properly handle any issues that may arise, then it should be okay to do so. :param inp: Input to add to the queue :t...
Adds the given input to the audio queue. This probably should only be called by 'Output', but if developers has a use for adding values, and can properly handle any issues that may arise, then it should be okay to do so.
[ "Adds", "the", "given", "input", "to", "the", "audio", "queue", ".", "This", "probably", "should", "only", "be", "called", "by", "'", "Output", "'", "but", "if", "developers", "has", "a", "use", "for", "adding", "values", "and", "can", "properly", "handl...
def add_input(self, inp): self.queue.put(inp)
[ "def", "add_input", "(", "self", ",", "inp", ")", ":", "self", ".", "queue", ".", "put", "(", "inp", ")" ]
Adds the given input to the audio queue.
[ "Adds", "the", "given", "input", "to", "the", "audio", "queue", "." ]
[ "\"\"\"\n Adds the given input to the audio queue.\n\n This probably should only be called by 'Output',\n but if developers has a use for adding values,\n and can properly handle any issues that may arise,\n then it should be okay to do so.\n\n :param inp: Input to add to t...
[ { "param": "self", "type": null }, { "param": "inp", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "inp", "type": null, "docstring": "Input to add to the queue", ...
3eb8b3a0751a8e062c886655c0a0bfc1f84b264b
monarrk/python-audio-synth
pysynth/output/modules.py
[ "MIT" ]
Python
run
null
def run(self): """ This function will be invoked by the Output class. This function should be dedicated to outputting information to a certain location. 'run' will be given it's own thread to work in, so if operations are blocking, then it will not interfere with other operatio...
This function will be invoked by the Output class. This function should be dedicated to outputting information to a certain location. 'run' will be given it's own thread to work in, so if operations are blocking, then it will not interfere with other operations. The child clas...
This function will be invoked by the Output class. This function should be dedicated to outputting information to a certain location. 'run' will be given it's own thread to work in, so if operations are blocking, then it will not interfere with other operations. The child class should overload this function, and defin...
[ "This", "function", "will", "be", "invoked", "by", "the", "Output", "class", ".", "This", "function", "should", "be", "dedicated", "to", "outputting", "information", "to", "a", "certain", "location", ".", "'", "run", "'", "will", "be", "given", "it", "'", ...
def run(self): raise NotImplementedError("Child classes should implement this function!")
[ "def", "run", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "\"Child classes should implement this function!\"", ")" ]
This function will be invoked by the Output class.
[ "This", "function", "will", "be", "invoked", "by", "the", "Output", "class", "." ]
[ "\"\"\"\n This function will be invoked by the Output class.\n\n This function should be dedicated to outputting information to a certain location.\n 'run' will be given it's own thread to work in, so if operations are blocking,\n then it will not interfere with other operations.\n\n ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3eb8b3a0751a8e062c886655c0a0bfc1f84b264b
monarrk/python-audio-synth
pysynth/output/modules.py
[ "MIT" ]
Python
run
null
def run(self): """ Just like the name, we simply do nothing with our audio! """ while self.running: # Get an item, and do nothing! inp = self.get_input()
Just like the name, we simply do nothing with our audio!
Just like the name, we simply do nothing with our audio!
[ "Just", "like", "the", "name", "we", "simply", "do", "nothing", "with", "our", "audio!" ]
def run(self): while self.running: inp = self.get_input()
[ "def", "run", "(", "self", ")", ":", "while", "self", ".", "running", ":", "inp", "=", "self", ".", "get_input", "(", ")" ]
Just like the name, we simply do nothing with our audio!
[ "Just", "like", "the", "name", "we", "simply", "do", "nothing", "with", "our", "audio!" ]
[ "\"\"\"\n Just like the name,\n we simply do nothing with our audio!\n \"\"\"", "# Get an item, and do nothing!" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3eb8b3a0751a8e062c886655c0a0bfc1f84b264b
monarrk/python-audio-synth
pysynth/output/modules.py
[ "MIT" ]
Python
run
null
def run(self): """ We print the information from the input to the terminal. We do this using the 'print' command. """ while self.running: # Get and print info: print(self.get_input())
We print the information from the input to the terminal. We do this using the 'print' command.
We print the information from the input to the terminal. We do this using the 'print' command.
[ "We", "print", "the", "information", "from", "the", "input", "to", "the", "terminal", ".", "We", "do", "this", "using", "the", "'", "print", "'", "command", "." ]
def run(self): while self.running: print(self.get_input())
[ "def", "run", "(", "self", ")", ":", "while", "self", ".", "running", ":", "print", "(", "self", ".", "get_input", "(", ")", ")" ]
We print the information from the input to the terminal.
[ "We", "print", "the", "information", "from", "the", "input", "to", "the", "terminal", "." ]
[ "\"\"\"\n We print the information from the input to the terminal.\n\n We do this using the 'print' command.\n \"\"\"", "# Get and print info:" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3eb8b3a0751a8e062c886655c0a0bfc1f84b264b
monarrk/python-audio-synth
pysynth/output/modules.py
[ "MIT" ]
Python
run
null
def run(self): """ Main run method for WaveModule. We get a certain number of frames, dependant on our frames per buffer, and then output them to the wave file. """ while self.running: # Get a certain number of frames: frames = self.get_added_...
Main run method for WaveModule. We get a certain number of frames, dependant on our frames per buffer, and then output them to the wave file.
Main run method for WaveModule. We get a certain number of frames, dependant on our frames per buffer, and then output them to the wave file.
[ "Main", "run", "method", "for", "WaveModule", ".", "We", "get", "a", "certain", "number", "of", "frames", "dependant", "on", "our", "frames", "per", "buffer", "and", "then", "output", "them", "to", "the", "wave", "file", "." ]
def run(self): while self.running: frames = self.get_added_inputs(self.frames_per_buffer) self.file.writeframes(frames)
[ "def", "run", "(", "self", ")", ":", "while", "self", ".", "running", ":", "frames", "=", "self", ".", "get_added_inputs", "(", "self", ".", "frames_per_buffer", ")", "self", ".", "file", ".", "writeframes", "(", "frames", ")" ]
Main run method for WaveModule.
[ "Main", "run", "method", "for", "WaveModule", "." ]
[ "\"\"\"\n Main run method for WaveModule.\n\n We get a certain number of frames, dependant on our frames per buffer,\n and then output them to the wave file.\n \"\"\"", "# Get a certain number of frames:", "# Output them to the wave file:" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3eb8b3a0751a8e062c886655c0a0bfc1f84b264b
monarrk/python-audio-synth
pysynth/output/modules.py
[ "MIT" ]
Python
start
null
def start(self): """ We configure and set up the audio stream here. """ # Set up the stream: self.stream = self.pyaudio.open(format=self.format, channels=1, output=True, ...
We configure and set up the audio stream here.
We configure and set up the audio stream here.
[ "We", "configure", "and", "set", "up", "the", "audio", "stream", "here", "." ]
def start(self): self.stream = self.pyaudio.open(format=self.format, channels=1, output=True, rate=self.out.rate, output_device_index=self.device)
[ "def", "start", "(", "self", ")", ":", "self", ".", "stream", "=", "self", ".", "pyaudio", ".", "open", "(", "format", "=", "self", ".", "format", ",", "channels", "=", "1", ",", "output", "=", "True", ",", "rate", "=", "self", ".", "out", ".", ...
We configure and set up the audio stream here.
[ "We", "configure", "and", "set", "up", "the", "audio", "stream", "here", "." ]
[ "\"\"\"\n We configure and set up the audio stream here.\n \"\"\"", "# Set up the stream:", "#frames_per_buffer=self.frames_per_buffer," ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3eb8b3a0751a8e062c886655c0a0bfc1f84b264b
monarrk/python-audio-synth
pysynth/output/modules.py
[ "MIT" ]
Python
stop
null
def stop(self): """ We stop the PyAudio stream. """ self.stream.stop_stream()
We stop the PyAudio stream.
We stop the PyAudio stream.
[ "We", "stop", "the", "PyAudio", "stream", "." ]
def stop(self): self.stream.stop_stream()
[ "def", "stop", "(", "self", ")", ":", "self", ".", "stream", ".", "stop_stream", "(", ")" ]
We stop the PyAudio stream.
[ "We", "stop", "the", "PyAudio", "stream", "." ]
[ "\"\"\"\n We stop the PyAudio stream.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3eb8b3a0751a8e062c886655c0a0bfc1f84b264b
monarrk/python-audio-synth
pysynth/output/modules.py
[ "MIT" ]
Python
run
null
def run(self): """ Main run method, we grab a number of frames and write them. """ print("We are running!") while self.running: # Get a certain number of frames: frames = self.get_added_inputs(self.frames_per_buffer) # Send them t...
Main run method, we grab a number of frames and write them.
Main run method, we grab a number of frames and write them.
[ "Main", "run", "method", "we", "grab", "a", "number", "of", "frames", "and", "write", "them", "." ]
def run(self): print("We are running!") while self.running: frames = self.get_added_inputs(self.frames_per_buffer) self.stream.write(frames)
[ "def", "run", "(", "self", ")", ":", "print", "(", "\"We are running!\"", ")", "while", "self", ".", "running", ":", "frames", "=", "self", ".", "get_added_inputs", "(", "self", ".", "frames_per_buffer", ")", "self", ".", "stream", ".", "write", "(", "fr...
Main run method, we grab a number of frames and write them.
[ "Main", "run", "method", "we", "grab", "a", "number", "of", "frames", "and", "write", "them", "." ]
[ "\"\"\"\n Main run method,\n we grab a number of frames and write them.\n \"\"\"", "# Get a certain number of frames:", "# Send them to PyAudio", "#print(\"Time py: {}\".format(get_time()-start))" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
01ed98c388c51c6316330895657c2c8141d01b77
monarrk/python-audio-synth
pysynth/wrappers/midi/alsa/base.py
[ "MIT" ]
Python
start
null
def start(self): """ Starts the connection to ALSA. We allow the C wrappers to take over this operation. """ self.midi_alsa.midi_open() self.midi_alsa.midi_read.restype = ctypes.c_void_p
Starts the connection to ALSA. We allow the C wrappers to take over this operation.
Starts the connection to ALSA. We allow the C wrappers to take over this operation.
[ "Starts", "the", "connection", "to", "ALSA", ".", "We", "allow", "the", "C", "wrappers", "to", "take", "over", "this", "operation", "." ]
def start(self): self.midi_alsa.midi_open() self.midi_alsa.midi_read.restype = ctypes.c_void_p
[ "def", "start", "(", "self", ")", ":", "self", ".", "midi_alsa", ".", "midi_open", "(", ")", "self", ".", "midi_alsa", ".", "midi_read", ".", "restype", "=", "ctypes", ".", "c_void_p" ]
Starts the connection to ALSA.
[ "Starts", "the", "connection", "to", "ALSA", "." ]
[ "\"\"\"\n Starts the connection to ALSA.\n\n We allow the C wrappers to take over this operation.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
01ed98c388c51c6316330895657c2c8141d01b77
monarrk/python-audio-synth
pysynth/wrappers/midi/alsa/base.py
[ "MIT" ]
Python
run
null
def run(self): """ Continuosly pull MIDI events from ALSA and handle them. In this case, we just print them. """ while True: # Get a value from ALSA: val = self.midi_alsa.midi_read() # Convert it into a MIDI event: event = AL...
Continuosly pull MIDI events from ALSA and handle them. In this case, we just print them.
Continuosly pull MIDI events from ALSA and handle them. In this case, we just print them.
[ "Continuosly", "pull", "MIDI", "events", "from", "ALSA", "and", "handle", "them", ".", "In", "this", "case", "we", "just", "print", "them", "." ]
def run(self): while True: val = self.midi_alsa.midi_read() event = ALSAEvent.from_address(val) if event.type not in type_map.keys(): continue pack = type_map[event.type].from_object(event) self.decoder.decode(pack)
[ "def", "run", "(", "self", ")", ":", "while", "True", ":", "val", "=", "self", ".", "midi_alsa", ".", "midi_read", "(", ")", "event", "=", "ALSAEvent", ".", "from_address", "(", "val", ")", "if", "event", ".", "type", "not", "in", "type_map", ".", ...
Continuosly pull MIDI events from ALSA and handle them.
[ "Continuosly", "pull", "MIDI", "events", "from", "ALSA", "and", "handle", "them", "." ]
[ "\"\"\"\n Continuosly pull MIDI events from ALSA and handle them.\n\n In this case, we just print them.\n \"\"\"", "# Get a value from ALSA:", "# Convert it into a MIDI event:", "# Junk event, let's continue", "# Lets decode it using our type_map:", "# Send it along to the decoder:" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1211c4b83859556f93848b487abf3739a1bd7734
monarrk/python-audio-synth
pysynth/output/base.py
[ "MIT" ]
Python
stop
null
def stop(self): """ Stop method - A polite way of stopping this control instance! This function prepares this instance to stop, but does not actually do so until all modules are ready to stop. This allows features like fade outs, echos, and amplitude envelopes to conti...
Stop method - A polite way of stopping this control instance! This function prepares this instance to stop, but does not actually do so until all modules are ready to stop. This allows features like fade outs, echos, and amplitude envelopes to continue to operate even after th...
Stop method - A polite way of stopping this control instance. This function prepares this instance to stop, but does not actually do so until all modules are ready to stop. This allows features like fade outs, echos, and amplitude envelopes to continue to operate even after this instance is asked to stop. Once all mo...
[ "Stop", "method", "-", "A", "polite", "way", "of", "stopping", "this", "control", "instance", ".", "This", "function", "prepares", "this", "instance", "to", "stop", "but", "does", "not", "actually", "do", "so", "until", "all", "modules", "are", "ready", "t...
def stop(self): self.done() self.input.finish_modules() self.finishing = True
[ "def", "stop", "(", "self", ")", ":", "self", ".", "done", "(", ")", "self", ".", "input", ".", "finish_modules", "(", ")", "self", ".", "finishing", "=", "True" ]
Stop method - A polite way of stopping this control instance!
[ "Stop", "method", "-", "A", "polite", "way", "of", "stopping", "this", "control", "instance!" ]
[ "\"\"\"\n Stop method - A polite way of stopping this control instance!\n\n This function prepares this instance to stop,\n but does not actually do so until all modules are ready to stop.\n\n This allows features like fade outs, echos, and amplitude envelopes\n to continue to ope...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1211c4b83859556f93848b487abf3739a1bd7734
monarrk/python-audio-synth
pysynth/output/base.py
[ "MIT" ]
Python
abs_stop
null
def abs_stop(self): """ Absolute stop - Completely stops this control instance! When called, we remove ourselves from the OutputHandler, reset our state, and stop the synth chain. This function ignores time events and finish status! Thats great for immediately stopping...
Absolute stop - Completely stops this control instance! When called, we remove ourselves from the OutputHandler, reset our state, and stop the synth chain. This function ignores time events and finish status! Thats great for immediately stopping this synth chain, but n...
Absolute stop - Completely stops this control instance. When called, we remove ourselves from the OutputHandler, reset our state, and stop the synth chain. This function ignores time events and finish status. Thats great for immediately stopping this synth chain, but not that great if you are expecting modules to fini...
[ "Absolute", "stop", "-", "Completely", "stops", "this", "control", "instance", ".", "When", "called", "we", "remove", "ourselves", "from", "the", "OutputHandler", "reset", "our", "state", "and", "stop", "the", "synth", "chain", ".", "This", "function", "ignore...
def abs_stop(self): if self.info.running: print("Removing ourselves from output hand") self.OUT[0]._remove_synth(self) self.item_written = 0 self.time_events.clear() self.input.stop_modules() self.started = False self.finishing ...
[ "def", "abs_stop", "(", "self", ")", ":", "if", "self", ".", "info", ".", "running", ":", "print", "(", "\"Removing ourselves from output hand\"", ")", "self", ".", "OUT", "[", "0", "]", ".", "_remove_synth", "(", "self", ")", "self", ".", "item_written", ...
Absolute stop - Completely stops this control instance!
[ "Absolute", "stop", "-", "Completely", "stops", "this", "control", "instance!" ]
[ "\"\"\"\n Absolute stop - Completely stops this control instance!\n\n When called, we remove ourselves from the OutputHandler,\n reset our state, and stop the synth chain.\n\n This function ignores time events and finish status!\n Thats great for immediately stopping this synth ch...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1211c4b83859556f93848b487abf3739a1bd7734
monarrk/python-audio-synth
pysynth/output/base.py
[ "MIT" ]
Python
join
<not_specific>
def join(self): """ Blocks until the OutputControl is removed from OutputHandler. """ while self.started: continue return
Blocks until the OutputControl is removed from OutputHandler.
Blocks until the OutputControl is removed from OutputHandler.
[ "Blocks", "until", "the", "OutputControl", "is", "removed", "from", "OutputHandler", "." ]
def join(self): while self.started: continue return
[ "def", "join", "(", "self", ")", ":", "while", "self", ".", "started", ":", "continue", "return" ]
Blocks until the OutputControl is removed from OutputHandler.
[ "Blocks", "until", "the", "OutputControl", "is", "removed", "from", "OutputHandler", "." ]
[ "\"\"\"\n Blocks until the OutputControl is removed from OutputHandler.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1211c4b83859556f93848b487abf3739a1bd7734
monarrk/python-audio-synth
pysynth/output/base.py
[ "MIT" ]
Python
write_num
null
def write_num(self, num): """ Registers ourselves to the OutputHandler for a number of iterations. :param num: Number of values to write :type num: int """ # Set the max write limit: self.item_written = num # Start ourselves: self.start()
Registers ourselves to the OutputHandler for a number of iterations. :param num: Number of values to write :type num: int
Registers ourselves to the OutputHandler for a number of iterations.
[ "Registers", "ourselves", "to", "the", "OutputHandler", "for", "a", "number", "of", "iterations", "." ]
def write_num(self, num): self.item_written = num self.start()
[ "def", "write_num", "(", "self", ",", "num", ")", ":", "self", ".", "item_written", "=", "num", "self", ".", "start", "(", ")" ]
Registers ourselves to the OutputHandler for a number of iterations.
[ "Registers", "ourselves", "to", "the", "OutputHandler", "for", "a", "number", "of", "iterations", "." ]
[ "\"\"\"\n Registers ourselves to the OutputHandler for a number of iterations.\n\n :param num: Number of values to write\n :type num: int\n \"\"\"", "# Set the max write limit:", "# Start ourselves:" ]
[ { "param": "self", "type": null }, { "param": "num", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "num", "type": null, "docstring": "Number of values to write", ...
1211c4b83859556f93848b487abf3739a1bd7734
monarrk/python-audio-synth
pysynth/output/base.py
[ "MIT" ]
Python
time_event
null
def time_event(self, start, stop): """ Schedules a time event for this OutputControl instance. Time events allows us to add and remove ourselves during certain intervals. 'start' determines the time to start this object. We will not return audio values until the value from 'ge...
Schedules a time event for this OutputControl instance. Time events allows us to add and remove ourselves during certain intervals. 'start' determines the time to start this object. We will not return audio values until the value from 'get_time()' is less than or equal to this...
Schedules a time event for this OutputControl instance. Time events allows us to add and remove ourselves during certain intervals. 'start' determines the time to start this object. We will not return audio values until the value from 'get_time()' is less than or equal to this value. If you want this object to start i...
[ "Schedules", "a", "time", "event", "for", "this", "OutputControl", "instance", ".", "Time", "events", "allows", "us", "to", "add", "and", "remove", "ourselves", "during", "certain", "intervals", ".", "'", "start", "'", "determines", "the", "time", "to", "sta...
def time_event(self, start, stop): self.time_events.append([start, stop])
[ "def", "time_event", "(", "self", ",", "start", ",", "stop", ")", ":", "self", ".", "time_events", ".", "append", "(", "[", "start", ",", "stop", "]", ")" ]
Schedules a time event for this OutputControl instance.
[ "Schedules", "a", "time", "event", "for", "this", "OutputControl", "instance", "." ]
[ "\"\"\"\n Schedules a time event for this OutputControl instance.\n\n Time events allows us to add and remove ourselves during certain intervals.\n\n 'start' determines the time to start this object.\n We will not return audio values until the value from 'get_time()'\n is less tha...
[ { "param": "self", "type": null }, { "param": "start", "type": null }, { "param": "stop", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "start", "type": null, "docstring": null, "docstring_tokens": ...
1211c4b83859556f93848b487abf3739a1bd7734
monarrk/python-audio-synth
pysynth/output/base.py
[ "MIT" ]
Python
_event_done
<not_specific>
def _event_done(self): """ Method called when we have processed a time event (Passed start and stop times). We will determine if we should remove ourselves completely from OutputHandler. If these are more events in the 'time_events' list, then we will remain added, as w...
Method called when we have processed a time event (Passed start and stop times). We will determine if we should remove ourselves completely from OutputHandler. If these are more events in the 'time_events' list, then we will remain added, as we will eventually start ourselves. ...
Method called when we have processed a time event (Passed start and stop times). We will determine if we should remove ourselves completely from OutputHandler. If these are more events in the 'time_events' list, then we will remain added, as we will eventually start ourselves.
[ "Method", "called", "when", "we", "have", "processed", "a", "time", "event", "(", "Passed", "start", "and", "stop", "times", ")", ".", "We", "will", "determine", "if", "we", "should", "remove", "ourselves", "completely", "from", "OutputHandler", ".", "If", ...
def _event_done(self): if self.time_events: return self.abs_stop()
[ "def", "_event_done", "(", "self", ")", ":", "if", "self", ".", "time_events", ":", "return", "self", ".", "abs_stop", "(", ")" ]
Method called when we have processed a time event (Passed start and stop times).
[ "Method", "called", "when", "we", "have", "processed", "a", "time", "event", "(", "Passed", "start", "and", "stop", "times", ")", "." ]
[ "\"\"\"\n Method called when we have processed a time event\n (Passed start and stop times).\n\n We will determine if we should remove ourselves completely from OutputHandler.\n If these are more events in the 'time_events' list,\n then we will remain added, as we will eventually ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1211c4b83859556f93848b487abf3739a1bd7734
monarrk/python-audio-synth
pysynth/output/base.py
[ "MIT" ]
Python
add_output
null
def add_output(self, out): """ Adds an output module to this class. We ensure it inherits BaseModule, and then we add it. If we are currently running, then we start it and add it to the thread pool executor. If we are not started, then we will wait to add the modules ...
Adds an output module to this class. We ensure it inherits BaseModule, and then we add it. If we are currently running, then we start it and add it to the thread pool executor. If we are not started, then we will wait to add the modules until we have been. :param out...
Adds an output module to this class. We ensure it inherits BaseModule, and then we add it. If we are currently running, then we start it and add it to the thread pool executor. If we are not started, then we will wait to add the modules until we have been.
[ "Adds", "an", "output", "module", "to", "this", "class", ".", "We", "ensure", "it", "inherits", "BaseModule", "and", "then", "we", "add", "it", ".", "If", "we", "are", "currently", "running", "then", "we", "start", "it", "and", "add", "it", "to", "the"...
def add_output(self, out): assert isinstance(out, BaseOutput), "Class must inherit BaseOutput!" out.out = self if self.run: self._submit_module(out) self._output.append(out)
[ "def", "add_output", "(", "self", ",", "out", ")", ":", "assert", "isinstance", "(", "out", ",", "BaseOutput", ")", ",", "\"Class must inherit BaseOutput!\"", "out", ".", "out", "=", "self", "if", "self", ".", "run", ":", "self", ".", "_submit_module", "("...
Adds an output module to this class.
[ "Adds", "an", "output", "module", "to", "this", "class", "." ]
[ "\"\"\"\n Adds an output module to this class.\n\n We ensure it inherits BaseModule, and then we add it.\n\n If we are currently running,\n then we start it and add it to the thread pool executor.\n\n If we are not started, then we will wait to add the modules until we have been.\...
[ { "param": "self", "type": null }, { "param": "out", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "out", "type": null, "docstring": "Output modules to add", "do...
1211c4b83859556f93848b487abf3739a1bd7734
monarrk/python-audio-synth
pysynth/output/base.py
[ "MIT" ]
Python
bind_synth
<not_specific>
def bind_synth(self, synth): """ Binds a synth chain to the Output class. We return an OutputControl class to manage adding the synth to this class. This allows synths to be managed by a sequencer, or for them to be added for a specified amount of time. We will bind th...
Binds a synth chain to the Output class. We return an OutputControl class to manage adding the synth to this class. This allows synths to be managed by a sequencer, or for them to be added for a specified amount of time. We will bind the synth chain to the OutputControl class,...
Binds a synth chain to the Output class. We return an OutputControl class to manage adding the synth to this class. This allows synths to be managed by a sequencer, or for them to be added for a specified amount of time. We will bind the synth chain to the OutputControl class, and return it. We also set the sampling ...
[ "Binds", "a", "synth", "chain", "to", "the", "Output", "class", ".", "We", "return", "an", "OutputControl", "class", "to", "manage", "adding", "the", "synth", "to", "this", "class", ".", "This", "allows", "synths", "to", "be", "managed", "by", "a", "sequ...
def bind_synth(self, synth): out = OutputControl() out.OUT.append(self) out.bind(synth) synth._info.samp = self.rate return out
[ "def", "bind_synth", "(", "self", ",", "synth", ")", ":", "out", "=", "OutputControl", "(", ")", "out", ".", "OUT", ".", "append", "(", "self", ")", "out", ".", "bind", "(", "synth", ")", "synth", ".", "_info", ".", "samp", "=", "self", ".", "rat...
Binds a synth chain to the Output class.
[ "Binds", "a", "synth", "chain", "to", "the", "Output", "class", "." ]
[ "\"\"\"\n Binds a synth chain to the Output class.\n\n We return an OutputControl class to manage adding the synth to this class.\n This allows synths to be managed by a sequencer,\n or for them to be added for a specified amount of time.\n\n We will bind the synth chain to the Ou...
[ { "param": "self", "type": null }, { "param": "synth", "type": null } ]
{ "returns": [ { "docstring": "OutputControl with the synth chain bound to it", "docstring_tokens": [ "OutputControl", "with", "the", "synth", "chain", "bound", "to", "it" ], "type": "OutputControl" } ], "raises": [], ...
1211c4b83859556f93848b487abf3739a1bd7734
monarrk/python-audio-synth
pysynth/output/base.py
[ "MIT" ]
Python
start
null
def start(self): """ Starts the OutputHandler. This entails starting the output modules we have added, and creating a barrier to ensure all modules are synchronized in getting their values. We will start to consume audio information until we are stopped or paused. """ ...
Starts the OutputHandler. This entails starting the output modules we have added, and creating a barrier to ensure all modules are synchronized in getting their values. We will start to consume audio information until we are stopped or paused.
We will start to consume audio information until we are stopped or paused.
[ "We", "will", "start", "to", "consume", "audio", "information", "until", "we", "are", "stopped", "or", "paused", "." ]
def start(self): self.run = True self.barrier = threading.Barrier(len(self._output)) for mod in self._output: self._submit_module(mod)
[ "def", "start", "(", "self", ")", ":", "self", ".", "run", "=", "True", "self", ".", "barrier", "=", "threading", ".", "Barrier", "(", "len", "(", "self", ".", "_output", ")", ")", "for", "mod", "in", "self", ".", "_output", ":", "self", ".", "_s...
Starts the OutputHandler.
[ "Starts", "the", "OutputHandler", "." ]
[ "\"\"\"\n Starts the OutputHandler.\n\n This entails starting the output modules we have added,\n and creating a barrier to ensure all modules are synchronized in getting their values.\n\n We will start to consume audio information until we are stopped or paused.\n \"\"\"", "# S...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1211c4b83859556f93848b487abf3739a1bd7734
monarrk/python-audio-synth
pysynth/output/base.py
[ "MIT" ]
Python
stop
null
def stop(self): """ Stops the OutputHandler. This entails stopping all the output modules in our collection, and stopping the control thread that sends audio to the modules. Once stopped, the OutputHandler can be started again. However, some modules can't be restarted....
Stops the OutputHandler. This entails stopping all the output modules in our collection, and stopping the control thread that sends audio to the modules. Once stopped, the OutputHandler can be started again. However, some modules can't be restarted. So be prepared for ...
Once stopped, the OutputHandler can be started again. However, some modules can't be restarted. So be prepared for errors, or certain output modules not working.
[ "Once", "stopped", "the", "OutputHandler", "can", "be", "started", "again", ".", "However", "some", "modules", "can", "'", "t", "be", "restarted", ".", "So", "be", "prepared", "for", "errors", "or", "certain", "output", "modules", "not", "working", "." ]
def stop(self): self.run = False for mod in self._output: self._stop_module(mod)
[ "def", "stop", "(", "self", ")", ":", "self", ".", "run", "=", "False", "for", "mod", "in", "self", ".", "_output", ":", "self", ".", "_stop_module", "(", "mod", ")" ]
Stops the OutputHandler.
[ "Stops", "the", "OutputHandler", "." ]
[ "\"\"\"\n Stops the OutputHandler.\n\n This entails stopping all the output modules in our collection,\n and stopping the control thread that sends audio to the modules.\n\n Once stopped, the OutputHandler can be started again.\n However, some modules can't be restarted.\n ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1211c4b83859556f93848b487abf3739a1bd7734
monarrk/python-audio-synth
pysynth/output/base.py
[ "MIT" ]
Python
pause
null
def pause(self): """ Pauses the OutputHandler. We clear our pause event, which will cause the control thread to pause until it is unset. Audio information will not be consumed when paused! """ # Clear the event: self._pause.clear()
Pauses the OutputHandler. We clear our pause event, which will cause the control thread to pause until it is unset. Audio information will not be consumed when paused!
Audio information will not be consumed when paused!
[ "Audio", "information", "will", "not", "be", "consumed", "when", "paused!" ]
def pause(self): self._pause.clear()
[ "def", "pause", "(", "self", ")", ":", "self", ".", "_pause", ".", "clear", "(", ")" ]
Pauses the OutputHandler.
[ "Pauses", "the", "OutputHandler", "." ]
[ "\"\"\"\n Pauses the OutputHandler.\n\n We clear our pause event,\n which will cause the control thread to pause until it is unset.\n\n Audio information will not be consumed when paused!\n \"\"\"", "# Clear the event:" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1211c4b83859556f93848b487abf3739a1bd7734
monarrk/python-audio-synth
pysynth/output/base.py
[ "MIT" ]
Python
resume
null
def resume(self): """ Resumes the OutputHandler. We set out pause event, which will cause the control thread to continue. Audio information will be consumed when resumed! """ # Set the event: self._pause.set()
Resumes the OutputHandler. We set out pause event, which will cause the control thread to continue. Audio information will be consumed when resumed!
Audio information will be consumed when resumed!
[ "Audio", "information", "will", "be", "consumed", "when", "resumed!" ]
def resume(self): self._pause.set()
[ "def", "resume", "(", "self", ")", ":", "self", ".", "_pause", ".", "set", "(", ")" ]
Resumes the OutputHandler.
[ "Resumes", "the", "OutputHandler", "." ]
[ "\"\"\"\n Resumes the OutputHandler.\n\n We set out pause event,\n which will cause the control thread to continue.\n\n Audio information will be consumed when resumed!\n \"\"\"", "# Set the event:" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1211c4b83859556f93848b487abf3739a1bd7734
monarrk/python-audio-synth
pysynth/output/base.py
[ "MIT" ]
Python
gen_value
<not_specific>
def gen_value(self): """ Gets and sends the input from the synths to each output module. This allows audio information to be sampled only when it is necessary! Because modules block before getting information, all modules will be ready to receive information when this method is...
Gets and sends the input from the synths to each output module. This allows audio information to be sampled only when it is necessary! Because modules block before getting information, all modules will be ready to receive information when this method is called.
Gets and sends the input from the synths to each output module. This allows audio information to be sampled only when it is necessary. Because modules block before getting information, all modules will be ready to receive information when this method is called.
[ "Gets", "and", "sends", "the", "input", "from", "the", "synths", "to", "each", "output", "module", ".", "This", "allows", "audio", "information", "to", "be", "sampled", "only", "when", "it", "is", "necessary", ".", "Because", "modules", "block", "before", ...
def gen_value(self): while True: self._pause.wait() inp = next(self._input) if inp is None: continue for mod in self._output: if mod.special: continue mod.add_input(inp) return inp
[ "def", "gen_value", "(", "self", ")", ":", "while", "True", ":", "self", ".", "_pause", ".", "wait", "(", ")", "inp", "=", "next", "(", "self", ".", "_input", ")", "if", "inp", "is", "None", ":", "continue", "for", "mod", "in", "self", ".", "_out...
Gets and sends the input from the synths to each output module.
[ "Gets", "and", "sends", "the", "input", "from", "the", "synths", "to", "each", "output", "module", "." ]
[ "\"\"\"\n Gets and sends the input from the synths to each output module.\n\n This allows audio information to be sampled only when it is necessary!\n Because modules block before getting information,\n all modules will be ready to receive information when this method is called.\n ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1211c4b83859556f93848b487abf3739a1bd7734
monarrk/python-audio-synth
pysynth/output/base.py
[ "MIT" ]
Python
_add_synth
null
def _add_synth(self, synth): """ Adds a synth to the AudioCollection. This should really only be called by OutputControl, as they have the ability to fine-tune the operation. :param synth: Synth to be added to the Output class :type synth: BaseModule """ ...
Adds a synth to the AudioCollection. This should really only be called by OutputControl, as they have the ability to fine-tune the operation. :param synth: Synth to be added to the Output class :type synth: BaseModule
Adds a synth to the AudioCollection. This should really only be called by OutputControl, as they have the ability to fine-tune the operation.
[ "Adds", "a", "synth", "to", "the", "AudioCollection", ".", "This", "should", "really", "only", "be", "called", "by", "OutputControl", "as", "they", "have", "the", "ability", "to", "fine", "-", "tune", "the", "operation", "." ]
def _add_synth(self, synth): print("Added synth: {}".format(synth)) self._input.add_module(synth)
[ "def", "_add_synth", "(", "self", ",", "synth", ")", ":", "print", "(", "\"Added synth: {}\"", ".", "format", "(", "synth", ")", ")", "self", ".", "_input", ".", "add_module", "(", "synth", ")" ]
Adds a synth to the AudioCollection.
[ "Adds", "a", "synth", "to", "the", "AudioCollection", "." ]
[ "\"\"\"\n Adds a synth to the AudioCollection.\n\n This should really only be called by OutputControl,\n as they have the ability to fine-tune the operation.\n\n :param synth: Synth to be added to the Output class\n :type synth: BaseModule\n \"\"\"", "# Add the synth to o...
[ { "param": "self", "type": null }, { "param": "synth", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "synth", "type": null, "docstring": "Synth to be added to the Output...
1211c4b83859556f93848b487abf3739a1bd7734
monarrk/python-audio-synth
pysynth/output/base.py
[ "MIT" ]
Python
_remove_synth
null
def _remove_synth(self, synth): """ Removes a synth from the AudioCollection. This should really only be called by OutputControl, as they have the ability to fine-tune the operation. :param synth: Synth to be removed from the Output class :type synth: BaseModule ...
Removes a synth from the AudioCollection. This should really only be called by OutputControl, as they have the ability to fine-tune the operation. :param synth: Synth to be removed from the Output class :type synth: BaseModule
Removes a synth from the AudioCollection. This should really only be called by OutputControl, as they have the ability to fine-tune the operation.
[ "Removes", "a", "synth", "from", "the", "AudioCollection", ".", "This", "should", "really", "only", "be", "called", "by", "OutputControl", "as", "they", "have", "the", "ability", "to", "fine", "-", "tune", "the", "operation", "." ]
def _remove_synth(self, synth): self._input.remove_module(synth)
[ "def", "_remove_synth", "(", "self", ",", "synth", ")", ":", "self", ".", "_input", ".", "remove_module", "(", "synth", ")" ]
Removes a synth from the AudioCollection.
[ "Removes", "a", "synth", "from", "the", "AudioCollection", "." ]
[ "\"\"\"\n Removes a synth from the AudioCollection.\n\n This should really only be called by OutputControl,\n as they have the ability to fine-tune the operation.\n\n :param synth: Synth to be removed from the Output class\n :type synth: BaseModule\n \"\"\"", "# Remove th...
[ { "param": "self", "type": null }, { "param": "synth", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "synth", "type": null, "docstring": "Synth to be removed from the Ou...
1211c4b83859556f93848b487abf3739a1bd7734
monarrk/python-audio-synth
pysynth/output/base.py
[ "MIT" ]
Python
_submit_module
null
def _submit_module(self, mod): """ We do the dirty work of starting and submitting a module to the ThreadPoolExecutor. We assume the module inherits BaseOutput, and that it has been added to the module collection. If you wish to add a module, you should really use 'add_output'...
We do the dirty work of starting and submitting a module to the ThreadPoolExecutor. We assume the module inherits BaseOutput, and that it has been added to the module collection. If you wish to add a module, you should really use 'add_output'. :param mod: Output module to sta...
We do the dirty work of starting and submitting a module to the ThreadPoolExecutor. We assume the module inherits BaseOutput, and that it has been added to the module collection. If you wish to add a module, you should really use 'add_output'.
[ "We", "do", "the", "dirty", "work", "of", "starting", "and", "submitting", "a", "module", "to", "the", "ThreadPoolExecutor", ".", "We", "assume", "the", "module", "inherits", "BaseOutput", "and", "that", "it", "has", "been", "added", "to", "the", "module", ...
def _submit_module(self, mod): mod.running = True mod.start() thread = threading.Thread(target=mod.run) thread.daemon = True thread.start() self.thread.append(thread)
[ "def", "_submit_module", "(", "self", ",", "mod", ")", ":", "mod", ".", "running", "=", "True", "mod", ".", "start", "(", ")", "thread", "=", "threading", ".", "Thread", "(", "target", "=", "mod", ".", "run", ")", "thread", ".", "daemon", "=", "Tru...
We do the dirty work of starting and submitting a module to the ThreadPoolExecutor.
[ "We", "do", "the", "dirty", "work", "of", "starting", "and", "submitting", "a", "module", "to", "the", "ThreadPoolExecutor", "." ]
[ "\"\"\"\n We do the dirty work of starting and submitting a module to the ThreadPoolExecutor.\n\n We assume the module inherits BaseOutput,\n and that it has been added to the module collection.\n\n If you wish to add a module, you should really use 'add_output'.\n\n :param mod: O...
[ { "param": "self", "type": null }, { "param": "mod", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mod", "type": null, "docstring": "Output module to start", "d...
1211c4b83859556f93848b487abf3739a1bd7734
monarrk/python-audio-synth
pysynth/output/base.py
[ "MIT" ]
Python
_stop_module
null
def _stop_module(self, mod): """ Stops the given module. We call the 'stop' method, and set the running value to False. We also add None to the input queue. :param mod: Module to stop :type mod: BaseOutput """ # Set the run value: mod.running ...
Stops the given module. We call the 'stop' method, and set the running value to False. We also add None to the input queue. :param mod: Module to stop :type mod: BaseOutput
Stops the given module. We call the 'stop' method, and set the running value to False. We also add None to the input queue.
[ "Stops", "the", "given", "module", ".", "We", "call", "the", "'", "stop", "'", "method", "and", "set", "the", "running", "value", "to", "False", ".", "We", "also", "add", "None", "to", "the", "input", "queue", "." ]
def _stop_module(self, mod): mod.running = False mod.stop() mod.add_input(None)
[ "def", "_stop_module", "(", "self", ",", "mod", ")", ":", "mod", ".", "running", "=", "False", "mod", ".", "stop", "(", ")", "mod", ".", "add_input", "(", "None", ")" ]
Stops the given module.
[ "Stops", "the", "given", "module", "." ]
[ "\"\"\"\n Stops the given module.\n\n We call the 'stop' method, and set the running value to False.\n We also add None to the input queue.\n\n :param mod: Module to stop\n :type mod: BaseOutput\n \"\"\"", "# Set the run value:", "# Call the stop method:", "# Add 'Non...
[ { "param": "self", "type": null }, { "param": "mod", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mod", "type": null, "docstring": "Module to stop", "docstring...
7505832e5a6f3b134f70d9d9328e853467cb9c6e
monarrk/python-audio-synth
pysynth/wrappers/querty.py
[ "MIT" ]
Python
start
null
def start(self): """ We setup and configure the tkinter front end for getting keys. We also disable 'xset' on linux machines, which causes problems with how key inputs are configured. """ # Check if we are on linux: if platform.system() == 'Linux': ...
We setup and configure the tkinter front end for getting keys. We also disable 'xset' on linux machines, which causes problems with how key inputs are configured.
We setup and configure the tkinter front end for getting keys. We also disable 'xset' on linux machines, which causes problems with how key inputs are configured.
[ "We", "setup", "and", "configure", "the", "tkinter", "front", "end", "for", "getting", "keys", ".", "We", "also", "disable", "'", "xset", "'", "on", "linux", "machines", "which", "causes", "problems", "with", "how", "key", "inputs", "are", "configured", "....
def start(self): if platform.system() == 'Linux': os.system("xset r off") self.root = Tk() self.frame = Frame(self.root, width=100, height=100) self.frame.bind("<KeyPress>", self.decoder.key_pressed) self.frame.bind("<KeyRelease>", self.decoder.key_released) s...
[ "def", "start", "(", "self", ")", ":", "if", "platform", ".", "system", "(", ")", "==", "'Linux'", ":", "os", ".", "system", "(", "\"xset r off\"", ")", "self", ".", "root", "=", "Tk", "(", ")", "self", ".", "frame", "=", "Frame", "(", "self", "....
We setup and configure the tkinter front end for getting keys.
[ "We", "setup", "and", "configure", "the", "tkinter", "front", "end", "for", "getting", "keys", "." ]
[ "\"\"\"\n We setup and configure the tkinter front end for getting keys.\n\n We also disable 'xset' on linux machines,\n which causes problems with how key inputs are configured.\n \"\"\"", "# Check if we are on linux:", "# Disable 'xset'", "# Configure TKinter input window" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7505832e5a6f3b134f70d9d9328e853467cb9c6e
monarrk/python-audio-synth
pysynth/wrappers/querty.py
[ "MIT" ]
Python
stop
null
def stop(self): """ We stop the TKinter instance, and enable 'xset' if we are on linux. """ # Check if we are on linux: if platform.system() == 'Linux': # Disable 'xset' os.system("xset r on") # Disable the root instance: sel...
We stop the TKinter instance, and enable 'xset' if we are on linux.
We stop the TKinter instance, and enable 'xset' if we are on linux.
[ "We", "stop", "the", "TKinter", "instance", "and", "enable", "'", "xset", "'", "if", "we", "are", "on", "linux", "." ]
def stop(self): if platform.system() == 'Linux': os.system("xset r on") self.root.destroy()
[ "def", "stop", "(", "self", ")", ":", "if", "platform", ".", "system", "(", ")", "==", "'Linux'", ":", "os", ".", "system", "(", "\"xset r on\"", ")", "self", ".", "root", ".", "destroy", "(", ")" ]
We stop the TKinter instance, and enable 'xset' if we are on linux.
[ "We", "stop", "the", "TKinter", "instance", "and", "enable", "'", "xset", "'", "if", "we", "are", "on", "linux", "." ]
[ "\"\"\"\n We stop the TKinter instance,\n and enable 'xset' if we are on linux.\n \"\"\"", "# Check if we are on linux:", "# Disable 'xset'", "# Disable the root instance:" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7505832e5a6f3b134f70d9d9328e853467cb9c6e
monarrk/python-audio-synth
pysynth/wrappers/querty.py
[ "MIT" ]
Python
key_pressed
null
def key_pressed(self, key): """ Interprets the given key as being pressed down. We simply forward it to the decoder method for interpretation. This method is for QWERTYKeyboard callback support. :param key: Key that was pressed """ # Send the key to the decod...
Interprets the given key as being pressed down. We simply forward it to the decoder method for interpretation. This method is for QWERTYKeyboard callback support. :param key: Key that was pressed
Interprets the given key as being pressed down. We simply forward it to the decoder method for interpretation. This method is for QWERTYKeyboard callback support.
[ "Interprets", "the", "given", "key", "as", "being", "pressed", "down", ".", "We", "simply", "forward", "it", "to", "the", "decoder", "method", "for", "interpretation", ".", "This", "method", "is", "for", "QWERTYKeyboard", "callback", "support", "." ]
def key_pressed(self, key): self.decode(key.char, True)
[ "def", "key_pressed", "(", "self", ",", "key", ")", ":", "self", ".", "decode", "(", "key", ".", "char", ",", "True", ")" ]
Interprets the given key as being pressed down.
[ "Interprets", "the", "given", "key", "as", "being", "pressed", "down", "." ]
[ "\"\"\"\n Interprets the given key as being pressed down.\n\n We simply forward it to the decoder method for interpretation.\n\n This method is for QWERTYKeyboard callback support.\n\n :param key: Key that was pressed\n \"\"\"", "# Send the key to the decoder method:" ]
[ { "param": "self", "type": null }, { "param": "key", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "key", "type": null, "docstring": "Key that was pressed", "doc...
7505832e5a6f3b134f70d9d9328e853467cb9c6e
monarrk/python-audio-synth
pysynth/wrappers/querty.py
[ "MIT" ]
Python
key_released
null
def key_released(self, key): """ Interprets the given key as being released. We simply forward it to the decoder method for interpretation. This method is for QWERTYKeyboard callback support. :param key: Key that was released """ # Send the key to the decoder...
Interprets the given key as being released. We simply forward it to the decoder method for interpretation. This method is for QWERTYKeyboard callback support. :param key: Key that was released
Interprets the given key as being released. We simply forward it to the decoder method for interpretation. This method is for QWERTYKeyboard callback support.
[ "Interprets", "the", "given", "key", "as", "being", "released", ".", "We", "simply", "forward", "it", "to", "the", "decoder", "method", "for", "interpretation", ".", "This", "method", "is", "for", "QWERTYKeyboard", "callback", "support", "." ]
def key_released(self, key): self.decode(key.keysym, False)
[ "def", "key_released", "(", "self", ",", "key", ")", ":", "self", ".", "decode", "(", "key", ".", "keysym", ",", "False", ")" ]
Interprets the given key as being released.
[ "Interprets", "the", "given", "key", "as", "being", "released", "." ]
[ "\"\"\"\n Interprets the given key as being released.\n\n We simply forward it to the decoder method for interpretation.\n\n This method is for QWERTYKeyboard callback support.\n\n :param key: Key that was released\n \"\"\"", "# Send the key to the decoder method:" ]
[ { "param": "self", "type": null }, { "param": "key", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "key", "type": null, "docstring": "Key that was released", "do...
7505832e5a6f3b134f70d9d9328e853467cb9c6e
monarrk/python-audio-synth
pysynth/wrappers/querty.py
[ "MIT" ]
Python
decode
<not_specific>
def decode(self, key, pressed): """ We decode the given keys and convert them into instructions for the sequencer. We require a parameter to tell us if the key is being pressed or un-pressed. :param key: Key to be handled :type key str :param pressed: Determines if the...
We decode the given keys and convert them into instructions for the sequencer. We require a parameter to tell us if the key is being pressed or un-pressed. :param key: Key to be handled :type key str :param pressed: Determines if the key is being pressed or released :t...
We decode the given keys and convert them into instructions for the sequencer. We require a parameter to tell us if the key is being pressed or un-pressed.
[ "We", "decode", "the", "given", "keys", "and", "convert", "them", "into", "instructions", "for", "the", "sequencer", ".", "We", "require", "a", "parameter", "to", "tell", "us", "if", "the", "key", "is", "being", "pressed", "or", "un", "-", "pressed", "."...
def decode(self, key, pressed): if key in self.seq.notes: note = Note.from_num(self.seq.off - self.seq.notes.index(key)) if pressed: self.seq.start_note(note, name=self.instrument) return self.seq.stop_note(note, name=self.instrument) ...
[ "def", "decode", "(", "self", ",", "key", ",", "pressed", ")", ":", "if", "key", "in", "self", ".", "seq", ".", "notes", ":", "note", "=", "Note", ".", "from_num", "(", "self", ".", "seq", ".", "off", "-", "self", ".", "seq", ".", "notes", ".",...
We decode the given keys and convert them into instructions for the sequencer.
[ "We", "decode", "the", "given", "keys", "and", "convert", "them", "into", "instructions", "for", "the", "sequencer", "." ]
[ "\"\"\"\n We decode the given keys and convert them into instructions for the sequencer.\n\n We require a parameter to tell us if the key is being pressed or un-pressed.\n\n :param key: Key to be handled\n :type key str\n :param pressed: Determines if the key is being pressed or r...
[ { "param": "self", "type": null }, { "param": "key", "type": null }, { "param": "pressed", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "key", "type": null, "docstring": null, "docstring_tokens": []...
7505832e5a6f3b134f70d9d9328e853467cb9c6e
monarrk/python-audio-synth
pysynth/wrappers/querty.py
[ "MIT" ]
Python
load_keyboard
null
def load_keyboard(self): """ Loads the QWERTYKeyboard input module, used for getting live input from QWERTY keyboards. """ # Load QWERTYKeyboard: self.bind_input(QWERTYKeyboard())
Loads the QWERTYKeyboard input module, used for getting live input from QWERTY keyboards.
Loads the QWERTYKeyboard input module, used for getting live input from QWERTY keyboards.
[ "Loads", "the", "QWERTYKeyboard", "input", "module", "used", "for", "getting", "live", "input", "from", "QWERTY", "keyboards", "." ]
def load_keyboard(self): self.bind_input(QWERTYKeyboard())
[ "def", "load_keyboard", "(", "self", ")", ":", "self", ".", "bind_input", "(", "QWERTYKeyboard", "(", ")", ")" ]
Loads the QWERTYKeyboard input module, used for getting live input from QWERTY keyboards.
[ "Loads", "the", "QWERTYKeyboard", "input", "module", "used", "for", "getting", "live", "input", "from", "QWERTY", "keyboards", "." ]
[ "\"\"\"\n Loads the QWERTYKeyboard input module,\n used for getting live input from QWERTY keyboards.\n \"\"\"", "# Load QWERTYKeyboard:" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a11ddd6d756651f23cfcd94bed3f2fb348ec48fd
monarrk/python-audio-synth
pysynth/temp.py
[ "MIT" ]
Python
start_stream
<not_specific>
def start_stream(osc): """ Starts the audio thread and starts streaming data """ thread = threading.Thread(target=stream_data, args=[osc]) thread.daemon = True thread.start() return thread
Starts the audio thread and starts streaming data
Starts the audio thread and starts streaming data
[ "Starts", "the", "audio", "thread", "and", "starts", "streaming", "data" ]
def start_stream(osc): thread = threading.Thread(target=stream_data, args=[osc]) thread.daemon = True thread.start() return thread
[ "def", "start_stream", "(", "osc", ")", ":", "thread", "=", "threading", ".", "Thread", "(", "target", "=", "stream_data", ",", "args", "=", "[", "osc", "]", ")", "thread", ".", "daemon", "=", "True", "thread", ".", "start", "(", ")", "return", "thre...
Starts the audio thread and starts streaming data
[ "Starts", "the", "audio", "thread", "and", "starts", "streaming", "data" ]
[ "\"\"\"\r\n Starts the audio thread and starts streaming data\r\n \"\"\"" ]
[ { "param": "osc", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "osc", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a11ddd6d756651f23cfcd94bed3f2fb348ec48fd
monarrk/python-audio-synth
pysynth/temp.py
[ "MIT" ]
Python
stream_data
<not_specific>
def stream_data(data, time=None): """ Streams data to PyAudio. Data is a oscillator we iterate over :param data: Data to stream """ for num, i in enumerate(data): #print(i) stream.write(struct.pack('f', i)) if time and num > time: # We ...
Streams data to PyAudio. Data is a oscillator we iterate over :param data: Data to stream
Streams data to PyAudio. Data is a oscillator we iterate over
[ "Streams", "data", "to", "PyAudio", ".", "Data", "is", "a", "oscillator", "we", "iterate", "over" ]
def stream_data(data, time=None): for num, i in enumerate(data): stream.write(struct.pack('f', i)) if time and num > time: return
[ "def", "stream_data", "(", "data", ",", "time", "=", "None", ")", ":", "for", "num", ",", "i", "in", "enumerate", "(", "data", ")", ":", "stream", ".", "write", "(", "struct", ".", "pack", "(", "'f'", ",", "i", ")", ")", "if", "time", "and", "n...
Streams data to PyAudio.
[ "Streams", "data", "to", "PyAudio", "." ]
[ "\"\"\"\r\n Streams data to PyAudio.\r\n Data is a oscillator we iterate over\r\n\r\n :param data: Data to stream\r\n \"\"\"", "#print(i)\r", "# We are done\r" ]
[ { "param": "data", "type": null }, { "param": "time", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data", "type": null, "docstring": "Data to stream", "docstring_tokens": [ "Data", "to", "stream" ], "default": null, "is_optional": null }, { "identifier": "time", ...
a11ddd6d756651f23cfcd94bed3f2fb348ec48fd
monarrk/python-audio-synth
pysynth/temp.py
[ "MIT" ]
Python
write_wave
null
def write_wave(data, seconds): """ Writes a specified amount of wave data: :param data: Data to write :param seconds: Seconds to write """ # Open the wave file: wav = wave.open('blorck.wav', 'wb') wav.setnchannels(1) wav.setsampwidth(4) wav.setframerate(44100.0)...
Writes a specified amount of wave data: :param data: Data to write :param seconds: Seconds to write
Writes a specified amount of wave data.
[ "Writes", "a", "specified", "amount", "of", "wave", "data", "." ]
def write_wave(data, seconds): wav = wave.open('blorck.wav', 'wb') wav.setnchannels(1) wav.setsampwidth(4) wav.setframerate(44100.0) iter(data) for i in range(44100*seconds): value = next(data) wav.writeframesraw(struct.pack('<f', value)) wav.close()
[ "def", "write_wave", "(", "data", ",", "seconds", ")", ":", "wav", "=", "wave", ".", "open", "(", "'blorck.wav'", ",", "'wb'", ")", "wav", ".", "setnchannels", "(", "1", ")", "wav", ".", "setsampwidth", "(", "4", ")", "wav", ".", "setframerate", "(",...
Writes a specified amount of wave data:
[ "Writes", "a", "specified", "amount", "of", "wave", "data", ":" ]
[ "\"\"\"\r\n Writes a specified amount of wave data:\r\n :param data: Data to write\r\n :param seconds: Seconds to write\r\n \"\"\"", "# Open the wave file:\r" ]
[ { "param": "data", "type": null }, { "param": "seconds", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data", "type": null, "docstring": "Data to write", "docstring_tokens": [ "Data", "to", "write" ], "default": null, "is_optional": null }, { "identifier": "seconds", ...
a11ddd6d756651f23cfcd94bed3f2fb348ec48fd
monarrk/python-audio-synth
pysynth/temp.py
[ "MIT" ]
Python
remove_key
<not_specific>
def remove_key(self, key): """ Removes an oscillator from the AudioCollection. :param key: Oscillator to remove """ print("Removed key: {}".format(key.keysym)) if key.keysym in self.osc_keys: # DO nothing, return if s...
Removes an oscillator from the AudioCollection. :param key: Oscillator to remove
Removes an oscillator from the AudioCollection.
[ "Removes", "an", "oscillator", "from", "the", "AudioCollection", "." ]
def remove_key(self, key): print("Removed key: {}".format(key.keysym)) if key.keysym in self.osc_keys: return if self.keys[key.keysym] not in self.aud._objs: return self.aud.remove_module(self.keys[key.keysym])
[ "def", "remove_key", "(", "self", ",", "key", ")", ":", "print", "(", "\"Removed key: {}\"", ".", "format", "(", "key", ".", "keysym", ")", ")", "if", "key", ".", "keysym", "in", "self", ".", "osc_keys", ":", "return", "if", "self", ".", "keys", "[",...
Removes an oscillator from the AudioCollection.
[ "Removes", "an", "oscillator", "from", "the", "AudioCollection", "." ]
[ "\"\"\"\r\n Removes an oscillator from the AudioCollection.\r\n\r\n :param key: Oscillator to remove\r\n \"\"\"", "# DO nothing,\r", "# Nothing, return\r" ]
[ { "param": "self", "type": null }, { "param": "key", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "key", "type": null, "docstring": "Oscillator to remove", "doc...
a11ddd6d756651f23cfcd94bed3f2fb348ec48fd
monarrk/python-audio-synth
pysynth/temp.py
[ "MIT" ]
Python
add_key
<not_specific>
def add_key(self, key): """ Adds an oscillator from the AudioCollection. :param key: Oscillator to add """ print("Added Key: {}".format(key.char)) if key.char in self.osc_keys: # Generate a new oscillator mp self.keys = gen_oscs...
Adds an oscillator from the AudioCollection. :param key: Oscillator to add
Adds an oscillator from the AudioCollection.
[ "Adds", "an", "oscillator", "from", "the", "AudioCollection", "." ]
def add_key(self, key): print("Added Key: {}".format(key.char)) if key.char in self.osc_keys: self.keys = gen_oscs(self.osc_keys[key.char]) return if self.keys[key.char] in self.aud._objs: return self.aud.add_module(self.keys[key.char])
[ "def", "add_key", "(", "self", ",", "key", ")", ":", "print", "(", "\"Added Key: {}\"", ".", "format", "(", "key", ".", "char", ")", ")", "if", "key", ".", "char", "in", "self", ".", "osc_keys", ":", "self", ".", "keys", "=", "gen_oscs", "(", "self...
Adds an oscillator from the AudioCollection.
[ "Adds", "an", "oscillator", "from", "the", "AudioCollection", "." ]
[ "\"\"\"\r\n Adds an oscillator from the AudioCollection.\r\n\r\n :param key: Oscillator to add\r\n \"\"\"", "# Generate a new oscillator mp\r", "# Nothing, return\r" ]
[ { "param": "self", "type": null }, { "param": "key", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "key", "type": null, "docstring": "Oscillator to add", "docstr...
a11ddd6d756651f23cfcd94bed3f2fb348ec48fd
monarrk/python-audio-synth
pysynth/temp.py
[ "MIT" ]
Python
old_keyboard_input
null
def old_keyboard_input(): """ Maps certain keys to a keyboard, and adding the notes as we press/release keys. """ oscs = gen_oscs(SineOscillator) print(oscs) # Create AudioCollection for output collec = AudioCollection() collec.add_module(ZeroOscillator()) #...
Maps certain keys to a keyboard, and adding the notes as we press/release keys.
Maps certain keys to a keyboard, and adding the notes as we press/release keys.
[ "Maps", "certain", "keys", "to", "a", "keyboard", "and", "adding", "the", "notes", "as", "we", "press", "/", "release", "keys", "." ]
def old_keyboard_input(): oscs = gen_oscs(SineOscillator) print(oscs) collec = AudioCollection() collec.add_module(ZeroOscillator()) hand = KeyboardHandler(collec, oscs) start_stream(collec) os.system("xset r off") root = Tk() f = Frame(root, width=100, height=100) f.bind("<KeyPr...
[ "def", "old_keyboard_input", "(", ")", ":", "oscs", "=", "gen_oscs", "(", "SineOscillator", ")", "print", "(", "oscs", ")", "collec", "=", "AudioCollection", "(", ")", "collec", ".", "add_module", "(", "ZeroOscillator", "(", ")", ")", "hand", "=", "Keyboar...
Maps certain keys to a keyboard, and adding the notes as we press/release keys.
[ "Maps", "certain", "keys", "to", "a", "keyboard", "and", "adding", "the", "notes", "as", "we", "press", "/", "release", "keys", "." ]
[ "\"\"\"\r\n Maps certain keys to a keyboard,\r\n and adding the notes as we press/release keys.\r\n \"\"\"", "# Create AudioCollection for output\r", "# Create KeyBoardHandler:\r", "# Start streaming the AudioCollection:\r", "# Disabling continuous keypresses:\r", "# Creating TKinter data:\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a11ddd6d756651f23cfcd94bed3f2fb348ec48fd
monarrk/python-audio-synth
pysynth/temp.py
[ "MIT" ]
Python
pitch_comp
null
def pitch_comp(osc): """ Tests the pitch of the incoming oscillator. :param osc: """ sine = SineOscillator(freq=osc.freq.value) print("Pitch One:") stream_data(sine, time=220500) print("Pitch Two:") stream_data(osc, time=220500)
Tests the pitch of the incoming oscillator. :param osc:
Tests the pitch of the incoming oscillator.
[ "Tests", "the", "pitch", "of", "the", "incoming", "oscillator", "." ]
def pitch_comp(osc): sine = SineOscillator(freq=osc.freq.value) print("Pitch One:") stream_data(sine, time=220500) print("Pitch Two:") stream_data(osc, time=220500)
[ "def", "pitch_comp", "(", "osc", ")", ":", "sine", "=", "SineOscillator", "(", "freq", "=", "osc", ".", "freq", ".", "value", ")", "print", "(", "\"Pitch One:\"", ")", "stream_data", "(", "sine", ",", "time", "=", "220500", ")", "print", "(", "\"Pitch ...
Tests the pitch of the incoming oscillator.
[ "Tests", "the", "pitch", "of", "the", "incoming", "oscillator", "." ]
[ "\"\"\"\r\n Tests the pitch of the incoming oscillator.\r\n :param osc:\r\n \"\"\"" ]
[ { "param": "osc", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "osc", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c17280e11fe60980fbbef5d997a83f03017ec93f
monarrk/python-audio-synth
pysynth/filters.py
[ "MIT" ]
Python
sinc_n
null
def sinc_n(self, x): """ Normalised sinc function. sin(2PI * x) / (PI * x) We automatically handle division by zero and other quirky things. Read all about it here: https://en.wikipedia.org/wiki/Sinc_function :param x: Value of our sample ...
Normalised sinc function. sin(2PI * x) / (PI * x) We automatically handle division by zero and other quirky things. Read all about it here: https://en.wikipedia.org/wiki/Sinc_function :param x: Value of our sample :param x: float :return: ...
Normalised sinc function. We automatically handle division by zero and other quirky things. Read all about it here.
[ "Normalised", "sinc", "function", ".", "We", "automatically", "handle", "division", "by", "zero", "and", "other", "quirky", "things", ".", "Read", "all", "about", "it", "here", "." ]
def sinc_n(self, x): pass
[ "def", "sinc_n", "(", "self", ",", "x", ")", ":", "pass" ]
Normalised sinc function.
[ "Normalised", "sinc", "function", "." ]
[ "\"\"\"\r\n Normalised sinc function.\r\n\r\n sin(2PI * x) / (PI * x)\r\n\r\n We automatically handle division by zero and other quirky things.\r\n Read all about it here:\r\n\r\n https://en.wikipedia.org/wiki/Sinc_function\r\n\r\n :param x: Value of our sample\r\n :...
[ { "param": "self", "type": null }, { "param": "x", "type": null } ]
{ "returns": [ { "docstring": "Output of the normalised sinc function", "docstring_tokens": [ "Output", "of", "the", "normalised", "sinc", "function" ], "type": "float" } ], "raises": [], "params": [ { "identifier": "self"...
c17280e11fe60980fbbef5d997a83f03017ec93f
monarrk/python-audio-synth
pysynth/filters.py
[ "MIT" ]
Python
start
null
def start(self): """ Prepares this filter for iteration. We only set up the audio buffers, which hold previously calculated values. """ # Determine the size of the input buffer: self.inp = AudioBuffer(len(self.a) - 1, no_fill=True) self.inp.fill_buf...
Prepares this filter for iteration. We only set up the audio buffers, which hold previously calculated values.
Prepares this filter for iteration. We only set up the audio buffers, which hold previously calculated values.
[ "Prepares", "this", "filter", "for", "iteration", ".", "We", "only", "set", "up", "the", "audio", "buffers", "which", "hold", "previously", "calculated", "values", "." ]
def start(self): self.inp = AudioBuffer(len(self.a) - 1, no_fill=True) self.inp.fill_buffer(ignore_global=True) self.out = AudioBuffer(len(self.b), no_fill=True) self.out.fill_buffer(ignore_global=True)
[ "def", "start", "(", "self", ")", ":", "self", ".", "inp", "=", "AudioBuffer", "(", "len", "(", "self", ".", "a", ")", "-", "1", ",", "no_fill", "=", "True", ")", "self", ".", "inp", ".", "fill_buffer", "(", "ignore_global", "=", "True", ")", "se...
Prepares this filter for iteration.
[ "Prepares", "this", "filter", "for", "iteration", "." ]
[ "\"\"\"\r\n Prepares this filter for iteration.\r\n\r\n We only set up the audio buffers, which hold previously calculated values.\r\n \"\"\"", "# Determine the size of the input buffer:\r", "# Determine the size out of the output buffer:\r" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c17280e11fe60980fbbef5d997a83f03017ec93f
monarrk/python-audio-synth
pysynth/filters.py
[ "MIT" ]
Python
reg_coeff
null
def reg_coeff(self, a, b): """ Registers the given coefficients with this filter. Each parameter should be a list containing the recursive coefficients in use. :param a: Tuple containing all A coefficient values. :type a: tuple :param b: Tuple contaning all B ...
Registers the given coefficients with this filter. Each parameter should be a list containing the recursive coefficients in use. :param a: Tuple containing all A coefficient values. :type a: tuple :param b: Tuple contaning all B coefficient values :type b: tupl...
Registers the given coefficients with this filter. Each parameter should be a list containing the recursive coefficients in use.
[ "Registers", "the", "given", "coefficients", "with", "this", "filter", ".", "Each", "parameter", "should", "be", "a", "list", "containing", "the", "recursive", "coefficients", "in", "use", "." ]
def reg_coeff(self, a, b): self.a = tuple(a) self.b = tuple(b)
[ "def", "reg_coeff", "(", "self", ",", "a", ",", "b", ")", ":", "self", ".", "a", "=", "tuple", "(", "a", ")", "self", ".", "b", "=", "tuple", "(", "b", ")" ]
Registers the given coefficients with this filter.
[ "Registers", "the", "given", "coefficients", "with", "this", "filter", "." ]
[ "\"\"\"\r\n Registers the given coefficients with this filter.\r\n\r\n Each parameter should be a list containing the recursive coefficients in use.\r\n\r\n :param a: Tuple containing all A coefficient values.\r\n :type a: tuple\r\n :param b: Tuple contaning all B coefficient valu...
[ { "param": "self", "type": null }, { "param": "a", "type": null }, { "param": "b", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "a", "type": null, "docstring": "Tuple containing all A coefficient ...
c17280e11fe60980fbbef5d997a83f03017ec93f
monarrk/python-audio-synth
pysynth/filters.py
[ "MIT" ]
Python
calc_cutoff
<not_specific>
def calc_cutoff(self, frac): """ Calculates the cutoff value for this filter, given the frequency fraction. We utilise the following equation: 2 - cos(2 * PI * frac) - sqrt((2 - cos(2 * PI * frac))^2 - 1) where: frac = frequency fraction :param ...
Calculates the cutoff value for this filter, given the frequency fraction. We utilise the following equation: 2 - cos(2 * PI * frac) - sqrt((2 - cos(2 * PI * frac))^2 - 1) where: frac = frequency fraction :param frac: Frequency fraction :type fra...
Calculates the cutoff value for this filter, given the frequency fraction. We utilise the following equation. frac = frequency fraction
[ "Calculates", "the", "cutoff", "value", "for", "this", "filter", "given", "the", "frequency", "fraction", ".", "We", "utilise", "the", "following", "equation", ".", "frac", "=", "frequency", "fraction" ]
def calc_cutoff(self, frac): return 2 - cos(2 * pi * frac) - sqrt(pow(2 - cos(2 * pi * frac), 2) - 1)
[ "def", "calc_cutoff", "(", "self", ",", "frac", ")", ":", "return", "2", "-", "cos", "(", "2", "*", "pi", "*", "frac", ")", "-", "sqrt", "(", "pow", "(", "2", "-", "cos", "(", "2", "*", "pi", "*", "frac", ")", ",", "2", ")", "-", "1", ")"...
Calculates the cutoff value for this filter, given the frequency fraction.
[ "Calculates", "the", "cutoff", "value", "for", "this", "filter", "given", "the", "frequency", "fraction", "." ]
[ "\"\"\"\r\n Calculates the cutoff value for this filter, given the frequency fraction.\r\n\r\n We utilise the following equation:\r\n\r\n 2 - cos(2 * PI * frac) - sqrt((2 - cos(2 * PI * frac))^2 - 1)\r\n\r\n where:\r\n\r\n frac = frequency fraction\r\n\r\n :param frac: Freq...
[ { "param": "self", "type": null }, { "param": "frac", "type": null } ]
{ "returns": [ { "docstring": "Cutoff value for the specified frequency", "docstring_tokens": [ "Cutoff", "value", "for", "the", "specified", "frequency" ], "type": "float" } ], "raises": [], "params": [ { "identifier": "s...
c17280e11fe60980fbbef5d997a83f03017ec93f
monarrk/python-audio-synth
pysynth/filters.py
[ "MIT" ]
Python
calc_time
<not_specific>
def calc_time(self, time_cost): """ Calculates the time value for this filter, given a time constant. We utilise the following equation: e ^ (-1 / time_const) Where: time_const = Time constant - the number of samples it takes to decay to the 36.8% of the f...
Calculates the time value for this filter, given a time constant. We utilise the following equation: e ^ (-1 / time_const) Where: time_const = Time constant - the number of samples it takes to decay to the 36.8% of the final value :param time_cost: Time c...
Calculates the time value for this filter, given a time constant. We utilise the following equation. time_const = Time constant - the number of samples it takes to decay to the 36.8% of the final value
[ "Calculates", "the", "time", "value", "for", "this", "filter", "given", "a", "time", "constant", ".", "We", "utilise", "the", "following", "equation", ".", "time_const", "=", "Time", "constant", "-", "the", "number", "of", "samples", "it", "takes", "to", "...
def calc_time(self, time_cost): return pow(e, -1/time_cost)
[ "def", "calc_time", "(", "self", ",", "time_cost", ")", ":", "return", "pow", "(", "e", ",", "-", "1", "/", "time_cost", ")" ]
Calculates the time value for this filter, given a time constant.
[ "Calculates", "the", "time", "value", "for", "this", "filter", "given", "a", "time", "constant", "." ]
[ "\"\"\"\r\n Calculates the time value for this filter, given a time constant.\r\n\r\n We utilise the following equation:\r\n\r\n e ^ (-1 / time_const)\r\n\r\n Where:\r\n\r\n time_const = Time constant - the number of samples it takes to decay to the 36.8% of the final value\r\n\r\...
[ { "param": "self", "type": null }, { "param": "time_cost", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "time_cost", "type": null, "docstring": null, "docstring_token...
c17280e11fe60980fbbef5d997a83f03017ec93f
monarrk/python-audio-synth
pysynth/filters.py
[ "MIT" ]
Python
gen_lp
<not_specific>
def gen_lp(self, resp): """ Generates low pass A and B coefficients given a filter response. :param resp: Filter response :type resp: float :return: Two tuples containing A and B coefficients, respectively :rtype: tuple """ # Generate our coe...
Generates low pass A and B coefficients given a filter response. :param resp: Filter response :type resp: float :return: Two tuples containing A and B coefficients, respectively :rtype: tuple
Generates low pass A and B coefficients given a filter response.
[ "Generates", "low", "pass", "A", "and", "B", "coefficients", "given", "a", "filter", "response", "." ]
def gen_lp(self, resp): return tuple([1-resp]), tuple([resp])
[ "def", "gen_lp", "(", "self", ",", "resp", ")", ":", "return", "tuple", "(", "[", "1", "-", "resp", "]", ")", ",", "tuple", "(", "[", "resp", "]", ")" ]
Generates low pass A and B coefficients given a filter response.
[ "Generates", "low", "pass", "A", "and", "B", "coefficients", "given", "a", "filter", "response", "." ]
[ "\"\"\"\r\n Generates low pass A and B coefficients given a filter response.\r\n\r\n :param resp: Filter response\r\n :type resp: float\r\n :return: Two tuples containing A and B coefficients, respectively\r\n :rtype: tuple\r\n \"\"\"", "# Generate our coefficients and ex...
[ { "param": "self", "type": null }, { "param": "resp", "type": null } ]
{ "returns": [ { "docstring": "Two tuples containing A and B coefficients, respectively", "docstring_tokens": [ "Two", "tuples", "containing", "A", "and", "B", "coefficients", "respectively" ], "type": "tuple" } ], "ra...
c17280e11fe60980fbbef5d997a83f03017ec93f
monarrk/python-audio-synth
pysynth/filters.py
[ "MIT" ]
Python
gen_hp
<not_specific>
def gen_hp(self, resp): """ Generates high pass A and B coefficients given a filter response. :param resp: Filter response :type resp: float :return: Two tuples containing A and B coefficients, respectively :rtype: tuple """ # Generate our co...
Generates high pass A and B coefficients given a filter response. :param resp: Filter response :type resp: float :return: Two tuples containing A and B coefficients, respectively :rtype: tuple
Generates high pass A and B coefficients given a filter response.
[ "Generates", "high", "pass", "A", "and", "B", "coefficients", "given", "a", "filter", "response", "." ]
def gen_hp(self, resp): return ((1+resp)/2), (-(1+resp)/2)
[ "def", "gen_hp", "(", "self", ",", "resp", ")", ":", "return", "(", "(", "1", "+", "resp", ")", "/", "2", ")", ",", "(", "-", "(", "1", "+", "resp", ")", "/", "2", ")" ]
Generates high pass A and B coefficients given a filter response.
[ "Generates", "high", "pass", "A", "and", "B", "coefficients", "given", "a", "filter", "response", "." ]
[ "\"\"\"\r\n Generates high pass A and B coefficients given a filter response.\r\n\r\n :param resp: Filter response\r\n :type resp: float\r\n :return: Two tuples containing A and B coefficients, respectively\r\n :rtype: tuple\r\n \"\"\"", "# Generate our coefficients and e...
[ { "param": "self", "type": null }, { "param": "resp", "type": null } ]
{ "returns": [ { "docstring": "Two tuples containing A and B coefficients, respectively", "docstring_tokens": [ "Two", "tuples", "containing", "A", "and", "B", "coefficients", "respectively" ], "type": "tuple" } ], "ra...
c17280e11fe60980fbbef5d997a83f03017ec93f
monarrk/python-audio-synth
pysynth/filters.py
[ "MIT" ]
Python
start
null
def start(self): """ Start method, creates a buffer to hold all values. By now, the user should have bound the source to this object. """ self.buffer = AudioBuffer(self.upper+self.lower+1+self.size, self.input)
Start method, creates a buffer to hold all values. By now, the user should have bound the source to this object.
Start method, creates a buffer to hold all values. By now, the user should have bound the source to this object.
[ "Start", "method", "creates", "a", "buffer", "to", "hold", "all", "values", ".", "By", "now", "the", "user", "should", "have", "bound", "the", "source", "to", "this", "object", "." ]
def start(self): self.buffer = AudioBuffer(self.upper+self.lower+1+self.size, self.input)
[ "def", "start", "(", "self", ")", ":", "self", ".", "buffer", "=", "AudioBuffer", "(", "self", ".", "upper", "+", "self", ".", "lower", "+", "1", "+", "self", ".", "size", ",", "self", ".", "input", ")" ]
Start method, creates a buffer to hold all values.
[ "Start", "method", "creates", "a", "buffer", "to", "hold", "all", "values", "." ]
[ "\"\"\"\r\n Start method, creates a buffer to hold all values.\r\n\r\n By now, the user should have bound the source to this object.\r\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c17280e11fe60980fbbef5d997a83f03017ec93f
monarrk/python-audio-synth
pysynth/filters.py
[ "MIT" ]
Python
calc_conv
<not_specific>
def calc_conv(self, start=0): """ Calculates the next given point via convolution. :param start: Starting value of the operation :type start: int :return: Average sum at the given point :rtype: float, int """ total = 0 for num in r...
Calculates the next given point via convolution. :param start: Starting value of the operation :type start: int :return: Average sum at the given point :rtype: float, int
Calculates the next given point via convolution.
[ "Calculates", "the", "next", "given", "point", "via", "convolution", "." ]
def calc_conv(self, start=0): total = 0 for num in range(start, self.size+start): total = total + self.buffer[num] return total / self.size
[ "def", "calc_conv", "(", "self", ",", "start", "=", "0", ")", ":", "total", "=", "0", "for", "num", "in", "range", "(", "start", ",", "self", ".", "size", "+", "start", ")", ":", "total", "=", "total", "+", "self", ".", "buffer", "[", "num", "]...
Calculates the next given point via convolution.
[ "Calculates", "the", "next", "given", "point", "via", "convolution", "." ]
[ "\"\"\"\r\n Calculates the next given point via convolution.\r\n\r\n :param start: Starting value of the operation\r\n :type start: int\r\n :return: Average sum at the given point\r\n :rtype: float, int\r\n \"\"\"", "# Retrieve value and add it to total\r", "# Divide to...
[ { "param": "self", "type": null }, { "param": "start", "type": null } ]
{ "returns": [ { "docstring": "Average sum at the given point", "docstring_tokens": [ "Average", "sum", "at", "the", "given", "point" ], "type": "float, int" } ], "raises": [], "params": [ { "identifier": "self", "ty...
c17280e11fe60980fbbef5d997a83f03017ec93f
monarrk/python-audio-synth
pysynth/filters.py
[ "MIT" ]
Python
calc_recursive
<not_specific>
def calc_recursive(self): """ Calculates the current value recursively. """ # Calculate and return our value: return (self.prev + self.buffer[self.lower+self.upper] - self.buffer[0]) / self.size
Calculates the current value recursively.
Calculates the current value recursively.
[ "Calculates", "the", "current", "value", "recursively", "." ]
def calc_recursive(self): return (self.prev + self.buffer[self.lower+self.upper] - self.buffer[0]) / self.size
[ "def", "calc_recursive", "(", "self", ")", ":", "return", "(", "self", ".", "prev", "+", "self", ".", "buffer", "[", "self", ".", "lower", "+", "self", ".", "upper", "]", "-", "self", ".", "buffer", "[", "0", "]", ")", "/", "self", ".", "size" ]
Calculates the current value recursively.
[ "Calculates", "the", "current", "value", "recursively", "." ]
[ "\"\"\"\r\n Calculates the current value recursively.\r\n \"\"\"", "# Calculate and return our value:\r" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c17280e11fe60980fbbef5d997a83f03017ec93f
monarrk/python-audio-synth
pysynth/filters.py
[ "MIT" ]
Python
calc_next
<not_specific>
def calc_next(self): """ Calculates the next value in the Moving Average Filter. The first 'lower' values are calculated via convolution. After these values are calculated, then the recursive algorithm is used. :return: Next calculated value :rtype: float, int...
Calculates the next value in the Moving Average Filter. The first 'lower' values are calculated via convolution. After these values are calculated, then the recursive algorithm is used. :return: Next calculated value :rtype: float, int
Calculates the next value in the Moving Average Filter. The first 'lower' values are calculated via convolution. After these values are calculated, then the recursive algorithm is used.
[ "Calculates", "the", "next", "value", "in", "the", "Moving", "Average", "Filter", ".", "The", "first", "'", "lower", "'", "values", "are", "calculated", "via", "convolution", ".", "After", "these", "values", "are", "calculated", "then", "the", "recursive", "...
def calc_next(self): final = 0 if self.index < self.lower: self.prev = self.calc_conv(start=self.index) return self.prev self.prev = self.calc_recursive() self.buffer.popleft() return self.prev
[ "def", "calc_next", "(", "self", ")", ":", "final", "=", "0", "if", "self", ".", "index", "<", "self", ".", "lower", ":", "self", ".", "prev", "=", "self", ".", "calc_conv", "(", "start", "=", "self", ".", "index", ")", "return", "self", ".", "pr...
Calculates the next value in the Moving Average Filter.
[ "Calculates", "the", "next", "value", "in", "the", "Moving", "Average", "Filter", "." ]
[ "\"\"\"\r\n Calculates the next value in the Moving Average Filter.\r\n\r\n The first 'lower' values are calculated via convolution.\r\n After these values are calculated, then the recursive algorithm is used.\r\n\r\n :return: Next calculated value\r\n :rtype: float, int\r\n ...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Next calculated value", "docstring_tokens": [ "Next", "calculated", "value" ], "type": "float, int" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstrin...
c17280e11fe60980fbbef5d997a83f03017ec93f
monarrk/python-audio-synth
pysynth/filters.py
[ "MIT" ]
Python
calc_recursive
<not_specific>
def calc_recursive(self): """ Calculates the current value recursively. """ # Calculate and return our value: return self.prev + self.buffer[self.size-self.upper] - self.buffer[0]
Calculates the current value recursively.
Calculates the current value recursively.
[ "Calculates", "the", "current", "value", "recursively", "." ]
def calc_recursive(self): return self.prev + self.buffer[self.size-self.upper] - self.buffer[0]
[ "def", "calc_recursive", "(", "self", ")", ":", "return", "self", ".", "prev", "+", "self", ".", "buffer", "[", "self", ".", "size", "-", "self", ".", "upper", "]", "-", "self", ".", "buffer", "[", "0", "]" ]
Calculates the current value recursively.
[ "Calculates", "the", "current", "value", "recursively", "." ]
[ "\"\"\"\r\n Calculates the current value recursively.\r\n \"\"\"", "# Calculate and return our value:\r" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2db7639494a92ab84bce4c877a1cf477aff1e5e4
monarrk/python-audio-synth
pysynth/envelope/amp.py
[ "MIT" ]
Python
start
null
def start(self): """ Starts the ADSR envelope. We just schedule the relevant time events for attack and decay. """ # Clear any lingering events: self.amp.cancel_all_events() # Set the attack time: self.amp.linear_ramp(self.max, self.attack + get_time...
Starts the ADSR envelope. We just schedule the relevant time events for attack and decay.
Starts the ADSR envelope. We just schedule the relevant time events for attack and decay.
[ "Starts", "the", "ADSR", "envelope", ".", "We", "just", "schedule", "the", "relevant", "time", "events", "for", "attack", "and", "decay", "." ]
def start(self): self.amp.cancel_all_events() self.amp.linear_ramp(self.max, self.attack + get_time()) self.amp.linear_ramp(self.sustain, self.decay + self.attack + get_time())
[ "def", "start", "(", "self", ")", ":", "self", ".", "amp", ".", "cancel_all_events", "(", ")", "self", ".", "amp", ".", "linear_ramp", "(", "self", ".", "max", ",", "self", ".", "attack", "+", "get_time", "(", ")", ")", "self", ".", "amp", ".", "...
Starts the ADSR envelope.
[ "Starts", "the", "ADSR", "envelope", "." ]
[ "\"\"\"\n Starts the ADSR envelope.\n\n We just schedule the relevant time events for attack and decay.\n \"\"\"", "# Clear any lingering events:", "# Set the attack time:", "# Set the decay time:" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2db7639494a92ab84bce4c877a1cf477aff1e5e4
monarrk/python-audio-synth
pysynth/envelope/amp.py
[ "MIT" ]
Python
finish
null
def finish(self): """ Cancles all events currently occuring and ramps down to the final value. """ print("Finishing the envelope") # Cancel all events: self.amp.cancel_all_events() # Schedule an event to ramp down to zero: self.amp.linear_ramp(0, sel...
Cancles all events currently occuring and ramps down to the final value.
Cancles all events currently occuring and ramps down to the final value.
[ "Cancles", "all", "events", "currently", "occuring", "and", "ramps", "down", "to", "the", "final", "value", "." ]
def finish(self): print("Finishing the envelope") self.amp.cancel_all_events() self.amp.linear_ramp(0, self.release + get_time())
[ "def", "finish", "(", "self", ")", ":", "print", "(", "\"Finishing the envelope\"", ")", "self", ".", "amp", ".", "cancel_all_events", "(", ")", "self", ".", "amp", ".", "linear_ramp", "(", "0", ",", "self", ".", "release", "+", "get_time", "(", ")", "...
Cancles all events currently occuring and ramps down to the final value.
[ "Cancles", "all", "events", "currently", "occuring", "and", "ramps", "down", "to", "the", "final", "value", "." ]
[ "\"\"\"\n Cancles all events currently occuring and ramps down to the final value.\n \"\"\"", "# Cancel all events:", "# Schedule an event to ramp down to zero:" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3d40fa433dd265de33a1eb9843234b22197eb785
monarrk/python-audio-synth
pysynth/wrappers/midi/events.py
[ "MIT" ]
Python
from_bytes
null
def from_bytes(cls, bytes): """ Creates a MIDI event from raw bytes. Our packets should be able to create valid copies of themselves given valid byes of MIDI data. """ raise NotImplementedError("Must be overridden in child class!")
Creates a MIDI event from raw bytes. Our packets should be able to create valid copies of themselves given valid byes of MIDI data.
Creates a MIDI event from raw bytes. Our packets should be able to create valid copies of themselves given valid byes of MIDI data.
[ "Creates", "a", "MIDI", "event", "from", "raw", "bytes", ".", "Our", "packets", "should", "be", "able", "to", "create", "valid", "copies", "of", "themselves", "given", "valid", "byes", "of", "MIDI", "data", "." ]
def from_bytes(cls, bytes): raise NotImplementedError("Must be overridden in child class!")
[ "def", "from_bytes", "(", "cls", ",", "bytes", ")", ":", "raise", "NotImplementedError", "(", "\"Must be overridden in child class!\"", ")" ]
Creates a MIDI event from raw bytes.
[ "Creates", "a", "MIDI", "event", "from", "raw", "bytes", "." ]
[ "\"\"\"\n Creates a MIDI event from raw bytes.\n\n Our packets should be able to create valid copies of themselves\n given valid byes of MIDI data.\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "bytes", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bytes", "type": null, "docstring": null, "docstring_tokens": [...
3d40fa433dd265de33a1eb9843234b22197eb785
monarrk/python-audio-synth
pysynth/wrappers/midi/events.py
[ "MIT" ]
Python
from_object
null
def from_object(cls, obj): """ Creates a MIDI event from an object. Our packets should be able to create valid copies of themselves given valid objects contaning MIDI data. These objects should use the standardized storage system. #TODO: Elaborate. """
Creates a MIDI event from an object. Our packets should be able to create valid copies of themselves given valid objects contaning MIDI data. These objects should use the standardized storage system. #TODO: Elaborate.
Creates a MIDI event from an object. Our packets should be able to create valid copies of themselves given valid objects contaning MIDI data. These objects should use the standardized storage system. TODO: Elaborate.
[ "Creates", "a", "MIDI", "event", "from", "an", "object", ".", "Our", "packets", "should", "be", "able", "to", "create", "valid", "copies", "of", "themselves", "given", "valid", "objects", "contaning", "MIDI", "data", ".", "These", "objects", "should", "use",...
def from_object(cls, obj):
[ "def", "from_object", "(", "cls", ",", "obj", ")", ":" ]
Creates a MIDI event from an object.
[ "Creates", "a", "MIDI", "event", "from", "an", "object", "." ]
[ "\"\"\"\n Creates a MIDI event from an object.\n\n Our packets should be able to create valid copies of themselves\n given valid objects contaning MIDI data.\n\n These objects should use the standardized storage system.\n #TODO: Elaborate. \n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "obj", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "obj", "type": null, "docstring": null, "docstring_tokens": [],...
3d40fa433dd265de33a1eb9843234b22197eb785
monarrk/python-audio-synth
pysynth/wrappers/midi/events.py
[ "MIT" ]
Python
from_object
<not_specific>
def from_object(cls, obj): """ Creates a NoteOff event with the given object. """ temp = cls(obj.note, obj.off_velocity) temp.channel = obj.channel return temp
Creates a NoteOff event with the given object.
Creates a NoteOff event with the given object.
[ "Creates", "a", "NoteOff", "event", "with", "the", "given", "object", "." ]
def from_object(cls, obj): temp = cls(obj.note, obj.off_velocity) temp.channel = obj.channel return temp
[ "def", "from_object", "(", "cls", ",", "obj", ")", ":", "temp", "=", "cls", "(", "obj", ".", "note", ",", "obj", ".", "off_velocity", ")", "temp", ".", "channel", "=", "obj", ".", "channel", "return", "temp" ]
Creates a NoteOff event with the given object.
[ "Creates", "a", "NoteOff", "event", "with", "the", "given", "object", "." ]
[ "\"\"\"\n Creates a NoteOff event with the given object.\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "obj", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "obj", "type": null, "docstring": null, "docstring_tokens": [],...
3d40fa433dd265de33a1eb9843234b22197eb785
monarrk/python-audio-synth
pysynth/wrappers/midi/events.py
[ "MIT" ]
Python
from_object
<not_specific>
def from_object(cls, obj): """ Creates a NoteOn event with the given object. """ temp = cls(obj.note, obj.velocity) return temp
Creates a NoteOn event with the given object.
Creates a NoteOn event with the given object.
[ "Creates", "a", "NoteOn", "event", "with", "the", "given", "object", "." ]
def from_object(cls, obj): temp = cls(obj.note, obj.velocity) return temp
[ "def", "from_object", "(", "cls", ",", "obj", ")", ":", "temp", "=", "cls", "(", "obj", ".", "note", ",", "obj", ".", "velocity", ")", "return", "temp" ]
Creates a NoteOn event with the given object.
[ "Creates", "a", "NoteOn", "event", "with", "the", "given", "object", "." ]
[ "\"\"\"\n Creates a NoteOn event with the given object.\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "obj", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "obj", "type": null, "docstring": null, "docstring_tokens": [],...
a8c049741ada80247d3756ee5b9b376ad4033a05
monarrk/python-audio-synth
pysynth/output/convert.py
[ "MIT" ]
Python
convert
null
def convert(self, inp): """ Convert class - This is what the output module will be calling. You can safely assume that the input will be signed floats. You can return anything you like, although a bytes object might be the most relevant bet. :param inp: Input to conver...
Convert class - This is what the output module will be calling. You can safely assume that the input will be signed floats. You can return anything you like, although a bytes object might be the most relevant bet. :param inp: Input to convert :type inp: float :...
Convert class - This is what the output module will be calling. You can safely assume that the input will be signed floats. You can return anything you like, although a bytes object might be the most relevant bet.
[ "Convert", "class", "-", "This", "is", "what", "the", "output", "module", "will", "be", "calling", ".", "You", "can", "safely", "assume", "that", "the", "input", "will", "be", "signed", "floats", ".", "You", "can", "return", "anything", "you", "like", "a...
def convert(self, inp): pass
[ "def", "convert", "(", "self", ",", "inp", ")", ":", "pass" ]
Convert class - This is what the output module will be calling.
[ "Convert", "class", "-", "This", "is", "what", "the", "output", "module", "will", "be", "calling", "." ]
[ "\"\"\"\n Convert class - This is what the output module will be calling.\n\n You can safely assume that the input will be signed floats.\n You can return anything you like,\n although a bytes object might be the most relevant bet.\n\n :param inp: Input to convert\n :type i...
[ { "param": "self", "type": null }, { "param": "inp", "type": null } ]
{ "returns": [ { "docstring": "Anything that the converter thinks is relevant", "docstring_tokens": [ "Anything", "that", "the", "converter", "thinks", "is", "relevant" ], "type": null } ], "raises": [], "params": [ { ...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
run
null
def run(self): """ Main run method of the input module. Ideally, we will continuously get our input from somewhere, and then pass it onto the decode() method of the decoder, which will then pass instructions onto the sequencer. """ raise NotImplementedError("Mu...
Main run method of the input module. Ideally, we will continuously get our input from somewhere, and then pass it onto the decode() method of the decoder, which will then pass instructions onto the sequencer.
Main run method of the input module. Ideally, we will continuously get our input from somewhere, and then pass it onto the decode() method of the decoder, which will then pass instructions onto the sequencer.
[ "Main", "run", "method", "of", "the", "input", "module", ".", "Ideally", "we", "will", "continuously", "get", "our", "input", "from", "somewhere", "and", "then", "pass", "it", "onto", "the", "decode", "()", "method", "of", "the", "decoder", "which", "will"...
def run(self): raise NotImplementedError("Must be implemented in child class!")
[ "def", "run", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "\"Must be implemented in child class!\"", ")" ]
Main run method of the input module.
[ "Main", "run", "method", "of", "the", "input", "module", "." ]
[ "\"\"\"\n Main run method of the input module.\n\n Ideally, we will continuously get our input from somewhere,\n and then pass it onto the decode() method of the decoder,\n which will then pass instructions onto the sequencer.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
find_time_type
<not_specific>
def find_time_type(self, note_type): """ Finds the amount of time the note will take given it's note type, beats per measure, and tempo. We use 'find_beats()' to determine the amount of beats the note type takes up. Once we have determined the number of beats this note takes u...
Finds the amount of time the note will take given it's note type, beats per measure, and tempo. We use 'find_beats()' to determine the amount of beats the note type takes up. Once we have determined the number of beats this note takes up, we will then multiply the value by the...
Finds the amount of time the note will take given it's note type, beats per measure, and tempo. We use 'find_beats()' to determine the amount of beats the note type takes up. Once we have determined the number of beats this note takes up, we will then multiply the value by the beats per second, which we can calculate...
[ "Finds", "the", "amount", "of", "time", "the", "note", "will", "take", "given", "it", "'", "s", "note", "type", "beats", "per", "measure", "and", "tempo", ".", "We", "use", "'", "find_beats", "()", "'", "to", "determine", "the", "amount", "of", "beats"...
def find_time_type(self, note_type): beats = self.find_beats(note_type) return (beats * (1 / (self.tempo / 60))) * 1000000000
[ "def", "find_time_type", "(", "self", ",", "note_type", ")", ":", "beats", "=", "self", ".", "find_beats", "(", "note_type", ")", "return", "(", "beats", "*", "(", "1", "/", "(", "self", ".", "tempo", "/", "60", ")", ")", ")", "*", "1000000000" ]
Finds the amount of time the note will take given it's note type, beats per measure, and tempo.
[ "Finds", "the", "amount", "of", "time", "the", "note", "will", "take", "given", "it", "'", "s", "note", "type", "beats", "per", "measure", "and", "tempo", "." ]
[ "\"\"\"\n Finds the amount of time the note will take given it's note type,\n beats per measure, and tempo.\n\n We use 'find_beats()' to determine the amount of beats the note type takes up.\n\n Once we have determined the number of beats this note takes up,\n we will then multipl...
[ { "param": "self", "type": null }, { "param": "note_type", "type": null } ]
{ "returns": [ { "docstring": "Number of nanoseconds we must sleep for", "docstring_tokens": [ "Number", "of", "nanoseconds", "we", "must", "sleep", "for" ], "type": "float" } ], "raises": [], "params": [ { "identi...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
find_beats
<not_specific>
def find_beats(self, note_type): """ Finds the amounts of beats the given note represents, given the beats per bar, and tempo. The note_type represents the fraction of the note compared to he bpb. If the bpm is 4, then 1 represents 1 beat, 2 represents 2 beats, 3 represents 4/3...
Finds the amounts of beats the given note represents, given the beats per bar, and tempo. The note_type represents the fraction of the note compared to he bpb. If the bpm is 4, then 1 represents 1 beat, 2 represents 2 beats, 3 represents 4/3 beats, ect. In normal note notation,...
Finds the amounts of beats the given note represents, given the beats per bar, and tempo. The note_type represents the fraction of the note compared to he bpb. If the bpm is 4, then 1 represents 1 beat, 2 represents 2 beats, 3 represents 4/3 beats, ect. In normal note notation, a 1 is a whole note, 2 is half note, 4 i...
[ "Finds", "the", "amounts", "of", "beats", "the", "given", "note", "represents", "given", "the", "beats", "per", "bar", "and", "tempo", ".", "The", "note_type", "represents", "the", "fraction", "of", "the", "note", "compared", "to", "he", "bpb", ".", "If", ...
def find_beats(self, note_type): beats = self.beats_per_measure / int(note_type) beats = beats + (beats * (note_type % 1)) return beats
[ "def", "find_beats", "(", "self", ",", "note_type", ")", ":", "beats", "=", "self", ".", "beats_per_measure", "/", "int", "(", "note_type", ")", "beats", "=", "beats", "+", "(", "beats", "*", "(", "note_type", "%", "1", ")", ")", "return", "beats" ]
Finds the amounts of beats the given note represents, given the beats per bar, and tempo.
[ "Finds", "the", "amounts", "of", "beats", "the", "given", "note", "represents", "given", "the", "beats", "per", "bar", "and", "tempo", "." ]
[ "\"\"\"\n Finds the amounts of beats the given note represents, given the beats per bar,\n and tempo.\n\n The note_type represents the fraction of the note compared to he bpb.\n If the bpm is 4, then 1 represents 1 beat, 2 represents 2 beats, 3 represents 4/3 beats, ect.\n In norm...
[ { "param": "self", "type": null }, { "param": "note_type", "type": null } ]
{ "returns": [ { "docstring": "Number of beats this note represents", "docstring_tokens": [ "Number", "of", "beats", "this", "note", "represents" ], "type": "float" } ], "raises": [], "params": [ { "identifier": "self", ...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
decode
null
def decode(self, *args, **kwargs): """ The main decoder method! All inputs from the Input module will be sent here for decoding. As of now, we utilise a synchronous model for sequencer decoding, meaning that only one thread is used, and queues are not used. This means...
The main decoder method! All inputs from the Input module will be sent here for decoding. As of now, we utilise a synchronous model for sequencer decoding, meaning that only one thread is used, and queues are not used. This means that all input will be sent here, in whatever ...
The main decoder method. All inputs from the Input module will be sent here for decoding. As of now, we utilise a synchronous model for sequencer decoding, meaning that only one thread is used, and queues are not used. This means that all input will be sent here, in whatever format is agreed upon between modules.
[ "The", "main", "decoder", "method", ".", "All", "inputs", "from", "the", "Input", "module", "will", "be", "sent", "here", "for", "decoding", ".", "As", "of", "now", "we", "utilise", "a", "synchronous", "model", "for", "sequencer", "decoding", "meaning", "t...
def decode(self, *args, **kwargs): raise NotImplementedError("Must be implemented in child class!")
[ "def", "decode", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "\"Must be implemented in child class!\"", ")" ]
The main decoder method!
[ "The", "main", "decoder", "method!" ]
[ "\"\"\"\n The main decoder method!\n\n All inputs from the Input module will be sent here for decoding.\n\n As of now, we utilise a synchronous model for sequencer decoding,\n meaning that only one thread is used, and queues are not used.\n\n This means that all input will be sent...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
freq_conv
<not_specific>
def freq_conv(self, middle_pitch=440.0): """ Converts our notes values into frequencies. We utilise the following algorithm: f = mp * 2 ^ ((o * 12 + s) / 12) Where: f = Frequency of the given number mp = Middle Pitch - Usually A4 or 440.0 o = The octa...
Converts our notes values into frequencies. We utilise the following algorithm: f = mp * 2 ^ ((o * 12 + s) / 12) Where: f = Frequency of the given number mp = Middle Pitch - Usually A4 or 440.0 o = The octave we are on s = Steps away from the middle p...
Converts our notes values into frequencies. We utilise the following algorithm. f = Frequency of the given number mp = Middle Pitch - Usually A4 or 440.0 o = The octave we are on s = Steps away from the middle pitch The user can select their own middle pitch, although it is highly recommended to keep it the way i...
[ "Converts", "our", "notes", "values", "into", "frequencies", ".", "We", "utilise", "the", "following", "algorithm", ".", "f", "=", "Frequency", "of", "the", "given", "number", "mp", "=", "Middle", "Pitch", "-", "Usually", "A4", "or", "440", ".", "0", "o"...
def freq_conv(self, middle_pitch=440.0): return middle_pitch * pow(2, (((self.octave * 12) + self.step) / 12))
[ "def", "freq_conv", "(", "self", ",", "middle_pitch", "=", "440.0", ")", ":", "return", "middle_pitch", "*", "pow", "(", "2", ",", "(", "(", "(", "self", ".", "octave", "*", "12", ")", "+", "self", ".", "step", ")", "/", "12", ")", ")" ]
Converts our notes values into frequencies.
[ "Converts", "our", "notes", "values", "into", "frequencies", "." ]
[ "\"\"\"\n Converts our notes values into frequencies.\n\n We utilise the following algorithm:\n\n f = mp * 2 ^ ((o * 12 + s) / 12)\n\n Where:\n\n f = Frequency of the given number\n mp = Middle Pitch - Usually A4 or 440.0\n o = The octave we are on\n s = Steps...
[ { "param": "self", "type": null }, { "param": "middle_pitch", "type": null } ]
{ "returns": [ { "docstring": "The frequency of the note in hertz", "docstring_tokens": [ "The", "frequency", "of", "the", "note", "in", "hertz" ], "type": "float" } ], "raises": [], "params": [ { "identifier": "se...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
from_freq
<not_specific>
def from_freq(cls, freq, middle_pitch=440.0): """ Creates a 'Note' from a given frequency. We convert the given frequency 'Note' values by determining the number of half steps from the given frequency and the middle pitch, and then splitting that value up into separate values. ...
Creates a 'Note' from a given frequency. We convert the given frequency 'Note' values by determining the number of half steps from the given frequency and the middle pitch, and then splitting that value up into separate values. :param freq: Frequency in hertz :type fre...
Creates a 'Note' from a given frequency. We convert the given frequency 'Note' values by determining the number of half steps from the given frequency and the middle pitch, and then splitting that value up into separate values.
[ "Creates", "a", "'", "Note", "'", "from", "a", "given", "frequency", ".", "We", "convert", "the", "given", "frequency", "'", "Note", "'", "values", "by", "determining", "the", "number", "of", "half", "steps", "from", "the", "given", "frequency", "and", "...
def from_freq(cls, freq, middle_pitch=440.0): steps = int(log(freq/middle_pitch, 2)) octv, step = cls.convert(steps) return cls(octv, step)
[ "def", "from_freq", "(", "cls", ",", "freq", ",", "middle_pitch", "=", "440.0", ")", ":", "steps", "=", "int", "(", "log", "(", "freq", "/", "middle_pitch", ",", "2", ")", ")", "octv", ",", "step", "=", "cls", ".", "convert", "(", "steps", ")", "...
Creates a 'Note' from a given frequency.
[ "Creates", "a", "'", "Note", "'", "from", "a", "given", "frequency", "." ]
[ "\"\"\"\n Creates a 'Note' from a given frequency.\n\n We convert the given frequency 'Note' values\n by determining the number of half steps from the given frequency and the middle pitch,\n and then splitting that value up into separate values.\n\n :param freq: Frequency in hertz...
[ { "param": "cls", "type": null }, { "param": "freq", "type": null }, { "param": "middle_pitch", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "Note" } ], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
from_num
<not_specific>
def from_num(cls, num): """ Creates a Note object from a number of steps away from A. Under the hood, we convert the number into pysynth notation, and then create an instance with those values :param num: Number to use when creating :type num: int :return: Note...
Creates a Note object from a number of steps away from A. Under the hood, we convert the number into pysynth notation, and then create an instance with those values :param num: Number to use when creating :type num: int :return: Note object representing the inputted nu...
Creates a Note object from a number of steps away from A. Under the hood, we convert the number into pysynth notation, and then create an instance with those values
[ "Creates", "a", "Note", "object", "from", "a", "number", "of", "steps", "away", "from", "A", ".", "Under", "the", "hood", "we", "convert", "the", "number", "into", "pysynth", "notation", "and", "then", "create", "an", "instance", "with", "those", "values" ...
def from_num(cls, num): octave, step = cls.convert(num) return cls(octave, step)
[ "def", "from_num", "(", "cls", ",", "num", ")", ":", "octave", ",", "step", "=", "cls", ".", "convert", "(", "num", ")", "return", "cls", "(", "octave", ",", "step", ")" ]
Creates a Note object from a number of steps away from A.
[ "Creates", "a", "Note", "object", "from", "a", "number", "of", "steps", "away", "from", "A", "." ]
[ "\"\"\"\n Creates a Note object from a number of steps away from A.\n\n Under the hood, we convert the number into pysynth notation,\n and then create an instance with those values\n\n :param num: Number to use when creating\n :type num: int\n :return: Note object represent...
[ { "param": "cls", "type": null }, { "param": "num", "type": null } ]
{ "returns": [ { "docstring": "Note object representing the inputted number", "docstring_tokens": [ "Note", "object", "representing", "the", "inputted", "number" ], "type": "Note" } ], "raises": [], "params": [ { "identifi...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
_bind
null
def _bind(self, com, seq): """ Binds the sequencer command instance, and sequencer instances to this object. This is called upon adding the event. :param com: SeqCommand instance we are attached to :type com: SeqCommand :param seq: Sequencer instance we are con...
Binds the sequencer command instance, and sequencer instances to this object. This is called upon adding the event. :param com: SeqCommand instance we are attached to :type com: SeqCommand :param seq: Sequencer instance we are controlling :type seq: Sequencer ...
Binds the sequencer command instance, and sequencer instances to this object. This is called upon adding the event.
[ "Binds", "the", "sequencer", "command", "instance", "and", "sequencer", "instances", "to", "this", "object", ".", "This", "is", "called", "upon", "adding", "the", "event", "." ]
def _bind(self, com, seq): self.seq = seq self.seq_com = com if self.name is None: self.name = self.seq_com.name
[ "def", "_bind", "(", "self", ",", "com", ",", "seq", ")", ":", "self", ".", "seq", "=", "seq", "self", ".", "seq_com", "=", "com", "if", "self", ".", "name", "is", "None", ":", "self", ".", "name", "=", "self", ".", "seq_com", ".", "name" ]
Binds the sequencer command instance, and sequencer instances to this object.
[ "Binds", "the", "sequencer", "command", "instance", "and", "sequencer", "instances", "to", "this", "object", "." ]
[ "\"\"\"\n Binds the sequencer command instance,\n and sequencer instances to this object.\n\n This is called upon adding the event.\n\n :param com: SeqCommand instance we are attached to\n :type com: SeqCommand\n :param seq: Sequencer instance we are controlling\n :t...
[ { "param": "self", "type": null }, { "param": "com", "type": null }, { "param": "seq", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "com", "type": null, "docstring": "SeqCommand instance we are attach...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
_set_start
null
def _set_start(self, start): """ Sets the starting time for this object. We also take this opportunity to calculate the absolute stop time using the legnth. """ # Start time of this event: self.time_start = start # Stop time of this event: s...
Sets the starting time for this object. We also take this opportunity to calculate the absolute stop time using the legnth.
Sets the starting time for this object. We also take this opportunity to calculate the absolute stop time using the legnth.
[ "Sets", "the", "starting", "time", "for", "this", "object", ".", "We", "also", "take", "this", "opportunity", "to", "calculate", "the", "absolute", "stop", "time", "using", "the", "legnth", "." ]
def _set_start(self, start): self.time_start = start self.time_stop = start + self.length
[ "def", "_set_start", "(", "self", ",", "start", ")", ":", "self", ".", "time_start", "=", "start", "self", ".", "time_stop", "=", "start", "+", "self", ".", "length" ]
Sets the starting time for this object.
[ "Sets", "the", "starting", "time", "for", "this", "object", "." ]
[ "\"\"\"\n Sets the starting time for this object.\n\n We also take this opportunity to calculate\n the absolute stop time using the legnth. \n \"\"\"", "# Start time of this event:", "# Stop time of this event:" ]
[ { "param": "self", "type": null }, { "param": "start", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "start", "type": null, "docstring": null, "docstring_tokens": ...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
run
null
def run(self): """ Main run method, all your logic should reside here! This is the function that SeqCommand will invoke when running, and where this event should do it's operations. We accept no parameters, they should have been passed upon instantiation. """ ...
Main run method, all your logic should reside here! This is the function that SeqCommand will invoke when running, and where this event should do it's operations. We accept no parameters, they should have been passed upon instantiation.
Main run method, all your logic should reside here. This is the function that SeqCommand will invoke when running, and where this event should do it's operations. We accept no parameters, they should have been passed upon instantiation.
[ "Main", "run", "method", "all", "your", "logic", "should", "reside", "here", ".", "This", "is", "the", "function", "that", "SeqCommand", "will", "invoke", "when", "running", "and", "where", "this", "event", "should", "do", "it", "'", "s", "operations", "."...
def run(self): raise NotImplementedError("Must be overridden in child class!")
[ "def", "run", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "\"Must be overridden in child class!\"", ")" ]
Main run method, all your logic should reside here!
[ "Main", "run", "method", "all", "your", "logic", "should", "reside", "here!" ]
[ "\"\"\"\n Main run method, all your logic should reside here!\n\n This is the function that SeqCommand will invoke when running,\n and where this event should do it's operations.\n\n We accept no parameters, they should have been passed upon instantiation.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
run
<not_specific>
def run(self): """ We toggle the given note to be on. If length is not given, then the note will not be stopped. """ # Toggle the note: print("Starting note: {}".format(self.note)) self.seq.start_note(self.note, name=self.name, time_start=self.time_start + se...
We toggle the given note to be on. If length is not given, then the note will not be stopped.
We toggle the given note to be on. If length is not given, then the note will not be stopped.
[ "We", "toggle", "the", "given", "note", "to", "be", "on", ".", "If", "length", "is", "not", "given", "then", "the", "note", "will", "not", "be", "stopped", "." ]
def run(self): print("Starting note: {}".format(self.note)) self.seq.start_note(self.note, name=self.name, time_start=self.time_start + self.seq_com.offset, time_stop=self.time_stop + self.seq_com.offset, velocity=self.velocity) return
[ "def", "run", "(", "self", ")", ":", "print", "(", "\"Starting note: {}\"", ".", "format", "(", "self", ".", "note", ")", ")", "self", ".", "seq", ".", "start_note", "(", "self", ".", "note", ",", "name", "=", "self", ".", "name", ",", "time_start", ...
We toggle the given note to be on.
[ "We", "toggle", "the", "given", "note", "to", "be", "on", "." ]
[ "\"\"\"\n We toggle the given note to be on.\n\n If length is not given, then the note will not be stopped.\n \"\"\"", "# Toggle the note:" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
run
null
def run(self): """ We toggle the given note to off. """ # Turn the note off: self.seq.stop_note(self.note, name=self.name, time_stop=self.time_stop)
We toggle the given note to off.
We toggle the given note to off.
[ "We", "toggle", "the", "given", "note", "to", "off", "." ]
def run(self): self.seq.stop_note(self.note, name=self.name, time_stop=self.time_stop)
[ "def", "run", "(", "self", ")", ":", "self", ".", "seq", ".", "stop_note", "(", "self", ".", "note", ",", "name", "=", "self", ".", "name", ",", "time_stop", "=", "self", ".", "time_stop", ")" ]
We toggle the given note to off.
[ "We", "toggle", "the", "given", "note", "to", "off", "." ]
[ "\"\"\"\n We toggle the given note to off.\n \"\"\"", "# Turn the note off:" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
run
null
def run(self): """ We toggle the notes in the chord on for the given length. """ for note in self.notes: # Toggle the note to on: self.seq.start_note(note, name=self.name, time_start=self.time_start + self.seq_com.offset, time_stop=self.ti...
We toggle the notes in the chord on for the given length.
We toggle the notes in the chord on for the given length.
[ "We", "toggle", "the", "notes", "in", "the", "chord", "on", "for", "the", "given", "length", "." ]
def run(self): for note in self.notes: self.seq.start_note(note, name=self.name, time_start=self.time_start + self.seq_com.offset, time_stop=self.time_stop + self.seq_com.offset)
[ "def", "run", "(", "self", ")", ":", "for", "note", "in", "self", ".", "notes", ":", "self", ".", "seq", ".", "start_note", "(", "note", ",", "name", "=", "self", ".", "name", ",", "time_start", "=", "self", ".", "time_start", "+", "self", ".", "...
We toggle the notes in the chord on for the given length.
[ "We", "toggle", "the", "notes", "in", "the", "chord", "on", "for", "the", "given", "length", "." ]
[ "\"\"\"\n We toggle the notes in the chord on\n for the given length.\n \"\"\"", "# Toggle the note to on:" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
note
null
def note(self, num, length, index=-1, name=None, velocity=1): """ We schedule a note event with the given note number, length, and index of the event to add. The 'num' parameter can be a integer, or a 'Note' object. If it is an integer, then it will be converted into a note. ...
We schedule a note event with the given note number, length, and index of the event to add. The 'num' parameter can be a integer, or a 'Note' object. If it is an integer, then it will be converted into a note. The 'length' is the length of the note. We will block and r...
We schedule a note event with the given note number, length, and index of the event to add. The 'num' parameter can be a integer, or a 'Note' object. If it is an integer, then it will be converted into a note. The 'length' is the length of the note. We will block and remove the note at the end of this time. Index is...
[ "We", "schedule", "a", "note", "event", "with", "the", "given", "note", "number", "length", "and", "index", "of", "the", "event", "to", "add", ".", "The", "'", "num", "'", "parameter", "can", "be", "a", "integer", "or", "a", "'", "Note", "'", "object...
def note(self, num, length, index=-1, name=None, velocity=1): if type(num) != Note: num = Note.from_num(num) self.add_event(NoteOn(num, length, name=name, velocity=velocity), index)
[ "def", "note", "(", "self", ",", "num", ",", "length", ",", "index", "=", "-", "1", ",", "name", "=", "None", ",", "velocity", "=", "1", ")", ":", "if", "type", "(", "num", ")", "!=", "Note", ":", "num", "=", "Note", ".", "from_num", "(", "nu...
We schedule a note event with the given note number, length, and index of the event to add.
[ "We", "schedule", "a", "note", "event", "with", "the", "given", "note", "number", "length", "and", "index", "of", "the", "event", "to", "add", "." ]
[ "\"\"\"\n We schedule a note event with the given note number,\n length, and index of the event to add.\n\n The 'num' parameter can be a integer, or a 'Note' object.\n If it is an integer, then it will be converted into a note.\n\n The 'length' is the length of the note.\n ...
[ { "param": "self", "type": null }, { "param": "num", "type": null }, { "param": "length", "type": null }, { "param": "index", "type": null }, { "param": "name", "type": null }, { "param": "velocity", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "num", "type": null, "docstring": "Number of the note to play", ...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
rest
null
def rest(self, length, index=-1): """ Adds a rest event of given length. This adds a period of empty time to the SeqCommand, meaning that any notes scheduled after this event will not start during this period. The decoder can manually schedule notes during this time, ...
Adds a rest event of given length. This adds a period of empty time to the SeqCommand, meaning that any notes scheduled after this event will not start during this period. The decoder can manually schedule notes during this time, and they will be invoked normally. ...
Adds a rest event of given length. This adds a period of empty time to the SeqCommand, meaning that any notes scheduled after this event will not start during this period. The decoder can manually schedule notes during this time, and they will be invoked normally.
[ "Adds", "a", "rest", "event", "of", "given", "length", ".", "This", "adds", "a", "period", "of", "empty", "time", "to", "the", "SeqCommand", "meaning", "that", "any", "notes", "scheduled", "after", "this", "event", "will", "not", "start", "during", "this",...
def rest(self, length, index=-1): self.add_event(Rest(length), index)
[ "def", "rest", "(", "self", ",", "length", ",", "index", "=", "-", "1", ")", ":", "self", ".", "add_event", "(", "Rest", "(", "length", ")", ",", "index", ")" ]
Adds a rest event of given length.
[ "Adds", "a", "rest", "event", "of", "given", "length", "." ]
[ "\"\"\"\n Adds a rest event of given length.\n\n This adds a period of empty time to the SeqCommand,\n meaning that any notes scheduled after this event\n will not start during this period.\n\n The decoder can manually schedule notes during this time,\n and they will be inv...
[ { "param": "self", "type": null }, { "param": "length", "type": null }, { "param": "index", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "length", "type": null, "docstring": "Time to rest for", "docs...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
repeat
null
def repeat(self, pos, num, index=-1): """ Repeats back to the given index a number of time. If the number of times is -1, then we will repeat indefinitely. :param pos: Index to repeat back to :type pos: int :param num: Number of times to repeat :type nu...
Repeats back to the given index a number of time. If the number of times is -1, then we will repeat indefinitely. :param pos: Index to repeat back to :type pos: int :param num: Number of times to repeat :type num: int :param index: Index to add the even...
Repeats back to the given index a number of time. If the number of times is -1, then we will repeat indefinitely.
[ "Repeats", "back", "to", "the", "given", "index", "a", "number", "of", "time", ".", "If", "the", "number", "of", "times", "is", "-", "1", "then", "we", "will", "repeat", "indefinitely", "." ]
def repeat(self, pos, num, index=-1): self.add_event(Repeat(pos, num), index)
[ "def", "repeat", "(", "self", ",", "pos", ",", "num", ",", "index", "=", "-", "1", ")", ":", "self", ".", "add_event", "(", "Repeat", "(", "pos", ",", "num", ")", ",", "index", ")" ]
Repeats back to the given index a number of time.
[ "Repeats", "back", "to", "the", "given", "index", "a", "number", "of", "time", "." ]
[ "\"\"\"\n Repeats back to the given index a number of time.\n\n If the number of times is -1,\n then we will repeat indefinitely.\n\n :param pos: Index to repeat back to\n :type pos: int\n :param num: Number of times to repeat\n :type num: int\n :param index: ...
[ { "param": "self", "type": null }, { "param": "pos", "type": null }, { "param": "num", "type": null }, { "param": "index", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pos", "type": null, "docstring": "Index to repeat back to", "...
cd8686d042220a4d6caaf024f7298aab7bc3ab67
monarrk/python-audio-synth
pysynth/seq.py
[ "MIT" ]
Python
chord
null
def chord(self, notes, length, index=-1, name=None): """ Creates a chord with a given length. We do this by creating a Chord event. :param notes: Notes to be included in the chord :type notes: list :param length: Length of the chord :type length: float ...
Creates a chord with a given length. We do this by creating a Chord event. :param notes: Notes to be included in the chord :type notes: list :param length: Length of the chord :type length: float :param index: Index to add the event at :type index: int ...
Creates a chord with a given length. We do this by creating a Chord event.
[ "Creates", "a", "chord", "with", "a", "given", "length", ".", "We", "do", "this", "by", "creating", "a", "Chord", "event", "." ]
def chord(self, notes, length, index=-1, name=None): for num, note in enumerate(notes): if type(note) != Note: note = Note.from_num(note) notes[num] = note print("Creating chord with notes: {}".format(notes)) self.add_event(Chord(notes, length, name=na...
[ "def", "chord", "(", "self", ",", "notes", ",", "length", ",", "index", "=", "-", "1", ",", "name", "=", "None", ")", ":", "for", "num", ",", "note", "in", "enumerate", "(", "notes", ")", ":", "if", "type", "(", "note", ")", "!=", "Note", ":", ...
Creates a chord with a given length.
[ "Creates", "a", "chord", "with", "a", "given", "length", "." ]
[ "\"\"\"\n Creates a chord with a given length.\n\n We do this by creating a Chord event.\n\n :param notes: Notes to be included in the chord\n :type notes: list\n :param length: Length of the chord\n :type length: float\n :param index: Index to add the event at\n ...
[ { "param": "self", "type": null }, { "param": "notes", "type": null }, { "param": "length", "type": null }, { "param": "index", "type": null }, { "param": "name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "notes", "type": null, "docstring": "Notes to be included in the cho...