generate histogram-plot

This commit is contained in:
AnxiousAnt
2024-09-17 10:45:39 +05:30
parent b613b4c6cc
commit af1d3df9a2
4 changed files with 613 additions and 0 deletions

View File

@@ -0,0 +1,272 @@
text: 398501
t: 230669
pd: 150845
*: 95191
scalar: 89041
+: 75237
pack: 60741
float: 60168
==: 58361
list: 58208
/: 46483
set: 41931
*~: 38425
route: 34390
inlet: 25129
random: 24387
delay: 23313
&&: 23163
symbol: 22702
unpack: 21274
clip: 21043
array: 20679
expr: 19440
outlet: 17927
send: 17316
select: 13284
line: 12718
value: 12227
metro: 11985
table: 10683
declare: 10470
moses: 10069
print: 9981
+~: 9382
tabread: 9113
throw~: 8579
>: 8445
bang: 8423
receive: 8263
get: 7423
delwrite~: 7169
struct: 6804
inlet~: 6600
clip~: 6334
lop~: 6153
||: 5969
osc~: 5731
<=: 5692
tabwrite: 5607
sig~: 5441
delread~: 5438
mod: 5353
makefilename: 5154
trigger: 5098
%: 5038
-~: 4668
<: 4608
max: 4541
file: 4470
change: 4459
expr~: 4379
spigot: 4369
hip~: 4153
outlet~: 4150
tabwrite~: 4017
until: 3776
append: 3260
ctlin: 3101
&: 2930
vcf~: 2849
catch~: 2711
!=: 2596
pow: 2353
phasor~: 2303
/~: 2157
>=: 2114
|: 2094
min: 1892
ctlout: 1728
element: 1680
block~: 1649
bp~: 1566
pipe: 1439
tabreceive~: 1364
div: 1333
int: 1241
threshold~: 1195
tabplay~: 1188
tabosc4~: 1171
dac~: 1160
key: 1084
swap: 1073
env~: 1041
drawpolygon: 824
makenote: 815
plot: 798
noteout: 796
>>: 780
biquad~: 766
notein: 760
delread4~: 725
tabsend~: 714
adc~: 658
line~: 614
filledpolygon: 613
clone: 612
<<: 607
pow~: 578
max~: 560
min~: 554
poly: 539
midiout: 492
tabread~: 480
netreceive: 462
filledcurve: 459
fexpr~: 456
rzero~: 442
drawcurve: 422
switch~: 413
namecanvas: 398
readsf~: 391
send~: 380
lrshift~: 379
exp: 369
choice: 336
receive~: 332
writesf~: 302
log: 265
netsend: 262
drawnumber: 253
loadbang: 240
wrap: 217
oscformat: 213
cpole~: 208
sin: 198
sigmund~: 181
rpole~: 176
pd~: 155
abs: 152
getsize: 152
slop~: 150
tabread4: 145
textfile: 144
timer: 128
fiddle~: 126
openpanel: 124
print~: 120
qlist: 114
vline~: 99
rev2~: 95
rev3~: 93
drawsymbol: 91
realtime: 87
snapshot~: 84
sqrt: 76
bendin: 76
cos~: 76
mtof: 71
cos: 64
pgmout: 58
fudiformat: 48
wrap~: 47
dbtorms: 46
savestate: 46
bendout: 45
trace: 44
stdout: 43
soundfiler: 42
oscparse: 36
output~: 36
savepanel: 35
czero~: 34
bonk~: 34
q8_rsqrt~: 33
pgmin: 32
samphold~: 32
midiin: 30
rzero_rev~: 28
log~: 25
drawtext: 25
tan: 24
bag: 24
keyname: 22
atan2: 20
touchin: 20
atan: 19
rmstodb: 19
polytouchin: 19
keyup: 19
noise~: 18
dbtorms~: 17
rfft~: 16
bob~: 16
fudiparse: 15
bang~: 15
touchout: 14
abs~: 14
polytouchout: 13
fft~: 13
sysexin: 12
pdcontrol: 12
rev1~: 11
dbtopow: 10
powtodb: 10
ifft~: 10
samplerate~: 10
cputime: 9
ftom: 9
sqrt~: 9
dbtopow~: 8
pique: 8
rsqrt~: 7
q8_sqrt~: 6
czero_rev~: 6
loop~: 6
stripnote: 4
garray: 4
exp~: 4
hilbert~: 4
ftom~: 3
mtof~: 2
powtodb~: 2
rmstodb~: 2
complex-mod~: 2
midirealtimein: 1
framp~: 1
rifft~: 1
vsnapshot~: 1
list append: 0
list fromsymbol: 0
list length: 0
list prepend: 0
list split: 0
list store: 0
list tosymbol: 0
list trim: 0
array define: 0
array get: 0
array max: 0
array min: 0
array quantile: 0
array random: 0
array set: 0
array size: 0
array sum: 0
file copy: 0
file define: 0
file delete: 0
file glob: 0
file handle: 0
file isdirectory: 0
file isfile: 0
file join: 0
file mkdir: 0
file move: 0
file size: 0
file split: 0
file splitext: 0
file splitname: 0
file stat: 0
file which: 0
text define: 0
text delete: 0
text fromlist: 0
text get: 0
text insert: 0
text search: 0
text sequence: 0
text set: 0
text size: 0
text tolist: 0
scalar define: 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@@ -0,0 +1,273 @@
Object Name,Description
bang,output a bang message
change,remove repeated numbers from a stream
float,store and recall a number
int,store and recall an integer
list,manipulate lists
list append,manipulate lists
list fromsymbol,manipulate lists
list length,manipulate lists
list prepend,manipulate lists
list split,manipulate lists
list store,manipulate lists
list tosymbol,manipulate lists
list trim,manipulate lists
makefilename,format a symbol with a variable field
moses,part a numeric stream
pack,make compound messages
print,print messages to terminal window
receive,Receive messages without patch cords.
route,route messages according to first element
select,test for matching numbers or symbols
send,Send messages without patch cords.
spigot,pass or block messages
swap,swap two numbers
symbol,store and recall a symbol
trace,message tracing for debugging
trigger,sequence messages in right-to-left order.
t, sequence messages in right-to-left order.
unpack,get elements of compound messages
until,looping mechanism
value,shared numeric value
cputime,measure CPU time
delay,send a message after a time delay
line,send a series of linearly stepped numbers
metro,send a message periodically
pipe,dynamically growable delay line for numbers
realtime,measure real time
timer,measure time intervals
!=,relational tests
*,multiply two numbers
/,divide two numbers
&,bit twiddling
&&,bit twiddling
%,higher math
+,add two numbers
<,relational tests
<<,bit twiddling
<=,relational tests
==,relational tests
>,relational tests
>=,relational tests
>>,bit twiddling
|,bit twiddling
||,bit twiddling
abs,math functions
atan,trigonometric functions
atan2,trigonometric functions
clip,force a number into a range
cos,trigonometric functions
dbtopow,convert acoustical units
dbtorms,convert acoustical units
div,higher math
exp,math functions
expr,evaluation of control data expressions
ftom,convert acoustical units
log,math functions
max,maximum of 2 numbers
min,minimum of two numbers
mod,higher math
mtof,convert acoustical units
pow,math functions
powtodb,convert acoustical units
random,pseudo random integers
rmstodb,convert acoustical units
sin,trigonometric functions
sqrt,math functions
tan,trigonometric functions
wrap,"wrap a number to range [[0,1)"
bendin,MIDI input
bendout,MIDI output
ctlin,MIDI input
ctlout,MIDI output
fudiformat,FUDI messages to and from Pd lists
fudiparse,FUDI messages to and from Pd lists
makenote,schedule delayed 'note off' message for a note-on
midiin,MIDI input
midiout,MIDI output
midirealtimein,MIDI input
notein,MIDI input
noteout,MIDI output
oscformat,OSC messages to and from Pd lists
oscparse,OSC messages to and from Pd lists
pgmin,MIDI input
pgmout,MIDI output
poly,MIDI-style polyphonic voice allocator.
polytouchin,MIDI input
polytouchout,MIDI output
stripnote,strip 'note off' messages
sysexin,MIDI input
touchin,MIDI input
touchout,MIDI output
array,general array creation and manipulation
array define,create an array.
array get,get contents as a list.
array max,output maximum value of an array.
array min,output minimum value of an array.
array quantile,outputs the specified quantile.
array random,array as probabilities.
array set,set contents from a list.
array size,output or set array size.
array sum,sum all or a range of elements.
garray,graphical array (messages received via array name).
soundfiler,read and write tables to soundfiles
table,subpatch with array.
tabread,read a number from a table
tabwrite,write a number to a table
bag,collection of numbers
declare,set environment for loading patch
file,low-level file operations
file copy,copy a file around.
file define,share file handles.
file delete,remove files and directories.
file glob,find pathnames matching a pattern
file handle,operate on file handles.
file isdirectory,check if path is an existing directory
file isfile,check if path is an existing regular file.
file join,'join' a list of components using '/' as the separator.
file mkdir,create directories
file move,move a file to a new destination.
file size,get size of a file
file split,'split' path into components
file splitext,separates directory+file and extension.
file splitname,separates directory an file components.
file stat,get metainformation about a file/directory
file which,locate a file
key,grab keyboard input
keyname,grab keyboard input
keyup,grab keyboard input
loadbang,bang on load
netreceive,listen for incoming messages from network
netsend,send Pd messages over a network
openpanel,query for files or directories.
pdcontrol,communicate with pd and/or this patch
qlist,text-based sequencer
savepanel,query you for the name of a file to create.
savestate,save and restore run-time state from within an abstraction
text,manage a list of messages
text define,"create, store, and/or edit texts"
text delete,delete a line or clear.
text fromlist,convert from list.
text get,read and output a line.
text insert,insert a line.
text search,search for a line.
text sequence,sequencer/message-sender.
text set,replace or add a line
text size,get number of lines or elements.
text tolist,convert text to a list.
textfile,read and write text files
-~,binary operators on audio signals
*~,binary operators on audio signals
/~,binary operators on audio signals
+~,binary operators on audio signals
abs~,absolute value for signals
clip~,restrict a signal between two limits
dbtopow~,acoustic conversions for audio signals
dbtorms~,acoustic conversions for audio signals
exp~,exponential function
expr~,evaluation of audio signal expressions on a vector by vector basis
fexpr~,evaluation of audio signal expressions on a sample by sample basis
fft~,forward complex FFT
framp~,estimate frequency and amplitude of FFT.
ftom~,acoustic conversions for audio signals
ifft~,inverse complex FFT
log~,logarithms for signals.
max~,binary operators on audio signals
min~,binary operators on audio signals
mtof~,acoustic conversions for audio signals
pow~,power function for signals
powtodb~,acoustic conversions for audio signals
q8_rsqrt~,signal reciprocal square root
q8_sqrt~,signal square root
rfft~,forward real FFT
rifft~,inverse real FFT
rmstodb~,acoustic conversions for audio signals
rsqrt~,signal reciprocal square root
sqrt~,signal square root
wrap~,remainder modulo 1 for signals
adc~,audio input from sound card
bang~,output bang after each DSP cycle
catch~,catch signal from one or more throw~ objects.
dac~,audio output to sound card
line~,audio ramp generator
print~,print out raw values of a signal
readsf~,read a soundfile
receive~,receive signal from a send~ object.
samplerate~,get sample rate
send~,send signal to one or more receive~ objects.
sig~,convert numbers to signals
snapshot~,convert a signal to a number on demand
threshold~,trigger from audio signal. generator
throw~,throw signal to a matching catch~ object.
vline~,high-precision audio ramp generator
vsnapshot~,deluxe snapshot~
writesf~,write audio signals to a soundfile
cos~,cosine waveshaper
noise~,uniformly distributed white noise
osc~,cosine wave oscillator
phasor~,phase ramp generator.
tabosc4~,4-point interpolating oscillator
tabplay~,play a table as a sample (non-transposing).
tabread~,non-interpolating table lookup for signals.
tabread4,4-point-interpolating table lookup for signals. lookup for signals.
tabreceive~,read a block of a signal from an array continuously
tabsend~,write a block of a signal to an array continuously
tabwrite~,write a signal in an array.
biquad~,2nd order (2-pole / 2-zero) filter
bp~,2-pole bandpass filter
cpole~,complex one-pole filter
czero_rev~,complex one-zero "reverse" filter
czero~,complex one-zero filter
env~,envelope follower
hip~,one-pole high pass filter.
lop~,one-pole low pass filter.
rpole~,real one-pole filter.
rzero_rev~,real one-zero "reverse" filter.
rzero~,real one-zero filter
samphold~,sample and hold unit
slop~,slew-limiting low-pass filter
vcf~,voltage-controlled band/low-pass filter
delread~,read from a delay line.
delread4~,read from a delay line with 4-point interpolation (for variable delay times)
delwrite~,write in a delay line.
block~,set block size for DSP
clone,make multiple copies of an abstraction.
inlet,control inlet
inlet~,audio inlet
namecanvas,attach the canvas window to a name
outlet,control outlet
outlet~,audio outlet
pd,define a subwindow (subpatch)
switch~,set block size and on/off control for DSP
drawcurve,draw shapes for data structures
drawnumber,"draw numbers, symbols or texts for Data Structures."
drawpolygon,draw shapes for data structures
drawsymbol,"draw numbers, symbols or texts for Data Structures."
drawtext,"draw numbers, symbols or texts for Data Structures."
filledcurve,draw shapes for data structures
filledpolygon,draw shapes for data structures
plot,draw array elements of scalars
struct,declare the fields in a data structure.
append,add an item to a Data Structure list.
element,get pointer to an element of an array
get,get values from a scalar
getsize,get size of a Data Structures array
scalar,create a scalar datum (default [scalar define]).
scalar define,defines and maintains a scalar.
set,set values in a scalar
bob~,Runge-Kutte numerical simulation of the Moog analog resonant filter
bonk~,attack detection and spectral envelope measurement
choice,search for a best match to an incoming list
complex-mod~,complex amplitude modulator
hilbert~,Hilbert transform
loop~,phase generator for looping samplers
lrshift~,shift signal vector elements left or right
output~,simple stereo output GUI abstraction.
pd~,run a pd sub-process
rev1~,"simple 1-in, 1-out reverberator"
rev2~,"simple 1-in, 4-out reverberator"
rev3~,"hard-core, 2-in, 4-out reverberator"
sigmund~,sinusoidal analysis and pitch tracking
stdout,write messages to standard output
fiddle~,pitch estimator and sinusoidal peak finder
pique,find peaks in an FFT spectrum
Can't render this file because it contains an unexpected character in line 219 and column 29.

