public interface LexicalHandler
This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY. See http://www.saxproject.org for further information.
This is an optional extension handler for SAX2 to provide lexical information about an XML document, such as comments and CDATA section boundaries. XML readers are not required to recognize this handler, and it is not part of core-only SAX2 distributions.
The events in the lexical handler apply to the entire document, not just to the document element, and all lexical handler events must appear between the content handler's startDocument and endDocument events.
To set the LexicalHandler for an XML reader, use the
setProperty
method
with the property name
http://xml.org/sax/properties/lexical-handler
and an object implementing this interface (or null) as the value.
If the reader does not report lexical events, it will throw a
SAXNotRecognizedException
when you attempt to register the handler.
| Modifier and Type | Method and Description |
|---|---|
void |
comment(char[] ch,
int start,
int length)
Report an XML comment anywhere in the document.
|
void |
endCDATA()
Report the end of a CDATA section.
|
void |
endDTD()
Report the end of DTD declarations.
|
void |
endEntity(String name)
Report the end of an entity.
|
void |
startCDATA()
Report the start of a CDATA section.
|
void |
startDTD(String name,
String publicId,
String systemId)
Report the start of DTD declarations, if any.
|
void |
startEntity(String name)
Report the beginning of some internal and external XML entities.
|
void startDTD(String name, String publicId, String systemId) throws SAXException
This method is intended to report the beginning of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked.
All declarations reported through
DTDHandler
or
DeclHandler
events must appear
between the startDTD and endDTD
events.
Declarations are assumed to belong to the internal DTD subset
unless they appear between startEntity
and endEntity
events. Comments and
processing instructions from the DTD should also be reported
between the startDTD and endDTD events, in their original
order of (logical) occurrence; they are not required to
appear in their correct locations relative to DTDHandler
or DeclHandler events, however.
Note that the start/endDTD events will appear within
the start/endDocument events from ContentHandler and
before the first
startElement
event.
name
- The document type name.publicId
- The declared public identifier for the
external DTD subset, or null if none was declared.systemId
- The declared system identifier for the
external DTD subset, or null if none was declared.
(Note that this is not resolved against the document
base URI.)SAXException
- The application may raise an
exception.endDTD()
,
startEntity(java.lang.String)
void endDTD() throws SAXException
This method is intended to report the end of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked.
SAXException
- The application may raise an exception.startDTD(java.lang.String, java.lang.String, java.lang.String)
void startEntity(String name) throws SAXException
The reporting of parameter entities (including
the external DTD subset) is optional, and SAX2 drivers that
report LexicalHandler events may not implement it; you can use the
http://xml.org/sax/features/lexical-handler/parameter-entities
feature to query or control the reporting of parameter entities.
General entities are reported with their regular names, parameter entities have '%' prepended to their names, and the external DTD subset has the pseudo-entity name "[dtd]".
When a SAX2 driver is providing these events, all other
events must be properly nested within start/end entity
events. There is no additional requirement that events from
DeclHandler
or
DTDHandler
be properly ordered.
Note that skipped entities will be reported through the
skippedEntity
event, which is part of the ContentHandler interface.
Because of the streaming event model that SAX uses, some entity boundaries cannot be reported under any circumstances:
These will be silently expanded, with no indication of where the original entity boundaries were.
Note also that the boundaries of character references (which are not really entities anyway) are not reported.
All start/endEntity events must be properly nested.
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%', and if it is the
external DTD subset, it will be "[dtd]".SAXException
- The application may raise an exception.endEntity(java.lang.String)
,
DeclHandler.internalEntityDecl(java.lang.String, java.lang.String)
,
DeclHandler.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
void endEntity(String name) throws SAXException
name
- The name of the entity that is ending.SAXException
- The application may raise an exception.startEntity(java.lang.String)
void startCDATA() throws SAXException
The contents of the CDATA section will be reported through
the regular characters
event; this event is intended only to report
the boundary.
SAXException
- The application may raise an exception.endCDATA()
void endCDATA() throws SAXException
SAXException
- The application may raise an exception.startCDATA()
void comment(char[] ch, int start, int length) throws SAXException
This callback will be used for comments inside or outside the document element, including comments in the external DTD subset (if read). Comments in the DTD must be properly nested inside start/endDTD and start/endEntity events (if used).
ch
- An array holding the characters in the comment.start
- The starting position in the array.length
- The number of characters to use from the array.SAXException
- The application may raise an exception. Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2015, Oracle and/or its affiliates. All rights reserved.


About me
I’m an PhD candidate in the Kim Jaechul Graduate School of AI at Korea Advanced Institute of Science and Technology (KAIST AI), advised by Prof. Se-young Yun. Prior to beginning of my PhD course, I worked as a research engineer at Samsung Heavy Industires. I recieved an M.S. in Ocean system engieerning from KAIST under the supervision of Prof. Hyun Chung and B.S in Industrial engineering at Konkuk University. My research interests focus on meta-learning, bayesian non-parameteric models, multi-agent reinforcement learning and their applications. Here is my CV.
Contact
Email : callingu [at] kaist.ac.kr
Research experience
[2014~2019] Research engineer at Samsung Heavy Industries
Awards
[2021] 2nd Winner in Student track at Machine Learning for Combinatorial Optimization Challenge (ML4CO) in NeurIPS2021 (Team : KAIST_OSI, Team leader).
[2016] Outstanding Project for Increasing Productivity at Samsung Heavy Industires.
Conference Publications (Peer reviewed)
Neural Processes with Stochastic Attention: Paying more attention to the context dataset
[paper][code][video]
Mingyu Kim, Kyeong Ryeol Go and Se-Young Yun
International Conference on Learning Representations (ICLR) 2022, Virtual
Workshop Publications (Peer reviewed)
The StarCraft Multi-Agent Challenges+ : Learning Multi-Stage Tasks and Environmental Factors without Precise Reward Functions
[paper][code]
Mingyu Kim*, Jihwan Oh*, Yongsik Lee, Joonkee Kim, SeongHwan Kim, Song Chong and Se-Young Yun
AI for Agent Based Modeling Workshop(Spotlight) in International Conference on Machine Learning (ICML) 2022, Baltimore
AVATAR: AI Vision Analysis for Three-dimensional Action in Real-time
To appear
Daegun Kim*, Jineun Kim*, Wongyo Jung*, Jungoon Park*, Mingyu Kim*, Anna Shin, Yong-Cheol Jeong, Seahyung Park, Gwanhoo Shin, Yewon Lee, Jea Kwon, Daesoo Kim
CV4Animals Workshop in Computer Vision and Pattern Recognition Conference (CVPR) 2022, New Orleans
Neural Processes with Stochastic Attention: Paying more attention to the context dataset
[paper][code]
Mingyu Kim, Kyeong Ryeol Go and Se-Young Yun
5th Meta-learn Workshop in Neural Information Processing Systems (NeurIPS) 2021, Virtual
Journal Publications (Peer reviewed)
Simplified welding distortion analysis for fillet welding using composite shell elements
[paper]
Mingyu Kim, Minseok Kang and Hyun Chung
International Journal of Naval Architecture and Ocean Engineering, Vol. 7(3), 2015
Optimization of P.E area division and arrangement based on product mix
[paper]
Sanghwan Kim, Mingyu Kim and Hyun Chung
Journal of Marine Science and Technology, Vol. 19(4), 2014
Optimization of Quantity Allocation using Integer Linear Programming in Shipbuilding Industry
[paper]
Junggoo Park, Mingyu Kim
Journal of the Society of Naval Architecture of Korea (Domestic), Vol. 57(1), 2020
A Study on Process Management Method of Offshore Plant Piping Material using Process Mining Technique
[paper]
Junggoo Park, Hojung Kim, Mingyu Kim, Jichan Park
Journal of the Society of Naval Architecture of Korea (Domestic), Vol. 56(2), 2019
A Study on the Installation Readiness Management Method of Offshore Plant using CAD Information
[paper]
Junggoo Park, Hojung Kim, Mingyu Kim, Jichan Park
Journal of the Society of Naval Architecture of Korea (Domestic), Vol. 56(2), 2019
A Study on the Utilization Strategy of Social Commerce in Small Restaurants
[paper]
Sungseok Ko, Mingyu Kim, Yungjin Yoo, Seoksul Kim
Journal of the Society of Korea Industrial and Systems Engineering (Domestic), Vol. 35(1), 2012


All flush and sync functions can be called only within passive target epochs.
| MPI_WIN_FLUSH(rank, win) | |
| IN rank | rank of target window (non-negative integer) |
| IN win | window object (handle) |
int MPI_Win_flush(int rank, MPI_Win win)
MPI_Win_flush(rank, win, ierror)
INTEGER, INTENT(IN) :: rank
TYPE(MPI_Win), INTENT(IN) :: win
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
MPI_WIN_FLUSH(RANK, WIN, IERROR)
INTEGER RANK, WIN, IERROR
MPI_WIN_FLUSH completes all outstanding RMA operations initiated by the calling process to the target rank on the specified window. The operations are completed both at the origin and at the target.
| MPI_WIN_FLUSH_ALL(win) | |
| IN win | window object (handle) |
int MPI_Win_flush_all(MPI_Win win)
MPI_Win_flush_all(win, ierror)
TYPE(MPI_Win), INTENT(IN) :: win
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
MPI_WIN_FLUSH_ALL(WIN, IERROR)
INTEGER WIN, IERROR
All RMA operations issued by the calling process to any target on the specified window prior to this call and in the specified window will have completed both at the origin and at the target when this call returns.
| MPI_WIN_FLUSH_LOCAL(rank, win) | |
| IN rank | rank of target window (non-negative integer) |
| IN win | window object (handle) |
int MPI_Win_flush_local(int rank, MPI_Win win)
MPI_Win_flush_local(rank, win, ierror)
INTEGER, INTENT(IN) :: rank
TYPE(MPI_Win), INTENT(IN) :: win
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
MPI_WIN_FLUSH_LOCAL(RANK, WIN, IERROR)
INTEGER RANK, WIN, IERROR
Locally completes at the origin all outstanding RMA operations initiated by the calling process to the target process specified by rank on the specified window. For example, after this routine completes, the user may reuse any buffers provided to put, get, or accumulate operations.
| MPI_WIN_FLUSH_LOCAL_ALL(win) | |
| IN win | window object (handle) |
int MPI_Win_flush_local_all(MPI_Win win)
MPI_Win_flush_local_all(win, ierror)
TYPE(MPI_Win), INTENT(IN) :: win
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
MPI_WIN_FLUSH_LOCAL_ALL(WIN, IERROR)
INTEGER WIN, IERROR
All RMA operations issued to any target prior to this call in this window will have completed at the origin when MPI_WIN_FLUSH_LOCAL_ALL returns.
| MPI_WIN_SYNC(win) | |
| IN win | window object (handle) |
int MPI_Win_sync(MPI_Win win)
MPI_Win_sync(win, ierror)
TYPE(MPI_Win), INTENT(IN) :: win
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
MPI_WIN_SYNC(WIN, IERROR)
INTEGER WIN, IERROR
The call MPI_WIN_SYNC synchronizes the private and public window copies of win. For the purposes of synchronizing the private and public window, MPI_WIN_SYNC has the effect of ending and reopening an access and exposure epoch on the window (note that it does not actually end an epoch or complete any pending MPI RMA operations).


