I need multi-objective optimization for audio features
Hello everyone,
as most of you know, I'm continuously developing my Ewolverine patch with which you can genetically breed sounds out of your MIDI-gear.
In order to automatically approximate synthesizer parameters, Ewolverine must compare different synth-sounds to a target sample. The problem is that sounds match differently to the target sample depending on the comparison-criterion.
Examples:
Case 1:
If the selection criterion is the length of synthesized sounds in comparison to the target, the selection mechanism may choose for synth parameters that generate sounds as long as the target sample, but may pay no attention to its timbre.
Case 2:
If the selection criterion is the onset, the generated sounds may all have equal onsets, but differ in length and timbre.
What I need is a way of multi-objective optimization which takes all criteria into account and tells Ewolverine's selection mechanism which synthesized sound is generally nearest to the target sample.
Is there anything in pd that I could use or do you have any idea what I could do or do you know anyone who could help me?
Possible audio file playback methods
@Transcend Ahh..... that is where the confusion arises. What is being read is individual samples.... at 44100Hz sample rate there are 44100 every second. The pitch is heard because of the rate at which they rise and fall in value.
In Pd a sine wave at 100 Hz would have a sample value of zero (maybe, it depends at what time the wave starts) at index 0, and then rising sample values to a value of 1 at sample number 110 (more or less) falling back to a sample value of 0 at sample 220, continuing to fall to -1 at sample 330 and then rising back to a value of zero at sample number 441....... etc. etc.
When those values are read by [tabread4~] the output would....... eventually, once it gets to your speakers..... push and pull the speaker smoothly 100 times a second, and be heard as 100Hz. Depending on the bit-depth of the dac the actual sample values later in the chain will be much larger, but Pd max/min values are +1/-1 at the output to the [dac~]. Your soundcard and Pd take care of that automatically.
If there is another sound, say at 1KHz., that would modulate that 100Hz wave..... it would look like a ripple on the 100Hz wave........ and so on. A music track will look a real mess when you look at it, with only loud / quiet parts really recognisable. But our ears, or more especially our brains, can make total sense of it.
Samplerate (audio) objects are used to set the indexes because they send a value at the samplerate...... so 44100 times a second...... so every single index is sent to [tabread4~]
Digital audio (FFT) is fiendishly complicated to understand, but this gets you quite a long way into it in only a few minutes........ https://medium.com/@djtech42/explanation-of-sample-rate-in-digital-audio-and-breakdown-of-misconceptions-38f912fb3b1f
Actually it gets you a very long way toward a good understanding in just a few minutes.......
David.
Little help with pitshifter.
oh shoot! okay. I use a vline~ to feed tabread4~ so the method is a little different
The mtof part is designed to calculate a ratio - so if you input a zero into the left part, the result is one. If you input something like -5, it will give you a value that is less than one. You can multiply that value by the length of the sample in ms to get how long the sample would play back if you wanted it to play at 5 semitones above(?) the base pitch of the sample. You have to choose a midi note to start at. Above that note, the sample will play faster, below that note the sample will play slower. I think I calculate this value by taking the base note and subtracting from that the note from the midi keyboard.
You want to use the tabread4~ method from the (3.7.1.1.) example, but instead of feeding it with a phasor~, try feeding it with a vline~. Then you can calculate the length in samples of your sample. That's the left output of soundfiler. Dividing length in samples by the samplerate~ gives you the lenght of the sample in seconds. Multiply that by 1000 and you have the the length in milliseconds. vline~ takes input in milliseconds. Send it a message to ramp from 0 to the number of samples in your sample in the number of milliseconds you just calculated. If you want to repitch it, also multiply by the midi ratio from above.
If you want to use phasor~ instead, you're setting frequency in Hz. So instead of multiplying the sample length by 1000, you might want to multiply it by the ratio and then get the reciprocal of it with this:
Then feed that to the phasor~
Are you going to use phasor~ in your design? I could double check that there's not a better transposing method with phasor.
Actually, it might be way easier with phasor, You could convert your current input to phasor to midi with ftom, then add transposition in semitones and then convert back to a frequency...
Stomp-board my current project
This is a project I started just before Xmas. It was a really just an exercise to see how my nknob.pd abstraction would work in the real world, then morphed into a styling execise.
Stomp-board is a collection of guitar effects vaguely resembling stomp boxes. They can be arranged
and wired in any order and can be repeated as often as required. Each effect is given a unique name
when placing and this name is used to automatically save preset parameters against.
Effects are placed as objects in the normal Pd manner with one argument (eg [digi-delay Delay-1]) and connected with audio wires that should be in line with the round markers (there are fake inlets and outlet to the right as spacers)
As a graphics exercise its a failure because the nknob.pd is very heavy in the template area.
Its almost impossible to delete the effects objects as they grow in number (they will eventually delete though) and it is therefore essential to use the Quit button to end a session. There is a barely started help file.
stomp-board.pd is the demo (see pic), stomp-base.pd is the minimum start point.
I have collected the whole thing including the required externals in a folder Pd-effects-stand-alone
I think out of the box its windows only and in fact I have a folder for Pd 0.48 portable (empty) and a batch file stomp.bat that points to it (you will need to download Millers pd-vanilla portable version to use that)
Points of interest
In stomp-board.pd The looper can automatically record one cycle of drums from four-drums then stop the drums and play the loop and if the guitar is ready then record that on the next cycle
there is a wireless way to send messages to most controls via the unique name + control name
nknob has a range of 0-100
Any questions, please ask.
I have bash on my 1970's Ibanez strat-copy using this program just about every day
Cheers Balwyn
The following effects and control objects are available
active-switch.pd,
audio-catch.pd
audio-in.pd
audio-out.pd
audio-receive.pd
audio-send.pd
audio-throw.pd
audiobar.pd
chorus.pd
compressor.pd
controlbar.pd
data-send.pd
delay-only.pd
digi-delay.pd
distortion.pd
drum.pd
four-drums.pd
fuzzbox.pd
graphic-eq.pd
grater-v2.pd
lfo.pd
looper.pd
nknob.pd
noisegate.pd
panning.pd
para-eq.pd
phaser.pd
pitchshift.pd
pot.pd
presetter.pd
rec-player.pd
reverb.pd
rnd.pd
scope.pd
stomp-base.pd
stomp-board.pd
stomp.bat
tremolo.pd
tuner.pd
vcf-phaser.pd
volramp.pd
wavescope.pd
Tabread4~~ example (or alternative)
@Gabriel-Lecup If you just want to loop at normal speed then you can use [tabplay~]
It will be sample perfect.
You just have to deal with waveform mismatch at the loop point..... which will cause clicks.
If you want to change the playback speed then you have another problem.
Artefacts are unavoidable. Well I will qualify that. As you reduce the playback speed you have to increase the original sample-rate of the Sample compared to your output sample-rate to avoid them. Half speed... double the sample-rate of the Sample. You cannot do that in Pd as far as I know.
If you cut the playback speed in half. This causes everything to sound an octave lower because the time stretching makes all the soundwaves twice as long, which means their frequencies will be cut in half and thus sound an octave lower.
This leads the problem that every single sample you use needs to be played twice or else there will be gaps (a much worse "artefact"). To avoid this problem you can use [tabread4~], which interpolates intermediate values that it generates using information from the values that ultimately precede and follow it.
If you increase the playback speed then samples are dropped. This unavoidably creates artefacts as well. As you say, with a tone they will be audible.
Filters can help with high frequency ringing, but might already be built into the object.... though probably not, because you can see the ringing in [B04.tabread4.interpolation].pd in the doc folder.
Someone might know whether [tabread4~] (or [tabread4~~] even), uses quadratic or cubic interpolation. Checking the processing overhead might tell you....... https://www.maximalsound.com/mastering/interpolation methods.pdf
You need to add 2 samples to the array for [tabread4~] ((see [tabread4~-help])) to do it's math playing back the whole sample.
I had never thought about it, but 2 zero samples should probably be inserted after a loop point to allow the curve to interpolate to zero. This would also avoid any post Sample clicks. But how?
I assume that [tabread4~~] which seems not to be available to me on windows, uses double precision.
That will give more accuracy for bit depth, but the samples still arrive at the same speed, so I cannot see how it helps you here. 64-bit precision interpolation over 32-bit precision. Audible? I would be very surprised.
If it is working well for the patch that @beep.beep has kindly posted then I can only assume that [tabread4~~] deals automatically with the 2 sample overhang.
David.
MobMuPlat Ready Effects Collection (i.e. 30 Vanilla-compliant MMP effects) w GUI
"The PD trees sometimes bear unexpected fruit."
The zip below includes 29+1(raw) standardized effects (esp.) for use with MobMuPlat.
They all work and have been standardized in the following manner:
- all are MMP-compliant (so include only objects which MMP supports)
- have 3 inlets and 1 outlet~
- the inlets are (from left to right): the incoming signal (i.e. inlet~), the parameters(3), and a switch~
- the effects have all been finessed to only include <= 3 parameters
- the parameters are sent to the second inlet via [0 $1(, [1 $1(, and [2 $1(
- the switch is a toggle so 0|1
and - each window is 186x116 pixels.
I have included an .mmp file to listen to and test them with either adc~ | randomnotes. It also includes a bypass toggle , three parameter knobs (which load the parameter name to each label once an effect is chosen), and a gain. Only the selected effect's switch is turned "on" so it is very low on the cpu.
The MMP file, in and of, itself may prove useful to someone as it packages in a single place a 30-effect "pedal-box".
That however is not why I am sharing it.
Since the effects are standardized and mmp-compliant, my hope/thinking is others may include them in their work no matter what it may be and thus build their patches, apps, etc., using the effects as building-blocks.
I have accredit the original effects designers by adding a suffix (in parenthesis) to each effect as follows (in alpha-order):
d=DIY2 Collection
g=Guitar Extended
s=Stamp Album Collection
v=scott vanya (me)
The included effects (basically the best I could find that lent themselves to 3 parameters) are as follows:
audioflow(v).pd
beatlooper(v).pd
bodyresonance(d).pd
chorus(s).pd
delay(3tap)(d).pd
delay(fb)(d).pd
delay(pitch)(v).pd
delay(push)(v).pd
delay(revtap)(g).pd
delay(spect)(d).pd
delay(stag)(v).pd
delay(tbr)(v).pd
delay(wavey)(v).pd
detuning(g).pd
distortion(d).pd
filter(s).pd
flanger(s).pd
hexxciter(g).pd
looper(fw-bw)(v).pd
octaver-harmonizer(p).pd
phaser(s).pd
pitchshifter(d).pd
reverb(pure)(d).pd
ringmod(g).pd
shaper(d).pd
stepvibrato(g).pd
streamStretch(v)-help.pd
streamStretch(v).pd
tremolo(d).pd
vcf(d).pd
vibrato(d).pd
vibrato(step)(g).pd
wah-auto(v).pd
wavedistort(d).pd
Note: there are too many effects to go into detail about what each parameter does. So I leave that for you to either figure out/discover on your own or post here your question and I will answer it as time/energy/etc allow.
Peace and Loving Music Through us all.
Sincerely,
Scott
prophet 3003 wavetable synth prototype
hi all ... im developing a funky wavetable synth thats inspired by the sequential circuits prophet 2000 from 1985. it uses the original 12 bit ROM from this synth and and a synthesis menthod called harmonic aliasing.
- all frequencies and repeat rates are related by simple integer relationships
- adaptive just intonation = infinite tuning systems
- 3 oscillators per voice
- wavetables by multiplexing oscs with waveshaped sines
- variable sample rate simulation via resampling with audiorate wavetables (BLITs)
- integrated complex numeric sequencer
- integrated delay for hardware mixer feedback loop with analog eqs
basically it includes everything i think is cool about numeric sequencing and is still really low on dsp because its all based on integers mechanics like early wavetable synths.
this synth can sound really ambient or real raw depending on the complexity of the number relationships and the waveshaping settings. eventually this is going to be a hardware synth with FPGA technology, variable sample rate per oscillator and analog eqs/filter ... just like in the 80s
project logo:
https://i.imgur.com/F1kqrMt.png
prototype patch:
wave multiplexing:
.
harmonic aliasing is inspired by a patch by acreil: https://forum.pdpatchrepo.info/topic/6759/new-anti-aliasing-and-phase-distortion-abstractions.
early discussion: https://forum.pdpatchrepo.info/topic/11176/adaptive-sample-rate-and-harmonic-aliasing-in-pd
.
mixer delay feedback loop feature:
lots of different sounds with audiorate waveshaping:
.
Personal shortcuts in patch
The former African winner who spearheaded a two-week training practice for junior players stated he would be willing to support the Nigeria Table Tennis Federation (NTTF) in its quest to revive the fortune of the game "We've improved a lot today particularly with young players such as Aruna Quadri as everybody seen what happened at the Lagos World Tour and the African Top 16 Cup. At present, some of these Egyptian players are afraid of Nigerians. https://github.com/pingpongsport/bestpingpong/wiki/Best-Ping-Pong-Paddles-&-How-To-Choose-Them
Before, the Egyptians ?will think that they can defeat Nigerian players but today they have doubts of that which we are capable of accomplishing, because they have been convinced by our performance at the Lagos World Tour "I believe that in the next four to five decades, we'll see tremendous improvement in Nigeria tabletennis and I am optimistic that young players enjoy Tosin Oribamishe will be Africa champions in the next three or four years," he confessed. His words: "Exactly what the federation is trying to do would be to ensure that we get our players constantly engaged and we are fortunate to own Toriola, who's ready to utilize the national coaches.
I believe the thing that is most important now is coming off the back of a 2014 Commonwealth Games particularly. We know that we want some new players and some of the players hopefully at the next four decades are going to be in the Commonwealth games, so I am pretty sure that one or 2 of them will be there so we must work harder to build on the successes we have had and that I feel a fresh batch of celebrities will be discovered shortly" Oshodi appealed to identify with the game, to support the federation. Onaolapo and Aruna Quadri. So it tells you that the job we're doing is coming ahead but now that means awaiting NSC and we need money and our sponsors have been very helpful. https://github.com/pingpongsport/bestpingpong/wiki/Best-Ping-Pong-Tables-&-How-To-Choose
They tried very hard but now we want the Federal Government to rear table tennis in Nigeria," he added. However, Toriola that has played important role in the ping pong of the country scene in the era of Egypt believes it's over for the North Africans Sep 09, 2014 (This Day/All Africa Global Media via COMTEX) -- Nigeria's longest serving table baseball player, Segun Toriola, has announced that Egypt's dominance of the sport in the continent has been over In the last five decades, Egypt sustained its dominance of table tennis at the African upper 16 Cup when the Aruna Quadri of Nigeria defeated two Egyptians en-route to clinching the title until recently in Africa and this continued unabated "For me it's very important to give something back to the young ones and everybody know that I have been playing with the national team for many decades.
It is very important to allow the young ones, as I'm planning to stop next year have more comprehension of the sport. Having gained a lot of knowledge even as a junior participant and with over 15 years experience, I think it's also very important I'd like to impart about the younger players," he explained "We must thank our sponsors, the people who backed us and to perform more championships means more cash and that's a significant constraints we are having but we are seeking to the National Sports Commission (NSC) now over. We need their support and backing. We advised we will provide at the Commonwealth Games and a bronze, which we haven't done in a long time was sent by us. We are very proud of that medal considering the fact that we have two young players from the team - Ojo
https://www.linkedin.com/pulse/best-ping-pong-robots-ping-pong-sport/
President of the Nigeria Table Tennis Federation (NTTF), '' Wahid Enitan Oshodi, insisted that getting players like Toriola stays a plus into the country
Andúril (MobMuPlat app): fwd/bwd looper + 14 effects + elven cloak (control parameters via env~ and pitch as you play)
Andúril (MobMuPlat app): fwd/bwd looper + 14 effects + elven cloak (control parameters via env~ and pitch as you play)
UPDATED VERSION (corrected MobMuPlat system crash problem):
anduril.zip
This has been long in coming and I am very glad to finally release it (even tho my handheld hardware is not up to the job of running the elven cloak feature).
First a demo video and some screenshots, , and then the instructions.
DEMO VIDEO
SCREENSHOTS
Intention(s):
The app is designed to give (specifically a guitarist) tho really any input (even prerecorded as is the case in the demo (from: "Laura DeNardis Performing Pachabels Canon" from https://archive.org/details/LauraDenardisPerformingPachabelsCanon, specifically the wave file at: https://archive.org/download/LauraDenardisPerformingPachabelsCanon/PachabelsCanon.wav, Attribution-Noncommercial-Share Alike 3.0) FULL Control over the "voice" of their output-sound.
It includes:
a 5-band EQ (on page 2 of the app) (upfront that is applied to all incoming sounds);
a looper: with record, forward, backward, speed, and bypass controls (that runs via a throw along with the effects channel)
14 effects each with 3 controllable parameters (via the xy-slider+centered knob) including: chorus, distortion, delay, reverb, flanger, tremolo, vibrato, vcf, pitchshifter, pitchdelay, 12string, stepvibrato, pushdelay (delayfb driven by magnitude of the env~), and stagdelay (2 out-of-sync delay lines which can be driven in and out of phase by the sum of their delwrite+vd's so what goes in first may come out last)
elven_cloak: which drives the 3 parameter controls via the peak bands amplitude and proximity to a set pitch (midi note) and whose window can be broadened or shrunk and shifted within that window, i.e. the three effect parameters are changed automatically according to what and how you play
and
a tester synth: that randomly sends midi pitches between 20-108, velocities between 20-127, and durations between 250-500ms.
CONTROLS (from top-left to bottom-right):
PAGE 1:
Effect: effects menu where the you choose an effect;
>>>,<<<: page navigation buttons;
IN,OUT: gains (IN is the preamp on the EQ5, and OUT is applied to total output);
REC,FWD,BWD,speed,normspd: the looper toggles and on speed, higher is faster and mid normal and normspd resets to mid;
xy-slider+centered knob: the 3 parameter controls + their labels (the bottom is x, top y and above the knob for the third one), the name of the selected effect and its parameters load each time you choose from the Effects menu, bottom left is lowest, top-right highest;
ByLp,ByEff: bypasses for the looper and effects "channel" (the outputs are summed);
EC-on: elven cloak toggle (default=off);
PAGE 2:
the EQ5 controls;
synthtest: off|on, default is off;
PAGE 3: elven cloak controls
reset: sets shift, metro, mid, and radius to 0, 500(ms),64,100% respectively (i.e. the entire midispectrum, 0-127) respectively;
mini-xyz, test: if test is on, you see a miniature representation of the xyz controls on the first page, so you can calibrate the cloak to your desired values;
shift: throws the center of the range to either the left or right(+/-1);
metro: how frequently in milliseconds to take env~ readings;
mid: the center in midipitch, i.e. 0-127, of the "watched" bands
radius(%): the width of the total bands to watch as a percentage of whichever is lower 1-mid or mid
END CONTROLS
Basic Logic:
There are 4 modes according to the bypass state of the looper and effects.
A throw catch and gain/sum/divide is applied accordingly.
End:
As I mentioned at the first, my handheld(s) are not good enough to let me use this but it runs great on my laptop.
So...
I would love to hear if this Does or Does Not work for others and even better any output others might make using it. I am enormously curious to hear what is "possible" with it.
Presets have not (yet been included as I see it, esp. with the cloak as a tool to be used for improv and less set work. Tho I think it will work nicely for that too if you just turn the cloak off.
hmmm, hmmm,...
I think that's about it.
Let me know if you need any help, suggestions, ideas, explanations, etc. etc. etc. regarding the tool. I would be more than happy to share what I learned.
Peace, Love, and Ever-Lasting Music.
Sincerely,
Scott
p.s. please let me know if I did not handle the "attribution" part of "Laura DeNardis Performing Pachabels Canon" License correctly and I will correct it immediately.
Ciao, for now. Happy PD-ing!
The Harmonizer: Communal Synthesizer via Wifi-LAN and Mobmuplat
The Harmonizer: Communal Synthesizer via Wifi-LAN and Mobmuplat
The Harmonizer
The Harmonizer is a single or multi-player mini-moog synthesizer played over a shared LAN.
(credits: The original "minimoog" patch is used by permission from Jaime E. Oliver La Rosa at the the New York University, Music Department and NYU Waverly Labs (Spring 2014) and can be found at: http://nyu-waverlylabs.org/wp-content/uploads/2014/01/minimoog.zip)
One or more players can play the instrument with each player contributing to one or more copies of the synthesizer (via the app installed on each handheld) depending on whether they opt to play "player 1" or "player 2".
By default, all users are "player 1" so any changes to their app, ex. changing a parameter, playing a note, etc., goes to all other players playing "player 1".
If a user is "player 2", then their notes, controls, mod-wheel etc. are all still routed to the network, i.e. to all "player 1"'s, but they hear no sound on their own machine.
There are 2 pages in The Harmonizer. (See screenshots below.)
PAGE 1:
PAGE 2:
The first page of the app contains all controls operating on a (more or less) "meta"-level for the player: in the following order (reading top-left to bottom-right):
pl2: if selected (toggled) the user is choosing to play "player 2"
mot(ion): triggers system motion controls of the osc1,2&3 levels (volume) based on the accelerometer inside the smartphone (i.e as you twist and turn the handheld in your hand the 3 oscs' volumes change)
rate: how frequently should the handheld update its accelerometer data
slimit: by how much should the app slow down sending the (continuous) accelerometer data over the network
presets: from 1 to 5 preset "save-slots" to record and reload the Grid 1 and Grid 2 settings that are currently active
S: save the current Grid1 and Grid2 selections to the current "save slot"
L: load the currently selected preset into both Grids
">>": go the the next page (page 2 has the reverse, a "<<" button)
Grid 1: the settings, in 4 banks of 3 parameters per-, which are labeled top-down equating to left-right
Grid 2: the same as Grid 1, but with a different set of parameters
The second page comprises:
the 2-octave keyboard (lower notes on top),
a 9-button octave grid (which can go either up or down 4 octaves),
a quick-preset grid which loads one of the currently saved 5 presets
the "<<" button mentioned above, and
both a mod and pitch-bend wheel (as labeled).
SETUP:
All players install Mobmuplat;
Receive The Harmonizer (in the form of a .zip file either via download or thru email, etc.)
When on your smartphone, click on the zip file, for example, as an attachment in an email.
Both android and iphone will recognize (unless you have previously set a default behavior for .zip files) the zip file and ask if you would like to open it in Mobmuplat. Do so.
When you open Mobmuplat, you will be presented with a list of names, if in android click the 3 dots in the top right of the window and on the settings window , click "Network" Or on an iphone click "Network" just below the name list;
On the Network tab, click "LANDINI".
Switch "LANDINI" from "off" to "on".
(this will allow you to send your control data over your local area network with anyone else who is on that same LAN).
From that window, click "Documents".
You will be presented again, with the previous list of names.
Scroll down to "TheHarmonizer" and click on it.
The app will open to Page 1 as described and shown in the image above.
Enjoy with Or without Friends, Loved, Ones, or just folks who want to know what you mean "is possible" with Pure Data )!
Theories of Thought on the Matter
My opinion is:
While competition could begin over "who controls" the song, in not too great a deal of time, players will see first hand, that it is better (at least in this case) to work together than against one another.
If any form of competition emerges in the game, for instance loading a preset when a another player was working on a tune or musical idea, the Overall playablilty and gratitude-level will wain.
However, on the other hand, if players see the many, many ways one can constructively collaborate I think the rewards will be far more measurable than the costs, for instance, one player plays notes while the other player plays the controls.
p.s. my thinking is:
since you can play solo: it will be fun to create cool presets when alone then throw them into the mix once you start to play together. (Has sort of a card collecting fee ).
Afterward:
This was just too easy Not to do.
It conjoins many aspects of pure data together (I have been working on lately (afterward: i did this app a long time ago but for some reason and am only now thinking to share it) both logistical and procedural into a single whole.
I think it does both quite well, as well as, offer the user an opportunity to consider or perhaps even wonder: What is 'possible'?"
Always share. Life is just too damn short not to.
Love only.
-svanya