68
histogram-plot/plot.py Normal file
View File

@@ -0,0 +1,68 @@
import pandas as pd
import matplotlib.pyplot as plt
from collections import Counter
import logging
import time
# Set up logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
# Start script
logging.info('Script started')
start_time = time.time()
# Read the CSV files
logging.info('Reading CSV files...')
patches_df = pd.read_csv('histogram-plot/appended_output.csv')
objects_df = pd.read_csv('histogram-plot/pd-objects-csv.csv')
# Get the list of object names
object_names = objects_df['Object Name'].tolist()
# Initialize a counter for the object occurrences
object_counter = Counter()
# Ensure 'Patch Contents' column is of string type and handle NaNs
logging.info('Processing patch contents...')
patches_df['Patch Contents'] = patches_df['Patch Contents'].fillna('').astype(str)
# Loop through the patch contents and count occurrences of each object
for i, patch_content in enumerate(patches_df['Patch Contents']):
if i % 1000 == 0: # Log progress every 1000 rows
logging.info(f'Processing row {i}/{len(patches_df)}')
for object_name in object_names:
object_counter[object_name] += patch_content.split().count(object_name)
# Save the results to a text file
logging.info('Saving results to object_counts_all.txt...')
with open('object_counts_all.txt', 'w') as file:
for object_name, count in object_counter.most_common():
file.write(f"{object_name}: {count}\n")
num_objects_to_plot = 20
# Get the most common objects
logging.info('Generating plot for the most common objects...')
most_common_objects = object_counter.most_common(num_objects_to_plot)
# Plot a histogram of the object occurrences
plt.figure(figsize=(10, 6))
plt.bar([obj[0] for obj in most_common_objects], [obj[1] for obj in most_common_objects], color='skyblue')
plt.xlabel('Object Name')
plt.ylabel('Occurrences')
plt.title(f'Top {num_objects_to_plot} Most Used Objects in Pd Patches')
plt.xticks(rotation=90)
plt.tight_layout()
# Save the plot as an image
plt.savefig('object_histogram_all.png')
logging.info('Plot saved as object_histogram_all.png')
# Show the plot
plt.show()
# End script
end_time = time.time()
elapsed_time = end_time - start_time
logging.info(f'Script finished in {elapsed_time:.2f} seconds')