touch-action
scrollingborrowed/adapted from Matt Gaunt's Touch Action Options. visually illustrates effect of various touch-action
values on browser's default scroll behavior. below are containers with overflow: auto
, containing coloured boxes – notice how touch-action
influences the kind of interaction the browser handles/allows. the intercepted movements (which are not handled by the browser) could then be intercepted by Pointer Events in JavaScript (not shown here).
touch-action: auto
touch-action: none
touch-action: pan-x
touch-action: pan-y
touch-action: pan-right
touch-action: pan-down
touch-action: pan-x pinch-zoom


pandas docstring guide
About docstrings and standards
A Python docstring is a string used to document a Python module, class, function or method, so programmers can understand what it does without having to read the details of the implementation.
Also, it is a common practice to generate online (html) documentation automatically from docstrings. Sphinx serves this purpose.
Next example gives an idea on how a docstring looks like:
def add(num1, num2):
"""
Add up two integer numbers.
This function simply wraps the `+` operator, and does not
do anything interesting, except for illustrating what is
the docstring of a very simple function.
Parameters
----------
num1 : int
First number to add
num2 : int
Second number to add
Returns
-------
int
The sum of `num1` and `num2`
See Also
--------
subtract : Subtract one integer from another
Examples
--------
>>> add(2, 2)
4
>>> add(25, 0)
25
>>> add(10, -10)
0
"""
return num1 + num2
Some standards exist about docstrings, so they are easier to read, and they can be exported to other formats such as html or pdf.
The first conventions every Python docstring should follow are defined in PEP-257.
As PEP-257 is quite open, and some other standards exist on top of it. In the case of pandas, the numpy docstring convention is followed. The conventions is explained in this document:
- numpydoc docstring guide (which is based in the original Guide to NumPy/SciPy documentation)
numpydoc is a Sphinx extension to support the numpy docstring convention.
The standard uses reStructuredText (reST). reStructuredText is a markup language that allows encoding styles in plain text files. Documentation about reStructuredText can be found in:
Pandas has some helpers for sharing docstrings between related classes, see docstring sharing.
The rest of this document will summarize all the above guides, and will provide additional convention specific to the pandas project.
Writing a docstring
General rules
Docstrings must be defined with three double-quotes. No blank lines should be left before or after the docstring. The text starts in the next line after the opening quotes. The closing quotes have their own line (meaning that they are not at the end of the last sentence).
In rare occasions reST styles like bold text or italics will be used in docstrings, but is it common to have inline code, which is presented between backticks. It is considered inline code:
- The name of a parameter
- Python code, a module, function, built-in, type, literal... (e.g.
os
,list
,numpy.abs
,datetime.date
,True
) - A pandas class (in the form
:class:`pandas.Series
`) - A pandas method (in the form
:meth:`pandas.Series.sum
`) - A pandas function (in the form
:func:`pandas.to_datetime
`)
To display only the last component of the linked class, method or
function, prefix it with ~
. For example, :class:`~pandas.Series
will link to pandas.Series
but only display the last part, Series
as the link text. See
Sphinx cross-referencing syntax
for details.
Good:
def add_values(arr):
"""
Add the values in `arr`.
This is equivalent to Python `sum` of :meth:`pandas.Series.sum`.
Some sections are omitted here for simplicity.
"""
return sum(arr)
Bad:
def func():
"""Some function.
With several mistakes in the docstring.
It has a blank like after the signature `def func():`.
The text 'Some function' should go in the line after the
opening quotes of the docstring, not in the same line.
There is a blank line between the docstring and the first line
of code `foo = 1`.
The closing quotes should be in the next line, not in this one."""
foo = 1
bar = 2
return foo + bar
Section 1: Short summary
The short summary is a single sentence that expresses what the function does in a concise way.
The short summary must start with a capital letter, end with a dot, and fit in a single line. It needs to express what the object does without providing details. For functions and methods, the short summary must start with an infinitive verb.
Good:
def astype(dtype):
"""
Cast Series type.
This section will provide further details.
"""
pass
Bad:
def astype(dtype):
"""
Casts Series type.
Verb in third-person of the present simple, should be infinitive.
"""
pass
def astype(dtype):
"""
Method to cast Series type.
Does not start with verb.
"""
pass
def astype(dtype):
"""
Cast Series type
Missing dot at the end.
"""
pass
def astype(dtype):
"""
Cast Series type from its current type to the new type defined in
the parameter dtype.
Summary is too verbose and doesn't fit in a single line.
"""
pass
Section 2: Extended summary
The extended summary provides details on what the function does. It should not go into the details of the parameters, or discuss implementation notes, which go in other sections.
A blank line is left between the short summary and the extended summary. And every paragraph in the extended summary is finished by a dot.
The extended summary should provide details on why the function is useful and their use cases, if it is not too generic.
def unstack():
"""
Pivot a row index to columns.
When using a MultiIndex, a level can be pivoted so each value in
the index becomes a column. This is especially useful when a subindex
is repeated for the main index, and data is easier to visualize as a
pivot table.
The index level will be automatically removed from the index when added
as columns.
"""
pass
Section 3: Parameters
The details of the parameters will be added in this section. This section has the title \"Parameters\", followed by a line with a hyphen under each letter of the word \"Parameters\". A blank line is left before the section title, but not after, and not between the line with the word \"Parameters\" and the one with the hyphens.
After the title, each parameter in the signature must be documented,
including *args
and **kwargs
, but not self
.
The parameters are defined by their name, followed by a space, a colon,
another space, and the type (or types). Note that the space between the
name and the colon is important. Types are not defined for
*args
and **kwargs
, but must be defined
for all other parameters. After the parameter definition, it is required
to have a line with the parameter description, which is indented, and
can have multiple lines. The description must start with a capital
letter, and finish with a dot.
For keyword arguments with a default value, the default will be listed after a comma at the end of the type. The exact form of the type in this case will be \"int, default 0\". In some cases it may be useful to explain what the default argument means, which can be added after a comma \"int, default -1, meaning all cpus\".
In cases where the default value is None
, meaning that the
value will not be used. Instead of \"str, default None\", it is
preferred to write \"str, optional\". When None
is a value
being used, we will keep the form \"str, default None\". For example, in
df.to_csv(compression=None)
, None
is not a
value being used, but means that compression is optional, and no
compression is being used if not provided. In this case we will use
str, optional
. Only in cases like
func(value=None)
and None
is being used in
the same way as 0
or foo
would be used, then
we will specify \"str, int or None, default None\".
Good:
class Series:
def plot(self, kind, color='blue', **kwargs):
"""
Generate a plot.
Render the data in the Series as a matplotlib plot of the
specified kind.
Parameters
----------
kind : str
Kind of matplotlib plot.
color : str, default 'blue'
Color name or rgb code.
**kwargs
These parameters will be passed to the matplotlib plotting
function.
"""
pass
Bad:
class Series:
def plot(self, kind, **kwargs):
"""
Generate a plot.
Render the data in the Series as a matplotlib plot of the
specified kind.
Note the blank line between the parameters title and the first
parameter. Also, note that after the name of the parameter `kind`
and before the colon, a space is missing.
Also, note that the parameter descriptions do not start with a
capital letter, and do not finish with a dot.
Finally, the `**kwargs` parameter is missing.
Parameters
----------
kind: str
kind of matplotlib plot
"""
pass
Parameter types
When specifying the parameter types, Python built-in data types can be used directly (the Python type is preferred to the more verbose string, integer, boolean, etc):
- int
- float
- str
- bool
For complex types, define the subtypes. For dict
and
tuple
, as more than one type is present, we use the
brackets to help read the type (curly brackets for dict
and normal brackets for tuple
:
- list of int
- dict of {str : int}
- tuple of (str, int, int)
- tuple of (str,)
- set of str
In case where there are just a set of values allowed, list them in curly brackets and separated by commas (followed by a space). If the values are ordinal and they have an order, list them in this order. Otherwise, list the default value first, if there is one:
- {0, 10, 25}
- {\'simple\', \'advanced\'}
- {\'low\', \'medium\', \'high\'}
- {\'cat\', \'dog\', \'bird\'}
If the type is defined in a Python module, the module must be specified:
- datetime.date
- datetime.datetime
- decimal.Decimal
If the type is in a package, the module must be also specified:
- numpy.ndarray
- scipy.sparse.coo_matrix
If the type is a pandas type, also specify pandas except for Series and DataFrame:
- Series
- DataFrame
- pandas.Index
- pandas.Categorical
- pandas.SparseArray
If the exact type is not relevant, but must be compatible with a numpy array, array-like can be specified. If Any type that can be iterated is accepted, iterable can be used:
- array-like
- iterable
If more than one type is accepted, separate them by commas, except the last two types, that need to be separated by the word \'or\':
- int or float
- float, decimal.Decimal or None
- str or list of str
If None
is one of the accepted values, it always needs to be the last
in the list.
For axis, the convention is to use something like:
- axis : {0 or \'index\', 1 or \'columns\', None}, default None
Section 4: Returns or Yields
If the method returns a value, it will be documented in this section. Also if the method yields its output.
The title of the section will be defined in the same way as the \"Parameters\". With the names \"Returns\" or \"Yields\" followed by a line with as many hyphens as the letters in the preceding word.
The documentation of the return is also similar to the parameters. But in this case, no name will be provided, unless the method returns or yields more than one value (a tuple of values).
The types for \"Returns\" and \"Yields\" are the same as the ones for the \"Parameters\". Also, the description must finish with a dot.
For example, with a single value:
def sample():
"""
Generate and return a random number.
The value is sampled from a continuous uniform distribution between
0 and 1.
Returns
-------
float
Random number generated.
"""
return np.random.random()
With more than one value:
import string
def random_letters():
"""
Generate and return a sequence of random letters.
The length of the returned string is also random, and is also
returned.
Returns
-------
length : int
Length of the returned string.
letters : str
String of random letters.
"""
length = np.random.randint(1, 10)
letters = ''.join(np.random.choice(string.ascii_lowercase)
for i in range(length))
return length, letters
If the method yields its value:
def sample_values():
"""
Generate an infinite sequence of random numbers.
The values are sampled from a continuous uniform distribution between
0 and 1.
Yields
------
float
Random number generated.
"""
while True:
yield np.random.random()
Section 5: See Also
This section is used to let users know about pandas functionality related to the one being documented. In rare cases, if no related methods or functions can be found at all, this section can be skipped.
An obvious example would be the head()
and
tail()
methods. As tail()
does the
equivalent as head()
but at the end of the
Series
or DataFrame
instead of at the
beginning, it is good to let the users know about it.
To give an intuition on what can be considered related, here there are some examples:
loc
andiloc
, as they do the same, but in one case providing indices and in the other positionsmax
andmin
, as they do the oppositeiterrows
,itertuples
anditems
, as it is easy that a user looking for the method to iterate over columns ends up in the method to iterate over rows, and vice-versafillna
anddropna
, as both methods are used to handle missing valuesread_csv
andto_csv
, as they are complementarymerge
andjoin
, as one is a generalization of the otherastype
andpandas.to_datetime
, as users may be reading the documentation ofastype
to know how to cast as a date, and the way to do it is withpandas.to_datetime
where
is related tonumpy.where
, as its functionality is based on it
When deciding what is related, you should mainly use your common sense and think about what can be useful for the users reading the documentation, especially the less experienced ones.
When relating to other libraries (mainly numpy
), use the name of the
module first (not an alias like np
). If the function is in a module
which is not the main one, like scipy.sparse
, list the full module
(e.g. scipy.sparse.coo_matrix
).
This section, as the previous, also has a header, \"See Also\" (note the capital S and A). Also followed by the line with hyphens, and preceded by a blank line.
After the header, we will add a line for each related method or function, followed by a space, a colon, another space, and a short description that illustrated what this method or function does, why is it relevant in this context, and what are the key differences between the documented function and the one referencing. The description must also finish with a dot.
Note that in \"Returns\" and \"Yields\", the description is located in the following line than the type. But in this section it is located in the same line, with a colon in between. If the description does not fit in the same line, it can continue in the next ones, but it has to be indented in them.
For example:
class Series:
def head(self):
"""
Return the first 5 elements of the Series.
This function is mainly useful to preview the values of the
Series without displaying the whole of it.
Returns
-------
Series
Subset of the original series with the 5 first values.
See Also
--------
Series.tail : Return the last 5 elements of the Series.
Series.iloc : Return a slice of the elements in the Series,
which can also be used to return the first or last n.
"""
return self.iloc[:5]
Section 6: Notes
This is an optional section used for notes about the implementation of the algorithm. Or to document technical aspects of the function behavior.
Feel free to skip it, unless you are familiar with the implementation of the algorithm, or you discover some counter-intuitive behavior while writing the examples for the function.
This section follows the same format as the extended summary section.
Section 7: Examples
This is one of the most important sections of a docstring, even if it is placed in the last position. As often, people understand concepts better with examples, than with accurate explanations.
Examples in docstrings, besides illustrating the usage of the function or method, must be valid Python code, that in a deterministic way returns the presented output, and that can be copied and run by users.
They are presented as a session in the Python terminal.
>>>
is used to present code. ...
is used
for code continuing from the previous line. Output is presented
immediately after the last line of code generating the output (no blank
lines in between). Comments describing the examples can be added with
blank lines before and after them.
The way to present examples is as follows:
- Import required libraries (except
numpy
andpandas
) - Create the data required for the example
- Show a very basic example that gives an idea of the most common use case
- Add examples with explanations that illustrate how the parameters can be used for extended functionality
A simple example could be:
class Series:
def head(self, n=5):
"""
Return the first elements of the Series.
This function is mainly useful to preview the values of the
Series without displaying the whole of it.
Parameters
----------
n : int
Number of values to return.
Return
------
pandas.Series
Subset of the original series with the n first values.
See Also
--------
tail : Return the last n elements of the Series.
Examples
--------
>>> s = pd.Series(['Ant', 'Bear', 'Cow', 'Dog', 'Falcon',
... 'Lion', 'Monkey', 'Rabbit', 'Zebra'])
>>> s.head()
0 Ant
1 Bear
2 Cow
3 Dog
4 Falcon
dtype: object
With the `n` parameter, we can change the number of returned rows:
>>> s.head(n=3)
0 Ant
1 Bear
2 Cow
dtype: object
"""
return self.iloc[:n]
The examples should be as concise as possible. In cases where the
complexity of the function requires long examples, is recommended to use
blocks with headers in bold. Use double star **
to make a text bold,
like in **this example**
.
Conventions for the examples
Code in examples is assumed to always start with these two lines which are not shown:
import numpy as np
import pandas as pd
Any other module used in the examples must be explicitly imported, one per line (as recommended in PEP-8 imports) and avoiding aliases. Avoid excessive imports, but if needed, imports from the standard library go first, followed by third-party libraries (like matplotlib).
When illustrating examples with a single Series
use the name s
, and
if illustrating with a single DataFrame
use the name df
. For
indices, idx
is the preferred name. If a set of homogeneous Series
or DataFrame
is used, name them s1
, s2
, s3
... or df1
, df2
,
df3
... If the data is not homogeneous, and more than one structure is
needed, name them with something meaningful, for example df_main
and
df_to_join
.
Data used in the example should be as compact as possible. The number of
rows is recommended to be around 4, but make it a number that makes
sense for the specific example. For example in the head
method, it
requires to be higher than 5, to show the example with the default
values. If doing the mean
, we could use something like [1, 2, 3]
, so
it is easy to see that the value returned is the mean.
For more complex examples (grouping for example), avoid using data without interpretation, like a matrix of random numbers with columns A, B, C, D... And instead use a meaningful example, which makes it easier to understand the concept. Unless required by the example, use names of animals, to keep examples consistent. And numerical properties of them.
When calling the method, keywords arguments head(n=3)
are preferred to
positional arguments head(3)
.
Good:
class Series:
def mean(self):
"""
Compute the mean of the input.
Examples
--------
>>> s = pd.Series([1, 2, 3])
>>> s.mean()
2
"""
pass
def fillna(self, value):
"""
Replace missing values by `value`.
Examples
--------
>>> s = pd.Series([1, np.nan, 3])
>>> s.fillna(0)
[1, 0, 3]
"""
pass
def groupby_mean(self):
"""
Group by index and return mean.
Examples
--------
>>> s = pd.Series([380., 370., 24., 26],
... name='max_speed',
... index=['falcon', 'falcon', 'parrot', 'parrot'])
>>> s.groupby_mean()
index
falcon 375.0
parrot 25.0
Name: max_speed, dtype: float64
"""
pass
def contains(self, pattern, case_sensitive=True, na=numpy.nan):
"""
Return whether each value contains `pattern`.
In this case, we are illustrating how to use sections, even
if the example is simple enough and does not require them.
Examples
--------
>>> s = pd.Series('Antelope', 'Lion', 'Zebra', np.nan)
>>> s.contains(pattern='a')
0 False
1 False
2 True
3 NaN
dtype: bool
**Case sensitivity**
With `case_sensitive` set to `False` we can match `a` with both
`a` and `A`:
>>> s.contains(pattern='a', case_sensitive=False)
0 True
1 False
2 True
3 NaN
dtype: bool
**Missing values**
We can fill missing values in the output using the `na` parameter:
>>> s.contains(pattern='a', na=False)
0 False
1 False
2 True
3 False
dtype: bool
"""
pass
Bad:
def method(foo=None, bar=None):
"""
A sample DataFrame method.
Do not import numpy and pandas.
Try to use meaningful data, when it makes the example easier
to understand.
Try to avoid positional arguments like in `df.method(1)`. They
can be all right if previously defined with a meaningful name,
like in `present_value(interest_rate)`, but avoid them otherwise.
When presenting the behavior with different parameters, do not place
all the calls one next to the other. Instead, add a short sentence
explaining what the example shows.
Examples
--------
>>> import numpy as np
>>> import pandas as pd
>>> df = pd.DataFrame(np.random.randn(3, 3),
... columns=('a', 'b', 'c'))
>>> df.method(1)
21
>>> df.method(bar=14)
123
"""
pass
Tips for getting your examples pass the doctests
Getting the examples pass the doctests in the validation script can sometimes be tricky. Here are some attention points:
- Import all needed libraries (except for pandas and numpy, those are
already imported as
import pandas as pd
andimport numpy as np
) and define all variables you use in the example. -
Try to avoid using random data. However random data might be OK in some cases, like if the function you are documenting deals with probability distributions, or if the amount of data needed to make the function result meaningful is too much, such that creating it manually is very cumbersome. In those cases, always use a fixed random seed to make the generated examples predictable. Example:
>>> np.random.seed(42) >>> df = pd.DataFrame({'normal': np.random.normal(100, 5, 20)})
-
If you have a code snippet that wraps multiple lines, you need to use \'...\' on the continued lines: :
>>> df = pd.DataFrame([[1, 2, 3], [4, 5, 6]], index=['a', 'b', 'c'], ... columns=['A', 'B'])
-
If you want to show a case where an exception is raised, you can do:
>>> pd.to_datetime(["712-01-01"]) Traceback (most recent call last): OutOfBoundsDatetime: Out of bounds nanosecond timestamp: 712-01-01 00:00:00
It is essential to include the \"Traceback (most recent call last):\", but for the actual error only the error name is sufficient.
-
If there is a small part of the result that can vary (e.g. a hash in an object representation), you can use
...
to represent this part.If you want to show that
s.plot()
returns a matplotlib AxesSubplot object, this will fail the doctest :>>> s.plot() <matplotlib.axes._subplots.AxesSubplot at 0x7efd0c0b0690>
However, you can do (notice the comment that needs to be added) :
>>> s.plot() # doctest: +ELLIPSIS <matplotlib.axes._subplots.AxesSubplot at ...>
Plots in examples
There are some methods in pandas returning plots. To render the plots
generated by the examples in the documentation, the .. plot::
directive exists.
To use it, place the next code after the \"Examples\" header as shown below. The plot will be generated automatically when building the documentation.
class Series:
def plot(self):
"""
Generate a plot with the `Series` data.
Examples
--------
.. plot::
:context: close-figs
>>> s = pd.Series([1, 2, 3])
>>> s.plot()
"""
pass
Sharing docstrings
pandas has a system for sharing docstrings, with slight variations, between classes. This helps us keep docstrings consistent, while keeping things clear for the user reading. It comes at the cost of some complexity when writing.
Each shared docstring will have a base template with variables, like
%(klass)s
. The variables filled in later on using the Substitution
decorator. Finally, docstrings can be appended to with the Appender
decorator.
In this example, we\'ll create a parent docstring normally (this is like
pandas.core.generic.NDFrame
. Then we\'ll have two children (like
pandas.core.series.Series
and pandas.core.frame.DataFrame
). We\'ll
substitute the children\'s class names in this docstring.
class Parent:
def my_function(self):
"""Apply my function to %(klass)s."""
...
class ChildA(Parent):
@Substitution(klass="ChildA")
@Appender(Parent.my_function.__doc__)
def my_function(self):
...
class ChildB(Parent):
@Substitution(klass="ChildB")
@Appender(Parent.my_function.__doc__)
def my_function(self):
...
The resulting docstrings are
>>> print(Parent.my_function.__doc__)
Apply my function to %(klass)s.
>>> print(ChildA.my_function.__doc__)
Apply my function to ChildA.
>>> print(ChildB.my_function.__doc__)
Apply my function to ChildB.
Notice two things:
- We \"append\" the parent docstring to the children docstrings, which are initially empty.
- Python decorators are applied inside out. So the order is Append then Substitution, even though Substitution comes first in the file.
Our files will often contain a module-level _shared_doc_kwargs
with
some common substitution values (things like klass
, axes
, etc).
You can substitute and append in one shot with something like
@Appender(template % _shared_doc_kwargs)
def my_function(self):
...
where template
may come from a module-level _shared_docs
dictionary
mapping function names to docstrings. Wherever possible, we prefer using
Appender
and Substitution
, since the docstring-writing processes is
slightly closer to normal.
See pandas.core.generic.NDFrame.fillna
for an example template, and
pandas.core.series.Series.fillna
and
pandas.core.generic.frame.fillna
for the filled versions.


If you are listing a vacation rental, please click here.
Read the complete Trizen policy for accommodations.
400 character limit
© Copyright Trizen 2020. Made with by TechyDevs
Hello! Welcome Create a New Account
Or Sign up Using
Hello! Welcome to your account
Forgot Password?
Or Login Using


All
Open Now (beta)
Open on Saturdays
Open on Sundays
Open on Public Holidays
Open 24 Hours
Expand
Collapse


{% extends "room_manager/layout.html" %} {% block title %}Reservations{% endblock %} {% block content %}
| Room | Date | Start time | End time | Organisor | |
|---|---|---|---|---|---|
| {{reservation.room.name}} | {{reservation.startdate.year}}/{{reservation.startdate.month}}/{{reservation.startdate.day}} | {{reservation.startdate.hour}}:{{reservation.startdate.minute}} | {{reservation.enddate.hour}}:{{reservation.enddate.minute}} | {{reservation.organisor.first_name}} {{reservation.organisor.last_name}} | × |


I've a problem with my energy monitor. Possibly it's due to my use of the software high pass filter.
My energy monitor is based on the openenergymonitor design but uses a PIC. It samples 4 channels simultaneously - grid voltage/grid current/PV current/generated current diverted to the immersion heater. The sampling rate is 5kHz. I've been getting better than 1% accuracy.
However I decided to try sampling at a 20kHz rate. When I do this, the measured grid voltage is too low. As I increase the sampling rate from 5kHz to 20kHz, the grid voltage decreases. It's about 7V too low at 20kHz.
I'm fairly sure the ADC is working OK at the higher sampling rate. Also there seems to be plenty of processing time between sampling interrupts. I'm wondering whether the problem may be the high pass digital filter. I'm using the software filter from the openenergymonitor design.
The filter works well at a 5kHz sampling rate. Should it be OK to use it unchanged with 20kHz sampling?
Re: Digital high pass filter problem?
The time constant is a direct function of the sampling rate, so to restore the performance you almost certainly need to adjust the coefficients. I think what you've inadvertently done is you've pushed the corner frequency up by a factor of four and the attenuation at the mains frequency is no longer negligible.
We changed from using the result of the high pass filter directly, to using a low pass filter to extract the offset and then subtract it. It uses slightly less maths, but it's capable of being initialised and a consequence of that is it can have a longer time constant and therefore less ripple.
Wikipedia has a complete explanation of both filters.
Re: Digital high pass filter problem?
Thanks. That makes sense. I will take a look at the low pass filter.
Re: Digital high pass filter problem?
Assuming you were using α = 0.996 and a sampling interval of 400 μs (which are about right for the old high pass filter in the emonTx sampling at 2.5 kHz), the corner frequency works out at 1.59 Hz. The attenuation at 50 Hz would therefore be 0.05%.
Running the same filter at 5 kHz would double the corner frequency, and the attenuation changes to 0.2%. This is what you probably had.
However, taking the frequency up to 20 kHz, the corner frequency is now 8 times the original design value at nearly 13 Hz, and the attenuation at 50 Hz is 3.12%. So you saw a difference of 2.9%, pretty close to your 7 V.
You probably want an α of about 2-16 (about 0.000015) in the low-pass filter, giving a corner frequency of 0.05 Hz. Remember to initialise it to the half-rail input so that it settles within a reasonable time.
Re: Digital high pass filter problem?
Robert,
Your comments were very interesting.
I looked at a low pass filter, but decided to change the high pass filter because it was so easy to do. I changed α to 0.999. This gave me pretty much the same time constant sampling at 20kHz as I'd had at 5kHz with α = 0.996. The change to the software filter was trivial, because .999 is close to 1023/1024, instead of 255/256 for .996. So the only change needed in the software filter was to change the 8 bit shifts to 10 bit shifts.
When I did this, the voltage when sampling at 20kHz was a sensible value. As you noted, there would have been a little attenuation at 5kHz with α = 0.996. Sure enough when I sampled at 5kHz the voltage increased a little when I changed α from 0.996 to 0.999.
I've not been checking all this very carefully so far, just recompiling to try the different scenarios, and in the meantime the mains voltage was changing a little anyway, but everything looks consistent with your comments. But maybe I'll find that changing the filter produces other problems when I test all this properly - I don't really know enough about filters.
I have a question. As you said there would have been a small amount of attenuation with the original filter and 5kHz sampling. I should be getting a similar small amount of attenuation sampling at 20kHz with α = 0.999. If I were to change the filter routine to shift 11 bits instead of 10, would this improve the measurement accuracy (without causing other problems)?
Re: Digital high pass filter problem?
"would this improve the measurement accuracy (without causing other problems)?"
Probably yes and no. Yes, it will reduce the attenuation of the 50 Hz wanted signal (or if you've got that right with calibration, reduce the errors that come from giving that bit more weight to the harmonics), and no, you probably won't get away without more problems because the settling time grows, so you need longer after starting or resetting before you can trust the readings.
That's the main point of changing to the low pass filter - it can be preloaded so it's almost settled with the first sample.
The high pass and the low pass approaches both achieve the same result in the end, but do it in very different ways. The high pass filter attempts to take out the d.c. offset directly, but as I mentioned, it can't be pre-loaded at startup so the lower the corner frequency, hence the less error you have at 50 Hz, the longer the settling time ('settling time' being measured in filter iterations, so the time it's been filtering samples - pausing as in the 'discrete sample' sketches doesn't count). Therefore at startup you need to throw away measurements until it's done enough to have settled.
The low pass filter removes all the mains frequency and harmonics to leave only the d.c. component, which you then subtract from the original signal. Therefore it gets the value of the offset and removes it. But you can guess to a first approximation the value of the offset, so starting from there, the filter is very nearly settled at switch-on. You can take advantage of that and reduce the corner frequency to a very low value, thus removing even more of the a.c. ripple, and still have the filter settle within a few hundred samples.
There are pictures of simulations in the Building Blocks article.
Re: Digital high pass filter problem?
The way I use the monitor is to start it running, then leave it. It streams data to my PC which saves the information in a database. I can then analyse the data offline. I've had the monitor running for several months without resetting it. Once I stop playing with it, I hope to leave it running for a year or more before resetting. It has a backup battery supply.
So the settle time for the high pass filter doesn't bother me in the least. My concern with the low pass filter is that it first finds the offset then uses it from then on. As in the building blocks article, my monitor supplies a buffered common mid point voltage for all the ADC measurements. This voltage should be stable, but if it does drift at all over the course of a year or more, it will cause problems. As I understand it, I wouldn't have this problem with the high pass digital filter.
Actually, I've just thought of a problem. If there's a power outage, the mcu will continue running, but the AC voltage will go. Neither the low pass nor the high pass filters will be accurate when the power returns. So I probably ought to detect the loss of AC voltage and call the settling routine when it comes back. The shorter settle time for the low pass filter would be an advantage in this situation.
Re: Digital high pass filter problem?
"My concern with the low pass filter is that it first finds the offset then uses it from then on."
Not true, and I don't think I wrote that anywhere either. What I wrote above is the offset is set at startup to what we hope is the correct value. After that it continually updates, which you can easily see if you study the sketch.
"Neither the low pass nor the high pass filters will be accurate when the power returns."
I don't understand your thinking there. Looking only at the low-pass filter, the time constant is huge and the contribution from each sample will be only one part in 65536 or thereabouts, so if the mains supply goes away, the offset will immediately start to settle to the exact midpoint. Then when the power returns, it will immediately start to follow the input again, though attenuated as designed. If you re-initialise when power returns, it's likely to be more inaccurate, not less. Whatever happens, any disturbance can never be larger than the residual ripple unless a large spike gets through.
If you're really worried, you can write a simulation in a spreadsheet and test the effects of starting at pre-determined points on the cycle.
Re: Digital high pass filter problem?
Thank you for the explanation. I will try the low pass filter.


A set of tools to allow you to manually trigger or set modulations. This could be used for testing purposes or for live performance.
- A ... D
- Setting the input dial value in turn outputs the exact same value in the corresponding output modulation. This is useful if you need to manually change several dials simultaneously to the same value. For example, if you have three LFOs and you need to change all of their rates at the same time, you could hook them all up to the provided output here, then change them all by modifying the corresponding input dial.
- Tr A ... D
- Pressing a button sends a trigger along the previously mentioned outputs A ... D


- This is a question. Now I will indent the next bullet point to create the correct answer.
- This is the correct answer.
- Notice that it does not necessarily as answer a).
- Here is an incorrect answer.
- I can create as many of these as I want.
- As I type this answer, it shows up in the editor as a level 2 item with the number 3.
- feedback goes here.
- And here is the original number 4. Note that in addition to randomizing, the quiz script also changes the style of the outline so that these options appear as letters rather than numbers.
- how do you like it?
- Unfortunately, the Canvas editor is not great for authoring numbered lists. The tab and shift-tab keys don't work as they do in a quality text editor. Instead, you have to used the indent buttons.
- This question has answer-specific feedback. Click any answer option to reveal the feedback.
- Good job.
- This in an incorrect answer with feedback.
- Ideally, feedback should reflect the type of error a student made in choosing a particular response.
- When I finish with this final answer option, I will be sure to exit completely out of list-editing mode by clicking on the numbered list button until it appears unselected.
- Be sure to do this, or your quizzes may fail.


Bug summary:
After initially setting up the app, the “Balance Sheet” duplicates if you navigate to “Settings” and then back to the balance sheet page.
Observed Behavior (a description of what happened with the app):
After navigating initial app setup, click "Reports" under the dropdown menu at left, then the pink "Sheets" button, and then "Settings" on the left dropdown menu. Then, use the back arrow in upper left corner to navigate back to the "Balance Sheet." The Balance Sheet shows each line under Assets, Liabilities, and Equity twice. The repeated text lines occur as a group (i.e. the lines appear in the correct order, and then the sequence repeats a second time); see screenshot below.
Expected Behavior (a description of what you expected to happen):
After clicking "Settings" and then navigating back to the "Balance Sheet" page, each line of text--item with a potential monetary value--should appear only once.
Steps to Reproduce (the steps to reproduce the problem):
1. Navigate setup with pre-selected boxes checked (click "Next" each time), click "Automatically send crash reports" under Feedback Options, "Allow" app to access photos, media, etc.
2. Click dropdown menu at left, click "Reports"
3. Click pink "Sheet" button
4. Click dropdown menu at left, click "Settings"
5. Click back arrow at top left of screen
6. The Balance Sheet now shows groups of items duplicated, as shown in attached screenshot.
Additional information:
Attachments:


PC Sleep - Schedule automatic shutdown, sleep, or hibernate your PC
Thank you for using PC-Sleep.com.
PC Sleep is a free sleep timer for your computer. You can leave your computer and PC Sleep will safely perform the selected function in the entered amount of time with no effort on your part. A noticeable pop-up window will appear when there is one minute left on the timer. The same window will pop-up if no time is selected; giving you 30 seconds to stop the timer before PC Sleep executes the selected function. This utility is particularly good for long downloads where you would like your computer to shut down after a certain amount of hours, playing music before you go to bed, or any other reason you might need PC Sleep to perform its functions while you're away from your computer.
Read more: What is the difference between sleep and hibernate?
How to create a shutdown timer for Windows with hacker's way
Why you should use PC-Sleep?
Even though your computer is still working, you might not want, or need, to be there while it finishes up the job at hand. PC Sleep is a simple tool that lets you shut down your computer at a specific time or within a specific time frame, so you can set it and walk away.
Requirements:
Operating Systems: Windows XP/2003/Vista/Server 2008/7/8/10
Additional Requirements: Microsoft .NET Framework 4.0 (Download at: https://www.microsoft.com/net/download)
Installing PC Sleep requires a Dot Net Framework, but the process is simple. While it offers eye-friendly and mouse-friendly features, the small interface is designed to do the job as quickly and efficiently as possible in two basic steps: choosing the action you want to perform and choosing when you want it to happen. In addition to shutting down your computer, you can use PC Sleep to perform other related functions such as rebooting or logging off. As promised, a pop-up window appears before your PC shuts down, so you can halt the action if you're still working.
A minor issue with the tool's installation is that it will install a Start Menu icon without permission. Otherwise, it uninstalls cleanly. This is a simple tool designed to do a simple task. It doesn't offer any other bells and whistles, but PC Sleep works well and it costs you nothing to add to your toolbox.
How to use PC Sleep?
PC Sleep Notice
PC Sleep function select
PC Sleep settings
If you don't want use PC Sleep, you can get some apps like PC Sleep bellow:
Final Countdown
Final Countdown is an advanced timer for windows PC´s.
Free
Windows
System Cleaner
System Cleaner is a computer cleanup and performance increase software that keeps your PC running...
Commercial
Windows
Free Countdown Timer
Free Countdown Timer is a free, full-featured and user-friendly countdown timer for Windows
Commercial
Mac
MaxiVista
MaxiVista turns any spare PC into a second monitor for your main computer. Created by Bartels Media GmbH
Commercial
Windows
iSleep
iSleep features a sleep timer coupled with an optional Alarm Clock for iTunes and DVD Player. Created by LostZone Software (Kevin Roettger & Thomas Deniau)
Commercial
Mac
SleepBot Tracker Log
Sleep Bot is a resource tool to help you manage your sleep! Created by Insomniapps


Our team can assist you via Instant Messengers. We are online daily to answer your questions!
You have full control over your campaign. You choose when to start, pause or stop it.
Withdrawals are processed daily (on weekdays). You will receive your payment super fast.
The detailed stats are updated every hour. You can monitor your campaign or revenue progress.
Minimum amount for withdrawal is only $10, for deposits it is only $5 with no campaign minimum budget.


Note: Internet Explorer 9 and earlier do not support 3D-transforms.
Rotate the red div element, try changing its X-, Y-, and Z-axis:


The existing workflow of internal merchants and buyers in creating new promotions is highly repetitive and manual. The company's process of creating and maintaining promotions was ancient, highly inefficient, and super prone to human-error.
I worked in a team of a Product Manager, Engineering Manager, a Sr UX Designer, and 11 Software Developers/Engineers.
Companys often build upon what is currently existing, be it services, workflows, products, and even jobs. As such, this set of processes for creating and maintaining promotions had a slew of other systems and processes interdependent to each other. A giant grab bag of system dependencies.
But wait! Every system is tied to someone or some...thing. We had a stakeholder (or a whole team of them) for each dependency on the list. You still with me?
This product was one of the first few products with which we were leaning on the expertise of our wonderful Pivotal Inc. friends. Our company was still in its very early stages of going through the technology-transformation, so an experts' help was necessary.
As a Jr UX Designer, this opportunity was absolutely golden, as our Pivotal partners taught our team how to work together collaboratively, effectively, and efficiently through their double diamond product development process.
Best part about it? Engineers get to see and hear about what the end-users are having frustrations with.
The infamous double diamond to turn a problem into a workable solution.
To understand the lay of the land: who is involved in what processes, which systems are embedded where, and why.
Who are we designing for? What do they do in this system? How do they achieve their goals?
Ever heard of it? Ask me about it!
2x2's, prioritization matrices, etc.
Regular brainstorming sessions held collaboratively with the team and stakeholders.
From low to high fidelities; made with love using: pen&paper, Sketch, InVision, html/css/Javascript
Regularly keeping stakeholders up to speed on the latest and greatest
It is pivotal that the whole team is consistently aligned on process and progress.
The journey has been long, and I can't decide which parts to sew in here; if they're even legal for me to discuss...
Don't Fret.I'll write more in here. For now, please see the next section about the most important takeaways!
The larger the company and wider the scope of product, we're bound to handle more stakeholders. When working with such products, always take time to communicate with them and prioritize their importance. Being transparent throughout every step of the design & development process is key to avoiding bigger issues that may cost the company millions.
There are times when the stakeholders are of equal importance to the product, with different goals. Quickly realize this is the case, bring it up to the group and propose a compromise. When in doubt, take the side of the end-users!
When developing a product, going through its discovery and framing journey, it is highly beneficial to bring the stakeholders along for the ride. Consistent communication and updates will give them confidence and a sense of opinion on the direction that your team is taking the product.
The company's internal priorities and focus changed numerous times during this journey, which forced our stakeholders to switch directions and change their minds quite often; however, becuase we iterated fast, we were able to sustain our pace of development.


Music Object Extension - Channels
|
|
The Channels extension provides convenient access to all the channel properties that can be controlled through the Music Object API. Most of these properties can be accessed using the core Music Object API's setController and getController methods, so this extension is provided primarily to ease programming and to make sonification code more easily understood. As an example, using the Channels extension's setChannelReverbLevel method has the same effect as using the setController method and specifying the value 91 for the ControllerNumber0to127 parameter.
|
What's New in the Latest Version
|
There is a dedicated version history for this extension, where you will be able to find out about the new features and possible issues with the most recent version. The version history for this extension is independent of the version history for the core Music Object API.
To get the "music-object-x-channels.js" JavaScript file that implements this extension, simply right-click on this link (click-and-hold for Mac users). Then, from the menu that pops up, select the 'Save Link As...' or 'Save Target As...' option and save the file as "music-object-x-channels.js" into an appropriate folder of the local copy of your Web site.
In case you have problems saving the file using the above link, the "music-object-x-channels.js" file can also be found inside the documentation's "javascript" folder, along with the "music-object.js" file.
In order to use this extension, the following JavaScript file(s) must first be sourced in...
- music-object.js (version 3.3.0 or higher)
For more information on using extensions, consult the section About Music Object Extensions.
| Name |
Short Description |
| Instance Methods |
| getChannelBankNumber |
Returns an integer value, indicating the bank number of the instrument that is selected for the specified MIDI channel. |
| getChannelChorusLevel |
Returns an integer value, indicating the amount of chorus effect that is set for the specified MIDI channel. |
| getChannelExpression |
Returns an integer value, indicating the amount of expression that is applied to the specified MIDI channel. |
| getChannelInstrumentMode |
Returns an integer value, indicating the current instrument mode for the specified MIDI channel. |
| getChannelModulation |
Returns an integer value, indicating the amount of modulation that is applied to the specified MIDI channel. |
| getChannelNrpn |
Returns an integer value, indicating the last value that was set for the specified non-registered parameter number (NRPN) on the specified MIDI channel. |
| getChannelPan |
Returns an integer value, indicating the stereo positioning of the specified MIDI channel. |
| getChannelPitchBendRange |
Returns an integer value, indicating the current pitch bend range set for the specified MIDI channel. |
| getChannelReverbLevel |
Returns an integer value, indicating the amount of reverb effect that is set for the specified MIDI channel. |
| getChannelRpn |
Returns an integer value, indicating the last value that was set for the specified registered parameter number (RPN) on the specified MIDI channel. |
| getChannelVolume |
Returns an integer value, indicating the volume level of the specified MIDI channel. |
| resetAllControllers |
Lets you easily reset all the controller values for the specified MIDI channel back to their default settings. |
| setChannelBankNumber |
Lets you send a bank select message to the specified MIDI channel. |
| setChannelChorusLevel |
Lets you select the amount of chorus effect that is to be applied to the specified MIDI channel. |
| setChannelExpression |
Lets you select the amount of expression that is to be applied to the specified MIDI channel. |
| setChannelInstrumentMode |
Lets you select the instrument mode for the specified MIDI channel. |
| setChannelModulation |
Lets you select the amount of modulation that is to be applied to the specified MIDI channel. |
| setChannelNrpn |
Lets you set a value for the specified non-registered parameter number (NRPN) on the specified MIDI channel. |
| setChannelPan |
Lets you set the stereo positioning of the specified MIDI channel. |
| setChannelPitchBendRange |
Lets you set the pitch bend range (measured in musical intervals) for the specified MIDI channel. |
| setChannelReverbLevel |
Lets you select the amount of reverb effect that is to be applied to the specified MIDI channel. |
| setChannelRpn |
Lets you set a value for the specified registered parameter number (RPN) on the specified MIDI channel. |
| setChannelVolume |
Lets you set the volume level of the specified MIDI channel. |
| Static Methods |
| Music.getControllerName |
Returns a string value, representing the name of the specified MIDI continuous controller number. |
| Music.midiMsbLsbToInt |
Lets you convert a MIDI MSB-LSB pair to an integer value. |
|
|
The getChannelBankNumber method returns an integer value, indicating the bank number of the instrument that is selected for the specified MIDI channel.
Using the getChannelBankNumber method has the same effect as using the getController method and specifying the value 0 for the ControllerNumber0to127 parameter.
For example, the code...
var bankNames = new Array ('General MIDI Bank','Special Bank','User Bank');
var channel3BankName = bankNames [myMusicObject.getChannelBankNumber (3)];
|
...is equivalent to the code...
var bankNames = new Array ('General MIDI Bank','Special Bank','User Bank');
var channel3BankName = bankNames [myMusicObject.getController (3,0)];
|
The getChannelChorusLevel method returns an integer value, indicating the amount of chorus effect that is set for the specified MIDI channel.
| |
ChannelChorusLevel0to127 |
Using the getChannelChorusLevel method has the same effect as using the getController method and specifying the value 93 for the ControllerNumber0to127 parameter.
For example, the code...
var channel3ChorusLevel = myMusicObject.getChannelChorusLevel (3);
|
...is equivalent to the code...
var channel3ChorusLevel = myMusicObject.getController (3,93);
|
The getChannelExpression method returns an integer value, indicating the amount of expression that is applied to the specified MIDI channel.
| |
ChannelExpression0to127 |
Using the getChannelExpression method has the same effect as using the getController method and specifying the value 11 for the ControllerNumber0to127 parameter.
For example, the code...
var channel3Expression = myMusicObject.getChannelExpression (3);
|
...is equivalent to the code...
var channel3Expression = myMusicObject.getController (3,11);
|
The getChannelInstrumentMode method returns an integer value, indicating the current instrument mode for the specified MIDI channel.
The instrument mode selected for a channel can also be obtained using the getChannelNrpn instance method and specifying the value 640 for the Nrpn0to16383 parameter.
Due to a limitation in current versions of the Beatnik Player, the getChannelInstrumentMode method will only return the last instrument mode that was set using the setChannelInstrumentMode or setChannelNrpn instance methods. Because it is possible for instrument mode to be set by MIDI events that occur within an RMF or MIDI file, or by using the setController instance method of the core Music Object API, it is possible that the getChannelInstrumentMode method could return a value that does not reflect the true instrument mode selected for a channel.
So, if you are going to use this method in an interactive audio application, you need to be sure that the RMF or MIDI content you are using does not contain MIDI events that will set instrument mode on channels where your scripting will also be modifying and querying the instrument mode (using the setChannelInstrumentMode and getChannelInstrumentMode methods), and that you also do not use the setController method for setting a channel's instrument mode.
Take a look at the following example...
/*** sets instrument mode 2 for channel 1, using the setChannelInstrumentMode method ***/
myMusicObject.setChannelInstrumentMode (1,2);
/*** sets instrument mode 3 for channel 1, using the setController method ***/
myMusicObject.setController (1,99,5); // non-registered parameter MSB
myMusicObject.setController (1,98,0); // non-registered parameter LSB
myMusicObject.setController (1,6,3); // non-registered parameter value
/*** alerts the instrument mode for channel 1 ***/
alert (myMusicObject.getChannelInstrumentMode (1));
|
After the code in this example has been executed, channel 1 will be set to instrument mode 3. However, because the getChannelInstrumentMode method only returns the last instrument mode set by the setChannelInstrumentMode or setChannelNrpn methods, the value 2 will be displayed by the "alert" statement, and not the value 3 as one might expect. This is a limitation that you should be aware of.
The getChannelModulation method returns an integer value, indicating the amount of modulation that is applied to the specified MIDI channel.
| |
ChannelModulation0to127 |
Using the getChannelModulation method has the same effect as using the getController method and specifying the value 1 for the ControllerNumber0to127 parameter.
For example, the code...
var channel3Modulation = myMusicObject.getChannelModulation (3);
|
...is equivalent to the code...
var channel3Modulation = myMusicObject.getController (3,1);
|
The getChannelNrpn method returns an integer value, indicating the last value that was set for the specified non-registered parameter number (NRPN) on the specified MIDI channel.
| |
NrpnValue0to127 |
Values can be set for non-registered parameter numbers via scripting using the setChannelNrpn instance method.
Due to a limitation in current versions of the Beatnik Player, the getChannelNrpn method will only return the last value that was set for an NRPN using the setChannelNrpn instance method (or the setChannelInstrumentMode instance method, in the case of NRPN 640). Because it is possible for NRPN's to be set by MIDI events that occur within an RMF or MIDI file, or by using the setController instance method of the core Music Object API, it is possible that the getChannelNrpn method could return a value that does not reflect the true value of the specified NRPN for a channel.
So, if you are going to use this method in an interactive audio application, you need to be sure that the RMF or MIDI content you are using does not contain MIDI events that will set the values of the NRPN's you will be using in your application, on channels where your scripting will also be modifying and querying these NRPN values (using the setChannelNrpn and getChannelNrpn methods), and that you also do not use the setController method for setting an NRPN's value.
Take a look at the following example...
/*** sets channel 1's instrument mode (NRPN 640) to 2, using the setChannelNrpn method ***/
myMusicObject.setChannelNrpn (1,640,2);
/*** sets channel 1's instrument mode (NRPN 640) to 3, using the setController method ***/
myMusicObject.setController (1,99,5); // non-registered parameter MSB
myMusicObject.setController (1,98,0); // non-registered parameter LSB
myMusicObject.setController (1,6,3); // non-registered parameter value
/*** alerts channel 1's instrument mode (NRPN 640) setting ***/
alert (myMusicObject.getChannelNrpn (1,640));
|
After the code in this example has been executed, channel 1 will be set to instrument mode 3. However, because the getChannelNrpn method only returns the last NRPN value set by the setChannelNrpn method (or the setChannelInstrumentMode method, in the case of NRPN 640), the value 2 will be displayed by the "alert" statement, and not the value 3 as one might expect. This is a limitation that you should be aware of.
The getChannelPan method returns an integer value, indicating the stereo positioning of the specified MIDI channel.
| |
ChannelPan0to127 |
Using the getChannelPan method has the same effect as using the getController method and specifying the value 10 for the ControllerNumber0to127 parameter.
For example, the code...
var channel3Pan = myMusicObject.getChannelPan (3);
|
...is equivalent to the code...
var channel3Pan = myMusicObject.getController (3,10);
|
The getChannelPitchBendRange method returns an integer value, indicating the current pitch bend range (measured in musical intervals) set for the specified MIDI channel.
| |
ChannelPitchBendRangeINT |
The pitch bend range selected for a channel can also be obtained using the getChannelRpn instance method and specifying the value 0 for the Rpn0to16383 parameter.
Due to a limitation in current versions of the Beatnik Player, the getChannelPitchBendRange method will only return the last pitch bend range that was set using the setChannelPitchBendRange or setChannelRpn instance methods. Because it is possible for pitch bend range to be set by MIDI events that occur within an RMF or MIDI file, or by using the setController instance method of the core Music Object API, it is possible that the getChannelPitchBendRange method could return a value that does not reflect the true pitch bend range selected for a channel.
So, if you are going to use this method in an interactive audio application, you need to be sure that the RMF or MIDI content you are using does not contain MIDI events that will set pitch bend range on channels where your scripting will also be modifying and querying the pitch bend range (using the setChannelPitchBendRange and getChannelPitchBendRange methods), and that you also do not use the setController method for setting a channel's pitch bend range.
Take a look at the following example...
/*** sets channel 1's pitch bend range (RPN 0) to 12, using the setChannelRpn method ***/
myMusicObject.setChannelRpn (1,0,12);
/*** sets channel 1's pitch bend range (RPN 0) to 7, using the setController method ***/
myMusicObject.setController (1,101,0); // registered parameter MSB
myMusicObject.setController (1,100,0); // registered parameter LSB
myMusicObject.setController (1,6,7); // registered parameter value
/*** alerts channel 1's pitch bend range (RPN 0) setting ***/
alert (myMusicObject.getChannelRpn (1,0));
|
After the code in this example has been executed, the pitch bend range for channel 1 will be set to 7 musical intervals (a musical 5th). However, because the getChannelRpn method only returns the last RPN value set by the setChannelPitchBendRange or setChannelRpn methods, the value 12 (a full octave) will be displayed by the "alert" statement, and not the value 7 as one might expect. This is a limitation that you should be aware of.
The getChannelReverbLevel method returns an integer value, indicating the amount of reverb effect that is set for the specified MIDI channel.
| |
ChannelReverbLevel0to127 |
Using the getChannelReverbLevel method has the same effect as using the getController method and specifying the value 91 for the ControllerNumber0to127 parameter.
For example, the code...
var channel3ReverbLevel = myMusicObject.getChannelReverbLevel (3);
|
...is equivalent to the code...
var channel3ReverbLevel = myMusicObject.getController (3,91);
|
The getChannelRpn method returns an integer value, indicating the last value that was set for the specified registered parameter number (RPN) on the specified MIDI channel.
| |
RpnValue0to127 |
Values can be set for registered parameter numbers via scripting using the setChannelRpn instance method.
Due to a limitation in current versions of the Beatnik Player, the getChannelRpn method will only return the last value that was set for an RPN using the setChannelRpn instance method (or the setChannelPitchBendRange instance method, in the case of RPN 0). Because it is possible for RPN's to be set by MIDI events that occur within an RMF or MIDI file, or by using the setController instance method of the core Music Object API, it is possible that the getChannelRpn method could return a value that does not reflect the true value of the specified RPN for a channel.
So, if you are going to use this method in an interactive audio application, you need to be sure that the RMF or MIDI content you are using does not contain MIDI events that will set the values of the RPN's you will be using in your application, on channels where your scripting will also be modifying and querying these RPN values (using the setChannelRpn and getChannelRpn methods), and that you also do not use the setController method for setting an RPN's value.
Take a look at the following example...
/*** sets channel 1's pitch bend range (RPN 0) to 12, using the setChannelRpn method ***/
myMusicObject.setChannelRpn (1,0,12);
/*** sets channel 1's pitch bend range (RPN 0) to 7, using the setController method ***/
myMusicObject.setController (1,101,0); // registered parameter MSB
myMusicObject.setController (1,100,0); // registered parameter LSB
myMusicObject.setController (1,6,7); // registered parameter value
/*** alerts channel 1's pitch bend range (RPN 0) setting ***/
alert (myMusicObject.getChannelRpn (1,0));
|
After the code in this example has been executed, the pitch bend range for channel 1 will be set to 7 musical intervals (a musical 5th). However, because the getChannelRpn method only returns the last RPN value set by the setChannelRpn method (or the setChannelPitchBendRange method, in the case of RPN 0), the value 12 (a full octave) will be displayed by the "alert" statement, and not the value 7 as one might expect. This is a limitation that you should be aware of.
The getChannelVolume method returns an integer value, indicating the volume level of the specified MIDI channel.
| |
ChannelVolume0to127 |
Using the getChannelVolume method has the same effect as using the getController method and specifying the value 7 for the ControllerNumber0to127 parameter.
For example, the code...
var channel3Volume = myMusicObject.getChannelVolume (3);
|
...is equivalent to the code...
var channel3Volume = myMusicObject.getController (3,7);
|
The resetAllControllers method lets you easily reset all the controller values for the specified MIDI channel back to their default settings.
Using the resetAllControllers method has the same effect as using the setController method and specifying the value 121 for the ControllerNumber0to127 parameter, and the value 0 for the ControllerValue0to127 parameter.
For example, the code...
myMusicObject.resetAllControllers (3);
|
...is equivalent to the code...
myMusicObject.setController (3,121,0);
|
Because the resetAllControllers method accepts a MidiChannel0to16 parameter, where the value 0 represents all MIDI channels (see the section Important Concepts: Magical MIDI Channel Number 0 and Track Number 0), it is possible to reset all continuous controllers for all MIDI channels of a Music Object instance with a single statement of the form myMusicObject.resetAllControllers (0);.
The setChannelBankNumber method lets you send a bank select message to the specified MIDI channel.
Using the setChannelBankNumber method has the same effect as using the setController method and specifying the value 0 for the ControllerNumber0to127 parameter.
For example, the code...
function getBankNumber (bankName) {
var bankNames = {
'General MIDI Bank':0,
'Special Bank':1,
'User Bank':2
}
return bankNames [bankName];
}
myMusicObject.setChannelBankNumber (3,getBankName ('Special Bank'));
|
...is equivalent to the code...
function getBankNumber (bankName) {
var bankNames = {
'General MIDI Bank':0,
'Special Bank':1,
'User Bank':2
}
return bankNames [bankName];
}
myMusicObject.setController (3,0,getBankName ('Special Bank'));
|
The setChannelChorusLevel method lets you select the amount of chorus effect that is to be applied to the specified MIDI channel.
Using the setChannelChorusLevel method has the same effect as using the setController method and specifying the value 93 for the ControllerNumber0to127 parameter.
For example, the code...
myMusicObject.setChannelChorusLevel (3,61);
|
...is equivalent to the code...
myMusicObject.setController (3,93,61);
|
The setChannelExpression method lets you select the amount of expression that is to be applied to the specified MIDI channel.
Using the setChannelExpression method has the same effect as using the setController method and specifying the value 11 for the ControllerNumber0to127 parameter.
For example, the code...
myMusicObject.setChannelExpression (3,127);
|
...is equivalent to the code...
myMusicObject.setController (3,11,127);
|
The setChannelInstrumentMode instance method lets you select the instrument mode for the specified MIDI channel.
It is also possible to set instrument mode for a channel using the setChannelNrpn instance method, or the setController instance method of the core Music Object API.
The following sample code examples all have the effect of selecting instrument mode 2 for MIDI channel 3...
myMusicObject.setController (3,99,5); // non-registered parameter MSB
myMusicObject.setController (3,98,0); // non-registered parameter LSB
myMusicObject.setController (3,6,2); // non-registered parameter value
|
myMusicObject.setChannelNrpn (3,640,2);
|
myMusicObject.setChannelInstrumentMode (3,2);
|
In each of the sample code listings above, the highlighted code indicates where the instrument mode value is specified.
Due to a limitation in current versions of the Beatnik Player, the getChannelInstrumentMode instance method will only return the last instrument mode that was set using the setChannelInstrumentMode or setChannelNrpn instance methods. So, if you wish to be able to query the instrument mode for a channel using the getChannelInstrumentMode method, you should use either the setChannelInstrumentMode or setChannelNrpn methods for setting instrument mode, and you should avoid using the setController method for this purpose.
The setChannelModulation method lets you select the amount of modulation that is to be applied to the specified MIDI channel.
Using the setChannelModulation method has the same effect as using the setController method and specifying the value 1 for the ControllerNumber0to127 parameter.
For example, the code...
myMusicObject.setChannelModulation (3,30);
|
...is equivalent to the code...
myMusicObject.setController (3,1,30);
|
The setChannelNrpn method lets you set a value for the specified non-registered parameter number (NRPN) on the specified MIDI channel.
Values for non-registered parameter numbers can be queried via scripting using the getChannelNrpn instance method. It is also possible to set values for NRPN's using the setController instance method of the core Music Object API.
The following sample code examples both have the effect of setting 2 for the instrument mode (NRPN 640) of MIDI channel 3...
myMusicObject.setController (3,99,5); // non-registered parameter MSB
myMusicObject.setController (3,98,0); // non-registered parameter LSB
myMusicObject.setController (3,6,2); // non-registered parameter value
|
myMusicObject.setChannelNrpn (3,640,2);
|
In each of the sample code listings above, the highlighted code indicates where the instrument mode value is specified.
Due to a limitation in current versions of the Beatnik Player, the getChannelNrpn instance method will only return the last value that was set for the specified NRPN using the setChannelNrpn instance method (or the setChannelInstrumentMode instance method, in the case of NRPN 640). So, if you wish to be able to query the value of an NRPN for a channel using the getChannelNrpn method, you should use either the setChannelNrpn method (or the setChannelInstrumentMode method, in the case of NRPN 640) for setting the value of the NRPN, and you should avoid using the setController method for this purpose.
The setChannelPan method lets you set the stereo positioning of the specified MIDI channel.
Using the setChannelPan method has the same effect as using the setController method and specifying the value 10 for the ControllerNumber0to127 parameter.
For example, the code...
myMusicObject.setChannelPan (3,0);
|
...is equivalent to the code...
myMusicObject.setController (3,10,0);
|
The setChannelPitchBendRange instance method lets you set the pitch bend range (measured in musical intervals) for the specified MIDI channel.
It is also possible to set pitch bend range for a channel using the setChannelRpn instance method, or the setController instance method of the core Music Object API.
The following sample code examples all have the effect of setting the pitch bend range to 12 (a full octave) for MIDI channel 3...
myMusicObject.setController (3,101,0); // registered parameter MSB
myMusicObject.setController (3,100,0); // registered parameter LSB
myMusicObject.setController (3,6,12); // registered parameter value
|
myMusicObject.setChannelRpn (3,0,12);
|
myMusicObject.setChannelPitchBendRange (3,12);
|
In each of the sample code listings above, the highlighted code indicates where the pitch bend range value is specified.
Due to a limitation in current versions of the Beatnik Player, the getChannelPitchBendRange instance method will only return the last pitch bend range that was set using the setChannelPitchBendRange or setChannelRpn instance methods. So, if you wish to be able to query the pitch bend range for a channel using the getChannelPitchBendRange method, you should use either the setChannelPitchBendRange or setChannelRpn methods for setting pitch bend range, and you should avoid using the setController method for this purpose.
The setChannelReverbLevel method lets you select the amount of reverb effect that is to be applied to the specified MIDI channel.
Using the setChannelReverbLevel method has the same effect as using the setController method and specifying the value 91 for the ControllerNumber0to127 parameter.
For example, the code...
myMusicObject.setChannelReverbLevel (3,15);
|
...is equivalent to the code...
myMusicObject.setController (3,91,15);
|
The setChannelRpn method lets you set a value for the specified registered parameter number (RPN) on the specified MIDI channel.
Values for registered parameter numbers can be queried via scripting using the getChannelRpn instance method. It is also possible to set values for RPN's using the setController instance method of the core Music Object API.
The following sample code examples both have the effect of setting 12 for the pitch bend range (RPN 0) of MIDI channel 3...
myMusicObject.setController (3,101,0); // registered parameter MSB
myMusicObject.setController (3,100,0); // registered parameter LSB
myMusicObject.setController (3,6,12); // registered parameter value
|
myMusicObject.setChannelRpn (3,0,12);
|
In each of the sample code listings above, the highlighted code indicates where the instrument mode value is specified.
Due to a limitation in current versions of the Beatnik Player, the getChannelRpn instance method will only return the last value that was set for the specified RPN using the setChannelRpn instance method (or the setChannelPitchBendRange instance method, in the case of RPN 0). So, if you wish to be able to query the value of an RPN for a channel using the getChannelRpn method, you should use either the setChannelRpn method (or the setChannelPitchBendRange method, in the case of RPN 0) for setting the value of the RPN, and you should avoid using the setController method for this purpose.
The setChannelVolume method lets you set the volume level of the specified MIDI channel.
Using the setChannelVolume method has the same effect as using the setController method and specifying the value 7 for the ControllerNumber0to127 parameter.
For example, the code...
myMusicObject.setChannelVolume (3,127);
|
...is equivalent to the code...
myMusicObject.setController (3,7,127);
|
The Music.getControllerName static method returns a string value, representing the name of the specified MIDI continuous controller number.
| |
ControllerNameSTR |
The following table shows all the possible values that can be returned by this method...
| Method Call |
Return Value |
| Music.getControllerName (0) |
"Bank Number" |
| Music.getControllerName (1) |
"Modulation" |
| Music.getControllerName (7) |
"Volume" |
| Music.getControllerName (10) |
"Pan" |
| Music.getControllerName (11) |
"Expression" |
| Music.getControllerName (91) |
"Reverb Level" |
| Music.getControllerName (93) |
"Chorus Level" |
|
|
As a rule, symbolic controller names are only returned for MIDI controller numbers for which the Channels extension provides get- and set- style methods (such as getChannelExpression and setChannelExpression).
There may be other MIDI controllers that are supported by the player (see the appendix Supported MIDI Controllers) for which the Music.getControllerName method will not return a dedicated symbolic name. One such example is MIDI controller number 98, which is the "Non-registered Parameter Number LSB" controller. There are also a good number of MIDI controllers that are not supported by the player. If, for whatever reason, the Music.getControllerName method does not know the symbolic name of the specified MIDI controller number, then the method will simply return the specified MIDI controller number as a string in the form "MIDI Controller [ControllerNumber0to127]". So, the statement Music.getControllerName (98); would return the value "MIDI Controller 98".
The Music.midiMsbLsbToInt static method lets you convert a MIDI MSB-LSB pair to an integer value.
| |
Music.midiMsbLsbToInt ( Msb0to127 , Lsb0to127 ) |
| |
Integer0to16383 |
With the MIDI communication protocol, many values are constrained to a single 7-bit byte (where one bit is reserved as a flag). This means, of course, that these values are constrained to the range of 0 through 127. It is no coincidence that values for MIDI continuous controllers, such as channel volume, are constrained to this range. And it is no coincidence that note numbers for MIDI note events are constrained to this range. And it is also no coincidence that there are 128 MIDI continuous controllers in total.
Now, in order to offer a large set of registered parameter numbers (RPN) and non-registered parameter numbers (NRPN), so that these parameters don't suffer the same ultimate scarcity as the rather limited set of 128 MIDI continuous controllers, it was decided to use two 7-bit bytes for specifying RPN's and NRPN's. These two bytes are combined together to form a 14-bit number. One byte, called the MSB (Most Significant Byte), is used to represent the upper 7 bits, while the other byte, called the LSB (Least Significant Byte), is used to represent the lower 7 bits.
For example, an MSB-LSB pair where the MSB value is 5 and where the LSB value is 0 would represent the number 640. NRPN 640 is the NRPN that is used to set a channel's instrument mode (see the section Important Concepts: Channel Instrument Mode). If you have used RPN's or NRPN's in music compositions, then you will most probably have had plenty of experience specifying these parameters by their MSB-LSB pair in your music sequencer's MIDI event view. Because all the methods in this extension that deal with registered and non-registered parameter numbers take a single integer value for specifying these parameters' numbers, the Music.midiMsbLsbToInt method is provided as a convenience in case you have become accustomed to thinking of RPN's and NRPN's in terms of their MSB-LSB pair.
To illustrate our example for NRPN 640, the code...
myMusicObject.setChannelNrpn (1,Music.midiMsbLsbToInt (5,0),2);
|
...is equivalent to the code...
myMusicObject.setChannelNrpn (1,640,2);
|


Joshua Nelson College of Engineering and Computing | South Carolina Honors College University of South Carolina | Class of 2021 GitHub | LinkedIn | website


b58(1) BSD General Commands Manual b58(1)
NAME
b58 — encode a number as base 58
SYNOPSIS
b58 [−f] [−b] [−n] [INPUT] [BINDATA ...]
DESCRIPTION
b58 encodes its input in base 58 and writes the result to standard output, followed by a newline. If the INPUT argument is given, it may be given as a decimal, or as hexadecimal with prefix 0x. IF no INPUT argument is present, b58 reads from its standard input. In this case the format of the input is raw binary data by default.
The default base58 encoding is the Bitcoin encoding, but others may be selected as described in OPTIONS. The bitcoin encoding isn’t purely a base58 encoding, since leading zeroes are encoded with each full zero byte encoded as a single "1". This does mean that the Bitcoin scheme is fully reversible, even in cases where the input is a binary string starting with null bytes. The Bitcoin alphabet for the base58 part is "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".
Options are:
−f
Flickr-style encoding. This uses an alphabet of "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ" and is a function of the numeric value of the input, which means that in the case of the input being a binary string, multiple inputs can produce the same output due to leading zeroes.
−b, −-bytes
Treat the input as a string of bytes, even if the input data is provided in the arguments. In this case, additional binary data may be given as the extra arguments BINDATA .... The input byte string is then all of INPUT and BINDATA ... joined with null bytes.
−n, −-numeric
Treat the input as a number (decimal or hexadecimal, as described above), even if the input data is provided on standard input. In this case, the data fed to standard input is allowed to contain a single newline at the end.
EXIT STATUS
The b58 utility exits 0 on success, and >0 if an error occurs.
SECURITY CONSIDERATIONS
On most systems, process arguments are visible to other users. So if you’re processing confidential data, feed b58 its input on its standard input, rather than via its argument list.
INTERFACE VERSION
This version of b58(1) is part of version 0.1 of b58-interface.
BSD September 23, 2012 BSD


Require any supported file as a node module.
This module, in conjunction with interpret-like objects can register any file type the npm ecosystem has a module loader for. This library is a dependency of Liftoff.
Look for a module loader associated with the provided file and attempt require it. If necessary, run any setup required to inject it into require.extensions.
config
An interpret-like configuration object.
filepath
A file whose type you'd like to register a module loader for.
requireFrom
An optional path to start searching for the module required to load the requested file. Defaults to the directory of filepath
.
If calling this method is successful (aka: it doesn't throw), you can now require files of the type you requested natively.
An error with a failures
property will be thrown if the module loader(s) configured for a given extension cannot be registered.
If a loader is already registered, this will simply return true
.
Note: While rechoir will automatically load and register transpilers like coffee-script
, you must provide a local installation. The transpilers are not bundled with this module.
const config = require('interpret').extensions;
const rechoir = require('rechoir');
rechoir.prepare(config, './test/fixtures/test.coffee');
rechoir.prepare(config, './test/fixtures/test.csv');
rechoir.prepare(config, './test/fixtures/test.toml');
console.log(require('./test/fixtures/test.coffee'));
console.log(require('./test/fixtures/test.csv'));
console.log(require('./test/fixtures/test.toml'));


Justice Ginsburg Absent from Supreme Court Due to Flu
Ginsburg has been fighting cancer for several years but has managed to keep her job in the Supreme Court and says she is ''very much alive''.
Supreme Court Justice Ruth Bader Ginsburg was absent for courtroom arguments in two cases on Wednesday, as she is reported to have fallen ill with the flu.
It is not the first time Ginsburg has triggered concerns about her health, as she has long been diagnosed with lung cancer and a tumor on her pancreas in 1999 and 2009, respectively.
Ginsburg, 86, has been serving as Supreme Court Justice since 1999, the second woman confirmed to the high court. In July, she slammed the rumours about her health issues, noting that the senator who had ''predicted'' Ginsburg would not survive cancer had died himself.


30
Restoration for Israel and Judah
1 The word that came to Jeremiah from the LORD:
2 “Thus says the LORD, the God of Israel: Write in a book all the words that I have spoken to you.
3 For behold, days are coming, declares the LORD, when I will restore the fortunes of my people, Israel and Judah, says the LORD, and I will bring them back to the land that I gave to their fathers, and they shall take possession of it.”
4 These are the words that the LORD spoke concerning Israel and Judah:
5 “Thus says the LORD:
We have heard a cry of panic,
of terror, and no peace.
6 Ask now, and see,
can a man bear a child?
Why then do I see every man
with his hands on his stomach like a woman in labor?
Why has every face turned pale?
7 Alas! That day is so great
there is none like it;
it is a time of distress for Jacob;
yet he shall be saved out of it.
8 “And it shall come to pass in that day, declares the LORD of hosts, that I will break his yoke from off your neck, and I will burst your bonds, and foreigners shall no more make a servant of him.
9 But they shall serve the LORD their God and David their king, whom I will raise up for them.
10 “Then fear not, O Jacob my servant, declares the LORD,
nor be dismayed, O Israel;
for behold, I will save you from far away,
and your offspring from the land of their captivity.
Jacob shall return and have quiet and ease,
and none shall make him afraid.
11 For I am with you to save you,
declares the LORD;
I will make a full end of all the nations
among whom I scattered you,
but of you I will not make a full end.

Your pain is incurable.
Because your guilt is great,
because your sins are flagrant,
I have done these things to you.
16 Therefore all who devour you shall be devoured,
and all your foes, every one of them, shall go into captivity;
those who plunder you shall be plundered,
and all who prey on you I will make a prey.
17 For I will restore health to you,
and your wounds I will heal,
declares the LORD,
because they have called you an outcast:
‘It is Zion, for whom no one cares!’
18 “Thus says the LORD:
Behold, I will restore the fortunes of the tents of Jacob
and have compassion on his dwellings;
the city shall be rebuilt on its mound,
and the palace shall stand where it used to be.
19 Out of them shall come songs of thanksgiving,
and the voices of those who celebrate.
I will multiply them, and they shall not be few;
I will make them honored, and they shall not be small.
20 Their children shall be as they were of old,
and their congregation shall be established before me,
and I will punish all who oppress them.
21 Their prince shall be one of themselves;
their ruler shall come out from their midst;
I will make him draw near, and he shall approach me,
for who would dare of himself to approach me?
declares the LORD.
22 And you shall be my people,
and I will be your God.”
23 Behold the storm of the LORD!
Wrath has gone forth,
a whirling tempest;
it will burst upon the head of the wicked.
24 The fierce anger of the LORD will not turn back
until he has executed and accomplished
the intentions of his mind.
In the latter days you will understand this.