Getting chaos-0.2 to run in Purr Data
edit: solved
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...
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.
Purr Data Linux-64 and GEM?
@jancsika said:
ls /usr/lib/pd-l2ork/extra/Gem/Gem*
ls /usr/lib/pd-l2ork/extra/Gem/Gem*
/usr/lib/pd-l2ork/extra/Gem/Gem.la
/usr/lib/pd-l2ork/extra/Gem/Gem-meta.pd
/usr/lib/pd-l2ork/extra/Gem/Gem.pd_linux
/usr/lib/pd-l2ork/extra/Gem/GemPrimer.pdf
du -h /usr/lib/pd-l2ork/extra/Gem/Gem*
du -h /usr/lib/pd-l2ork/extra/Gem/Gem*
4.0K /usr/lib/pd-l2ork/extra/Gem/Gem.la
4.0K /usr/lib/pd-l2ork/extra/Gem/Gem-meta.pd
5.6M /usr/lib/pd-l2ork/extra/Gem/Gem.pd_linux
568K /usr/lib/pd-l2ork/extra/Gem/GemPrimer.pdf
How to „read out“ time values after a bang got triggered? How to define „time windows“ in ms?
Hi there!
I’m quite new to pd but getting more and more into it as I’m trying to build a simple game/app, where users must trigger sound-samples in a certain order and (most notably) at certain points in time. The samples are triggered with bangs and since I edited them by myself, I know the exact length of every sample.
Now let us assume we have 4 samples, each of them with a length of 1200ms and each sample has its own bang to trigger it. These bangs get their input from „buttons“ which the user can hit via a graphical user interface (I built this GUI with MOBMUPLAT, a GUI-editor which interacts with Pd patches). If the bangs are triggered with exact timing, the 4 samples will add up to a musical sequence.
The first bang starts sample1 - after 1200ms the second bang (= button on the interface) shall be hit to start sample2 and so on.. it’s obvious that the user will not hit the buttons on the interface with an accuracy of single milliseconds, so here are my questions for the pd patch:
-
How can I „read out“ certain points in time, after a bang got triggered? e.g. after the first bang was hit, how much time (in ms) has passed until the second bang got hit? And can I „store“ and „recall“ these values in any way?
-
Is it possible to define a kind of „time window“ in ms? e.g. after the first bang was hit, the second bang has to be hit within 1150-1250ms to trigger something, or else (if the second is triggered too soon/late) nothing will happen..
Hope this explanation of my problem is not too complicated. Any help would be much appreciated!
Novation Launch controller abstraction, with LED feedback for the buttons.
Heeeeelllloooo PD users
Here is my first contribution to the community library. This is a midi controller abstraction for the
Novation Launch Controller. The first 4 pages on the Launch Controller are assigned to midi cc and gives you full feedback over the LED's See further description in patch.
Patch with abstractions for each of the first 4 pages:
Launch Controller .pd
I have also included the 4 Launch Controller set up for the 4 pages to get you started.
PD user page 1.syx
PD user page 2.syx
PD user page 3.syx
PD user page 4.syx
These have been updated, the first version I put was not really working. I was a bit too quick posting
it out of Pure excitement
Have fun!
Jaffa
Load Libraries, plug-ins
@Balwyn I've follow your steps but still nothing this is what i got in the console:
'pd-gui' connecting to 'pd' on localhost 5400 ...
------------------ done with main ----------------------
Default font: DejaVu Sans Mono
tried ./Gem.m_i386 and failed
tried ./Gem.dll and failed
tried ./Gem/Gem.m_i386 and failed
tried ./Gem/Gem.dll and failed
tried ./Gem.pd and failed
tried ./Gem.pat and failed
tried ./Gem/Gem.pd and failed
tried C:/Users/Jose/pd-externals/Gem.m_i386 and failed
tried C:/Users/Jose/pd-externals/Gem.dll and failed
tried C:/Users/Jose/pd-externals/Gem/Gem.m_i386 and failed
tried C:/Users/Jose/pd-externals/Gem/Gem.dll and succeeded
C:\Users\Jose\pd-externals\Gem\Gem.dll: couldn't load
tried C:/Users/Jose/pd-externals/Gem.pd and failed
tried C:/Users/Jose/pd-externals/Gem.pat and failed
tried C:/Users/Jose/pd-externals/Gem/Gem.pd and failed
tried C:/Users/Jose/pd-externals/Gem/Gem.m_i386 and failed
tried C:/Users/Jose/pd-externals/Gem/Gem.dll and succeeded
C:\Users\Jose\pd-externals\Gem\Gem.dll: couldn't load
tried C:/Users/Jose/pd-externals/Gem/Gem.pd and failed
tried C:/Users/Jose/pd-externals/Gem/Gem.pat and failed
tried C:/Users/Jose/pd-externals/Gem/Gem/Gem.pd and failed
Gem: can't load library
Loading plugin: C:/Program Files (x86)/Pd/tcl/pd_deken.tcl
The Pd window filtered 26 lines
The Pd window filtered 27 lines
Newb can't use GEM
Hi, thought I'd post here even thought the thread is old before starting a new topic because my problem is exactly that as described here, though none of the suggestions have help and no one seems to have my exact error console output, which is as follows:
WARNING: Font family 'Courier' not found, using default (DejaVu Sans Mono)
tried ./gem.l_i386 and failed
tried /usr/lib/pd/extra/Gem/gem.l_i386 and failed
tried /usr/lib/puredata/extra/gem.l_i386 and failed
tried /home/digithree/pd-externals/gem.l_i386 and failed
tried /usr/local/lib/pd-externals/gem.l_i386 and failed
tried /usr/lib/puredata/extra/gem.l_i386 and failed
tried /usr/lib/pd/extra/gem.l_i386 and failed
tried ./gem.pd_linux and failed
tried /usr/lib/pd/extra/Gem/gem.pd_linux and failed
tried /usr/lib/puredata/extra/gem.pd_linux and failed
tried /home/digithree/pd-externals/gem.pd_linux and failed
tried /usr/local/lib/pd-externals/gem.pd_linux and failed
tried /usr/lib/puredata/extra/gem.pd_linux and failed
tried /usr/lib/pd/extra/gem.pd_linux and failed
tried ./gem/gem.l_i386 and failed
tried /usr/lib/pd/extra/Gem/gem/gem.l_i386 and failed
tried /usr/lib/puredata/extra/gem/gem.l_i386 and failed
tried /home/digithree/pd-externals/gem/gem.l_i386 and failed
tried /usr/local/lib/pd-externals/gem/gem.l_i386 and failed
tried /usr/lib/puredata/extra/gem/gem.l_i386 and failed
tried /usr/lib/pd/extra/gem/gem.l_i386 and failed
tried ./gem/gem.pd_linux and failed
tried /usr/lib/pd/extra/Gem/gem/gem.pd_linux and failed
tried /usr/lib/puredata/extra/gem/gem.pd_linux and failed
tried /home/digithree/pd-externals/gem/gem.pd_linux and failed
tried /usr/local/lib/pd-externals/gem/gem.pd_linux and failed
tried /usr/lib/puredata/extra/gem/gem.pd_linux and failed
tried /usr/lib/pd/extra/gem/gem.pd_linux and failed
gem: can't load library
input channels = 2, output channels = 2
audio buffer set to 25
opened input device name hw:0
configuring sound input...
Sample width set to 2 bytes
configuring sound output...
Sample width set to 2 bytes
tried but couldn't sync A/D/A
So I've added the word "gem" (with no quotes) to the Startup list, and the external library locations (whose paths can be seen in the above output) yet it doesn't work.
Any ideas? I've verified that both pd and gem are installed and at the lastest version. I'm using Ubuntu 11.10
Thanks
Phasor~ as index to tabread~ with del and line~ envelope glitch
Hey
I'm using phasor for an index to a tabread~ to play a sample.
I'm also using line~ as an envelope to control audio output.
The timing for the envelope is set by the size of the sample size and samplerate~ as well as the frequency for the phasor~.
The magnitude of the phasor is adjusted to the sample size.
The sample player can be re-triggered and when this happens a line~ is set to go to 0 in 5ms,
a delay is set for 5ms,
then bangs another line~ to go to velocity in 0,
as well as setting phasor~ frequency to 1/t and phase to zero.
At which time another delay is setup at samplelength in ms.
After the sample is played the phasor~ frequency is set to 0 then
another line~ to 0 in 5ms is sent to the [*~] .
This causes a glitch when the sample is retriggered because the phasor~ is reset to zero and starts replaying the sample.
This glitch can not be heard when the sample is not re-triggered so maybe it's a control vs signal timing issue.
I did hear the glitch at the end of the sample re-triggered or not using vline~.
So my question is how do you do audio rate envelope triggering of envelopes ? I would post the patch but it is a mess. A good answer or pointer to some reference material would be greatly appreciated. I haven't quite wrapped my head around the sample and hold sampler examples yet.