Automating vline~ envelope from a waveform (envelope as wavetable
Hi everyone,
I'm working on a system to automatically generate a vline~ message list starting from a custom envelope shape stored in an array, originally extracted from a .wav file.
I want to build a dynamic vline~ list like this: 0, 1 93.753, 1 0 187.506
But instead of typing values manually, I'd like to generate it automatically based on the shape of an envelope loaded from a waveform (array).
I already convert the array index to milliseconds using: [expr ($f1 / 44100) * 1000]
And I can manually draw or extract the envelope into an array — but I’m struggling to automate the construction of the vline~ list so it correctly represents:
- attacks
- holds
- releases
- plateaus (ecc)
at the moment i Load a .wav file containing an envelope shape, Store it into an array. Detect meaningful breakpoints (e.g. slope changes, thresholds) and Use those to automatically create a proper vline~ sequence.
here the patch and one env wav file
impose-envelope-wavetable-analog.pd
strike-1_6.wav
Is there a way to extract breakpoints or slope changes from an array to build a proper vline~ message?
Has anyone implemented something similar (using an envelope from a .wav as a wavetable)?
Would “wavetable envelope” be a good term for this? Is there a better one in Pd terminology?
Thanks in advance if anyone has ideas or guidance.
Even partial thoughts or pointers would help a lot!
I almost forgot: At the moment, I’m using GPT to convert the vline~ list into the format 0, 1 93.753, 1 0 187.506 (just an example), starting from a total duration in milliseconds — in this case, 2176 ms. This naturally results in very complex lists, like something along these lines:
0, 1 100, 0.6 400 100, 0.3 2000 500, 0.15 3000 2500, 0 10491 5500
I’d really like to find a way to resolve this and automate the process, but since I’m still a beginner, I wonder if I’m just making things unnecessarily complicated?
Emiliano
Audiolab is now available on deken!
Sorry for not posting for some ... 2 years. Just a reminder that this project is still alive and slowly but surely evolving.
I pushed an update to deken today, v0.61. New stuff since version 0.4 include:
pp.fft-profile~ - esoteric spectral denoiser/vocoder
pp.loop.rec~ pp.loop.play~ - a pair of abstractions to record and play loops, but also useful for pitch shifting/reverse delays
pp.grainrev~ - a granular reverb, very cool
pp.phiverb~ - a good sounding reverb
many bugfixes and some new examples.
Make sure to use the latest version of pd (pd-0.55 at the time of posting).
In plugdata most objects should work but needs more testing.
@jewelzcotard sorry for the late reply, anyway if you moved the speakers in the gui, you can save with msg [save 1( to the rightmost inlet of pp.spat8~ and save the patch. A msg [recall 1( to the same inlet will load your settings.
Happy patching and make some noise!
Limiting amplitude on an LFO
most people make the error and use signalrate objects for their datarate LFOs - you seem to do it the other way round.
i would forget metro and use phasor~ as accumulator, and then all you need is a bit of arithmetics plus you can sum (mix) or multiply (AM, RM) layers of LFOs to get all kind of simple and complex waveforms.
for example cosine: _ *0.75 _ %1. _ cos
saw: _ *2. _ -1.
saw down: _ *-2. _ +1,
square: _ >=0.5 _ *2. _ -1.
tri is a bit more work, in pd i would use expr~
then sum : (a+b)/2
am : a(b)
rm : a((2b)-1)
plot-graph - a way to display waveforms
Here I've uploaded plot graph as an abstraction plus two other abstractions to assist in its usage make-plot and cursor-drive
plot-graph creation: plot-graph unique-name size-x size-y;
Address the settings with messages to in-unique-name (eg [s in-$0-channel-L] or connect a control-rate wire to top left corner;
make-plot creation: make-plot array-name plot-resolution;
eg [make-plot $0-left-channel 200]
make-plot is used to take the audio file size given by soundfiler and divide that by the x resolution of the plot-graph window, read the array in chunks of the min max amplitudes to plot the waveform.
cursor-drive creation: [cursor-drive x resolution] eg [cursor-drive 200] drives the play cursor if active
For best results I found it best to keep the resolution to half the window size, say 200 window 100 resolution
SETTINGS. for plot-graph
size float float (can be set as a creation arg);
min float (y value <= 0 for peaks -1 to 0);
max float (y values>= 0 for peaks 0 to 1);
index float (x value 0 to resolution cur float (x position for cursor 0 to resolution);
cur-vis float (hide/show cursor 0 or 1);
min-vis float (hide/show min plot 0 or 1);
max-vis float (hide/show max plot 0 or 1);
colour float float float float float float;
where:-;
float 1 = back colour (0 to 999 struct colours);
float 2 = border colour (0 to 999 struct colours);
float 3 = plot colour (0 to 999 struct colours);
float 4 = cursor colour (0 to 999 struct colours);
float 5 = plot thickness (1 to 5ish);
float 6 = border thickness (0 to 30ish);
plot-fill float (hide/show fill 0 or 1)
fill-col float float (0 to 999 thickness 0 to 5)
For an animated plot with fill try the following in the plot-graph-help
load audio file
click 100 resolution
click look here for more
scale x using the number-box to 200
toggle off min-vis and cursor-vis
click play (and loop if a small file)
in the more page
toggle scope plot
toggle fill plot
adjust normalise
play with the colours
plot-graph.pd and plot-graph-help.pd are read only to prevent overwriting the defaults, change this if you wish
Have fun
Cheers
Balwyn
plot-graph.zip
The picture is reduced to 70%
Recursion
Hi all,
in this patch I would like to do 5000 iterations of a recursive function.
I used the objects [metro], [counter] and [moses]. Is this the correct way to do this?
In particular, I would like it to be done as quickly as possible.
Thanks for any advice.
Note: 0.7 is the initial value, 3.798 is the constant "a" . Both values are entered automatically before running the iterations.
recursive.pd
a.
Midi Rotary Knob Direction Patch/Algorythm?
Hey everybody,
Sorry, for a lot of text. But the bold text at the bottom is my main question. The rest will help you to get a better understanding of my situation.
you helped me so much, with my last question here (the Faders are working dope now):
https://forum.pdpatchrepo.info/topic/13849/how-to-smoothe-out-arrays/25
I am doing a Steinberg Houston to Mackie Control emulation at the moment, to use my controller with other DAWs than Cubase/Nuendo. Will upload it to the internet community, when I am finished for the handful of people that maybe are also using this controller.
I made good progress:
I got the Faders and the normal knobs to work. And the display puts out information. But it is with bugs, because the LCD Screen of the Houston has 40 characters for one line and the Mackie Universal Pro has 56 Characters. So i did a list algorithm, which deletes spaces of the mackie message until the message fits on the 40 character line. Maybe there is a method wich will work better but this subject eats too much time for me at the moment and it works rough okay. One defenitely get's some helpful information on the screen from the DAW.
The Faders and Rotary Knobs and normal knobs are the most important of this controller I guess. The Faders are working fine as I mentioned above, but there is a problem with the rotary knobs, wich I can't handle alone and hope you can help me.
The problem is, that the Mackie Controller send simple clicks to the DAW. If you are turning a rotary knob, it sends out a number of midi messages:
If you turn it right, it sends midi messages wich contains the value 1 and if you turn it down it sends messages wich are containing the value 65.
"When the VPots are rotated rapidly, a message equal to the number of clicks is sent."
BUT the Houston controller instead is sending values like it's faders with 15 (MSB) and 128(LSB) values. AND it is updating the rotary limit by itself. So if I turn a rotary, it will update it's LEDs and stops sending midi messages when it reaches the maximum or minimum value. So, I did this patch as a momentary state:
The DAW sends 11 values for the Houston LEDs. 11 is max and 1 is min. This is good, I send this values to my houston controller and can update the rotary values and LEDs.
With this updated values from the DAW, I can force my rotary knobs, that they don't stop to send values, because they are set to the values, which the DAW sends, every time I turn a knob. With this method I got it to work to imitate a Mackie Rotary knob. Everytime the Houston Rotary value changes, it sends Mackie "midi click values" according to the amount of midi value changes of the houston.
BUT the problem is, that this is working only in one direction. Now my main question:
How can I make pure Data know, if I am turning my knob in the left direction or in the right direction? There is also the problem, which I mentioned above, that I set the momentary value everytime, I move the rotary, so that I get a unlimited amount of possible rotary move "clicks". Also the midi values which the houston sends arent perfect smooth. It works fine, but it isn't like that, that if you move a rotary in one direction, every value one by another is perfectly lower or higher.
I think I maybe need a algorythm, which looks if the values in a time period are getting higher or lower and then send out bangs on two seperate outlets. For example the left outlet for lower values and the right outlet for higher values. And it should also detect, if I move the rotary fast or slow. So a constant smoothing or clocked bang is also not an option. This is defenitely to complicated for me. I have no idea and what I tried didn't worked.
Would be super cool, if you could help me out again.
Start, stop and restart a midi file
@atux said:
@whale-av said:
@atux You need to look at the help file for [seq].
[...]
There is also a message [goto(
[...]
.using |pause( and |continue( it work fine.
Instead using |goto( for now nothing happens. For example the file lasts 90 sec, I put as argument 20000 ms: it should start from t = 20s, but nothing happens.
Now I understand why using [seq] nothing happens with [goto 20000( ....the argument must be in * seconds * and not in * milliseconds *...
So to start at t=20 seconds, it must be put [goto 20(.
Now the "goto" in the patch should work.
I have a question: I'm trying to figure out if the message argument [goto( can be used as a variable, in order to handle it numerically, for example by scrolling a number box, anyone have any ideas to do this?
Thanks
a
Ganymede: an 8-track, semi-automatic samples-looper and percussion instrument based on modulus instead of metro
Ganymede.7z (includes its own limited set of samples)
Background:
Ganymede was created to test a bet I made with myself:
that I could boil down drum sequencing to a single knob (i.e. instead of writing a pattern).
As far as I am concerned, I won the bet.
The trick is...
Instead of using a knob to turn, for example, up or down a metro, you use it to turn up or down the modulus of a counter, ie. counter[1..16]>[mod X]>[sel 0]>play the sample. If you do this then add an offset control, then where the beat occurs changes in Real-Time.
But you'll have to decide for yourself whether I won the bet. .
(note: I have posted a few demos using it in various stages of its' carnation recently in the Output section of the Forum and intend to share a few more, now that I have posted this.)
Remember, Ganymede is an instrument, i.e. Not an editor.
It is intended to be "played" or...allowed to play by itself.
(aside: specifically designed to be played with an 8-channel, usb, midi, mixer controller and mouse, for instance an Akai Midimix or Novation LaunchPad XL.)
So it does Not save patterns nor do you "write" patterns.
Instead, you can play it and save the audio~ output to a wave file (for use later as a loop, song, etc.)
Jumping straight to The Chase...
How to use it:
REQUIRES:
moonlib, zexy, list-abs, hcs, cyclone, tof, freeverb~ and iemlib
THE 7 SECTIONS:
- GLOBAL:
- to set parameters for all 8 tracks, exs. pick the samples directory from a tof/pmenu or OPEN_IND_DIR (open an independent directory) (see below "Samples"for more detail)
- randomizing parameters, random all. randomize all every 10*seconds, maximum number of bars when randomizing bars, CLR the randomizer check boxes
- PLAY, L(imited) or I(nfinite) counter, if L then number of bars to play before resetting counter, bpm(menu)
- MSTVOL
- transport/recording (on REC files are automatically saved to ./ganymede/recordings with datestamp filename, the output is zexy limited to 98 and the volume controls the boost into the limiter)
- PLAYHEADS:
- indicating where the track is "beating"
- blank=no beat and black-to-red where redder implies greater env~ rms
- MODULAE:
- for information only to show the relative values of the selected modulators
- WEIGHTS:
- sent to [list-wrandom] when randomizing the When, Accent, and Offset modulators
- to use click READ_ARRAYS, adjust as desired, click WRITE, uncheck READ ARRAYS
- EVEN=unweighted, RND for random, and 0-7 for preset shapes
- PRESETS:
- ...self explanatory
-
PER TRACK ACCORDION:
- 8 sections, 1 per track
- each open-closable with the left most bang/track
- opening one track closes the previously opened track
- includes main (always shown)
- with knobs for the sample (with 300ms debounce)
- knobs for the modulators (When, Accent, and Offset) [1..16]
- toggles if you want that parameter to be randomized after X bars
- and when opened, 5 optional effects
- adsr, vcf, delayfb, distortion, and reverb
- D-W=dry-wet
- 2 parameters per effect
-
ALL:
when ON. sets the values for all of the tracks to the same value; reverts to the original values when turned OFF
MIDI:
CC 7=MASTER VOLUME
The other controls exposed to midi are the first four knobs of the accordion/main-gui. In other words, the Sample, When, Accent, and Offset knobs of each track. And the MUTE and SOLO of each track.
Control is based on a midimap file (./midimaps/midimap-default.txt).
So if it is easier to just edit that file to your controller, then just make a backup of it and edit as you need. In other words, midi-learn and changing midimap files is not supported.
The default midimap is:
By track
CCs
---TRACK--- | ---SAMPLE--- | ---WHEN--- | ---ACCENT--- | --- OFFSET--- |
---|---|---|---|---|
0 | 16 | 17 | 18 | 19 |
1 | 20 | 21 | 22 | 23 |
2 | 24 | 25 | 26 | 27 |
3 | 28 | 29 | 30 | 31 |
4 | 46 | 47 | 48 | 49 |
5 | 50 | 51 | 52 | 53 |
6 | 54 | 55 | 56 | 57 |
7 | 58 | 59 | 60 | 61 |
NOTEs
---TRACK--- | ---MUTE--- | ---SOLO--- |
---|---|---|
0 | 1 | 3 |
1 | 4 | 6 |
2 | 7 | 9 |
3 | 10 | 12 |
4 | 13 | 15 |
5 | 16 | 18 |
6 | 19 | 21 |
7 | 22 | 24 |
SAMPLES:
Ganymede looks for samples in its ./samples directory by subdirectory.
It generates a tof/pmenu from the directories in ./samples.
Once a directory is selected, it then searches for ./**/.wav (wavs within 1-deep subdirectories) and then ./*.wav (wavs within that main "kit" directory).
I have uploaded my collection of samples (that I gathered from https://archive.org/details/old-school-sample-cds-collection-01, Attribution-Non Commercial-Share Alike 4.0 International Creative Commons License, 90's Old School Sample CDs Collection by CyberYoukai) to the following link on my Google Drive:
https://drive.google.com/file/d/1SQmrLqhACOXXSmaEf0Iz-PiO7kTkYzO0/view?usp=sharing
It is a large 617 Mb .7z file, including two directories: by-instrument with 141 instruments and by-kit with 135 kits. The file names and directory structure have all been laid out according to Ganymede's needs, ex. no spaces, etc.
My suggestion to you is unpack the file into your Path so they are also available for all of your other patches.
MAKING KITS:
I found Kits are best made by adding directories in a "custom-kits" folder to your sampls directory and just adding files, but most especially shortcuts/symlinks to all the files or directories you want to include in the kit into that folder, ex. in a "bongs&congs" folder add shortcuts to those instument folders. Then, create a symnlink to "bongs&congs" in your ganymede/samples directory.
Note: if you want to experiment with kits on-the-fly (while the patch is on) just remember to click the REFRESH bang to get a new tof/pmenu of available kits from your latest ./samples directory.
If you want more freedom than a dynamic menu, you can use the OPEN_IND(depedent)_DIR bang to open any folder. But do bear in mind, Ganymede may not see all the wavs in that folder.
AFTERWARD/NOTES
-
the [hcs/folder_list] [tof/pmenu] can only hold (the first) 64 directories in the ./samples directory
-
the use of 1/16th notes (counter-interval) is completely arbitrary. However, that value (in the [pd global_metro] subpatch...at the noted hradio) is exposed and I will probably incorporate being able to change it in a future version)
-
rem: one of the beauties of this technique is: If you don't like the beat,rhythm, etc., you need only click ALL to get an entirely new beat or any of the other randomizers to re-randomize it OR let if do that by itself on AUTO until you like it, then just take it off AUTO.
-
One fun thing to do, is let it morph, with some set of toggles and bars selected, and just keep an ear out for the Really choice ones and record those or step in to "play" it, i.e. tweak the effects and parameters. It throws...rolls...a lot of them.
-
Another thing to play around with is the notion of Limited (bumpy) or Infinite(flat) sequences in conjunction with the number of bars. Since when and where the modulator triggers is contegent on when it resets.
-
Designed, as I said before, to be played, esp. once it gets rolling, it allows you to focus on the production (instead of writing beats) by controlling the ALL and Individual effects and parameters.
-
Note: if you really like the beat Don't forget to turn off the randomizers. CLEAR for instance works well. However you can't get the back the toggle values after they're cleared. (possible feature in next version)
-
The default.txt preset loads on loadbang. So if you want to save your state, then just click PRESETS>SAVE.
-
[folder_list] throws error messages if it can't find things, ex. when you're not using subdirectories in your kit. No need to worry about it. It just does that.
POSTSCRIPT
If you need any help, more explanation, advise, or have opinions or insight as to how I can make it better, I would love to hear from you.
I think that's >=95% of what I need to tell you.
If I think of anything else, I'll add it below.
Peace thru Music.
Love thru Pure Data.
-s
,
What should I do (again!) about graphics?
OK. So another semester has passed, and I'm still stuck with the same dilemma about graphics in Pd.
Gem:
- Pro: Features (image analysis, tons of pix_es).
- Pro: Long history.
- Pro: Design fits well into the Pd paradigm.
- Con: Some students on Mac couldn't use it.
- Con: Some students in Windows couldn't use it.
- Con: How is it 2021 and it doesn't automatically enable antialiasing? (Part of me wants to apologize for being punchy about this, but... it is actually 2021. Anti-aliasing is standard. Because GEM has problems with it, it looks really REALLY out of date. Like, if Pd used eight-bit integer samples only. That kind of out of date. And no, [polygon_smooth] does exactly nothing on my system. I tried. No effect at all.)
- Con: Some more complex use cases were really difficult for me to figure out (e.g., unclear when [pix_buffer] is or isn't needed).
Ofelia:
- Pro: Examples look very slick and performant.
- Pro: Anti-aliasing (generally beautiful rendering).
- Pro: 60Hz's abstractions make it more approachable, for basic use cases.
- Con: Outside of the basic use cases, Lua will be very hard for the students in my class to approach.
- Con: No image analysis features. (Open Frameworks has ofxOpenCV as an add-on, but it isn't easy to use add-ons with Ofelia, especially if I have to provide binaries of my own Ofelia fork to students in both Mac and Windows.) So... "You know how in Gem or jitter, you can read the webcam and do stuff with the data? Yeah. You can't do that with Ofelia." (At which point, clever students would ask why I'm using it at all.) IMO this is a massive, huge, gaping hole in Ofelia's feature set.
- Con: 60Hz's abstractions have so far undergone limited testing.
- Con: I would have to redevelop/port various shaders, and still not approach the number of pixes in Gem.
Max/MSP/jitter:
- Pro: Well, it just works.
- Con: Make me boot into Windows several times a week to prepare course material. Grrrrrr.
- Con: Not FLOSS.
Rewrite the entire course using SC and Processing:
- Pro: Everything works.
- Con: Students here won't touch code.
Quit my job:
- Pro: Relax and make music.
- Con: Run out of money in a few years.
I don't know what to do, and I have about a week to make a decision. If I go with Ofelia, I will have to put off other projects because it's going to take a bunch of work to get a handful of shaders up and running. I don't really want to do that. But, last fall semester, there were a few student machines that just couldn't run Gem. One of them could hack [gemwin] but that kind of thing shakes confidence.
I would really like Ofelia to add ofxOpenCV. I would just about not hesitate to use it then.
hjh
Mono / stereo detection
aha, so they take messages when you name them?
[quote]What would not work is to patch a control and a signal in simultaneously: the signal will overwrite the control.[/quote]
haha, in max it is like that:
most externals take signals and messages at the signal inlets.
if you connect a signal and a number to math objects like +~, the number would multiply the signal value.
if you want to connect signals and messages to an abstraction, you have to use something like [route start stop int float] inside the abstraction - the signal will come out of the "does not match" output of [route].
to complete the magic, you can pack signals into named connections using [prepend stereoL] [prepend stereoR] [prepend modulation1] [prepend modulation2] and then you can send all 4 signals through one connection into the subpatch.
you can also mix different types of connections that way.
...
regarding the problem of the OP:
in max i made myself abstractions to enhance the function of inlets and outlets, where you can send a [metro 3000] into using s/r in order to find out which inlets are connected and which not.
in theory one could do that with audio, too, and add a pulsetrain of + 1000. to a stream, later decode the stuff by modulo 1000.