one-bit-instrument(7) Numm Tutorials one-bit-instrument(7)NAME
one bit instrument - how to make a gnarly synth with numm-run
SYNOPSIS
numm-run FILE
DESCRIPTION
In this tutorial we will learn how to live-code a one-bit synthesizer controlled by mouse position. It is intended as a gentle introduc-
tion to development with numm-run.
To get started, create a text file with the following method stubs:
def audio_out(a):
pass
def video_out(a):
pass
Save the file as onebit.py, and then launch it with numm-run:
numm-run onebit.py
You should see a blank window appear. We will now make some sound and light by changing the value of a in the audio_out and video_out
functions:
def audio_out(a):
a[::100] = 2**15
def video_out(a):
a.flat[::100] = 255
Save the file, and you should see and hear the sketch update. This is using numpy's array-indexing to turn every hundredth audio sample
and pixel-color on. The audio sample rate is by default 44100Hz, so it produces a series of clicks that will be perceived as a 441Hz tone.
We can turn this into an instrument by connecting mouse motion to frequency:
period = 100
def audio_out(a):
a[::period] = 2**15
def video_out(a):
a.flat[::period] = 255
def mouse_in(type,px,py,button):
global period
period = px*1000
Finally, let's use the keyboard to record and jump to notes. The first time you press a key, it records the period, and subsequant depres-
sions play the saved period:
period = 100
record = {}
def audio_out(a):
a[::period] = 2**15
def video_out(a):
a.flat[::period] = 255
def mouse_in(type,px,py,button):
global period
period = px*1000
def keyboard_in(type,key):
global period
if record.has_key(key):
period = record[key]
elif record.has_key(key):
record[] = period
SEE ALSO numm-run(1), numm.getting-started(7), numm.spectral-analysis(7)numm February 2012 one-bit-instrument(7)
Check Out this Related Man Page
PERF-DIFF(1) perf Manual PERF-DIFF(1)NAME
perf-diff - Read perf.data files and display the differential profile
SYNOPSIS
perf diff [baseline file] [data file1] [[data file2] ... ]
DESCRIPTION
This command displays the performance difference amongst two or more perf.data files captured via perf record.
If no parameters are passed it will assume perf.data.old and perf.data.
The differential profile is displayed only for events matching both specified perf.data files.
OPTIONS -D, --dump-raw-trace
Dump raw trace in ASCII.
-m, --modules
Load module symbols. WARNING: use only with -k and LIVE kernel
-d, --dsos=
Only consider symbols in these dsos. CSV that understands file://filename entries.
-C, --comms=
Only consider symbols in these comms. CSV that understands file://filename entries.
-S, --symbols=
Only consider these symbols. CSV that understands file://filename entries.
-s, --sort=
Sort by key(s): pid, comm, dso, symbol.
-t, --field-separator=
Use a special separator character and don't pad with spaces, replacing all occurrences of this separator in symbol names (and other
output) with a . character, that thus it's the only non valid separator.
-v, --verbose
Be verbose, for instance, show the raw counts in addition to the diff.
-f, --force
Don't complain, do it.
--symfs=<directory>
Look for files with symbols relative to this directory.
-b, --baseline-only
Show only items with match in baseline.
-c, --compute
Differential computation selection - delta,ratio,wdiff (default is delta). See COMPARISON METHODS section for more info.
-p, --period
Show period values for both compared hist entries.
-F, --formula
Show formula for given computation.
-o, --order
Specify compute sorting column number.
COMPARISON
The comparison is governed by the baseline file. The baseline perf.data file is iterated for samples. All other perf.data files specified
on the command line are searched for the baseline sample pair. If the pair is found, specified computation is made and result is displayed.
All samples from non-baseline perf.data files, that do not match any baseline entry, are displayed with empty space within baseline column
and possible computation results (delta) in their related column.
Example files samples: - file A with samples f1, f2, f3, f4, f6 - file B with samples f2, f4, f5 - file C with samples f1, f2, f5
Example output: x - computation takes place for pair b - baseline sample percentage
o perf diff A B C
baseline/A compute/B compute/C samples
---------------------------------------
b x f1
b x x f2
b f3
b x f4
b f6
x x f5
o perf diff B A C
baseline/B compute/A compute/C samples
---------------------------------------
b x x f2
b x f4
b x f5
x x f1
x f3
x f6
o perf diff C B A
baseline/C compute/B compute/A samples
---------------------------------------
b x f1
b x x f2
b x f5
x f3
x x f4
x f6
COMPARISON METHODS
delta
If specified the Delta column is displayed with value d computed as:
d = A->period_percent - B->period_percent
with: - A/B being matching hist entry from data/baseline file specified (or perf.data/perf.data.old) respectively.
o period_percent being the % of the hist entry period value within single data file
ratio
If specified the Ratio column is displayed with value r computed as:
r = A->period / B->period
with: - A/B being matching hist entry from data/baseline file specified (or perf.data/perf.data.old) respectively.
o period being the hist entry period value
wdiff:WEIGHT-B,WEIGHT-A
If specified the Weighted diff column is displayed with value d computed as:
d = B->period * WEIGHT-A - A->period * WEIGHT-B
o A/B being matching hist entry from data/baseline file specified (or perf.data/perf.data.old) respectively.
o period being the hist entry period value
o WEIGHT-A/WEIGHT-B being user suplied weights in the the -c option behind : separator like -c wdiff:1,2.
o WIEGHT-A being the weight of the data file
o WIEGHT-B being the weight of the baseline data file
SEE ALSO perf-record(1)perf 06/30/2014 PERF-DIFF(1)