wav sample player
Hello friends,
I was trying to make a virtual instrument patch playable via midi and that uses wav samples of each note of a real instrument.
Normally each sample would be called C1.wav C#1.wav D1.wav and so on, I've made a patch to transform from midi note number to note file name so it could fit into a message going to soundfiler like "read -resize $1 array1" where $1 is the name of the corresponding wav file.
It seems to be working, with the only flaw that it doesn't sound as immidiate, I think loading the file in the moment of the note being pressed creates a delay.
As workaround I was wondering if there was a more efficient way of managing the samples?
As I'm writing I've just thought I could load a really long array that stores all the notes wav files in consecutive order, and then just use math to play the segment that corresponds to the note. Would that imply it'll be monophonic though?
A last resort would be copying and paste the single voice with the soundfiler 36 times, one for each sample, and have them preload on start. But I'm sure there's a more elegant solution!
Thank you in advance, I feel both blessed and damned now that I've put myself into this puredata rabbithole
A
1p24p(sin): one midi ctrlin used to control 4 parameters via sine curves of different frequency
This is a real world example:
1p24p(sin)-example(amsynth).pd
1p24p(sin)-help.pd
1p24p(sin).pd
Controlling amsynth with an 8 knob usb midi controller
Aligning the midi map to the patch or sending in your current midi map to the patch, you can control the (primary) 8 sections of amsynth with a (standard) 8 knob usb midi controller. (I've added a few sliders to control some of the params that don't "fit").
The jack connections need to look like the below.
And
the patch works out to:
1p24p(sin): one midi ctrlin used to control 4 parameters via sine curves of different frequency
The abs synchronizes one line and three sine curves using the controlling knob/cc's values (between 0 and 127), i.e. the input, as their angle and their frequency dependent on which sine curve (2^n). Thus, it captures all combinations, just with fewer possible values depending on which sine curve is assigned to which outlet.
1p24p(sin).pd
1p24p(sin)-help.pd
adsr.pd
It takes 5 creation arguments:
$1 the identifying index for the abstraction
and
$2,$3,$4,$5 to determine which outlet receives which frequency/input. So, if used, for instance, with an adsr then [1p24p(sin) 1 0 1 2 3] then "a" would have 127 possible values, d 64, s 32, and r 16. Where as, in the case of ]1p24p(sin) 1 3 2 1 0] r would have 127, s 64, d 32, and a 16.
While it does limit the possible values for the controls/parameters to [127,64,32,16] (respectively) it offers a Lot of flexibity (as the -help file shows) and is very easy to understand.
So basically, for example, in a given synth setup using the abs as input and only 2 knobs/cc you control 16,129 (127^2) adsr presets.
The state chart is as follows (where๐บ๐ปrepresents a value going either up or down, and each arrow represents a set of 16 possible values).
parameter:
0 1 2 3
๐บ๐บ๐บ๐บ
๐บ๐บ๐บ๐ป
๐บ๐บ๐ป๐บ
๐บ๐บ๐ป๐ป
๐บ๐ป๐บ๐บ
๐บ๐ป๐บ๐ป
๐บ๐ป๐ป๐บ
๐บ๐ป๐ป๐ป.
I hope this is easy to understand and that it might "serve(s) you well".
Love through Music,
-S
Let me know if you need help with this. I will (power allowing:-)) be happy to oblige.
p.s. the help files offers a lot of information and two examples (the classicsynth-help and 4 arrays to visually show what's happening).
Synthesis Pack 2 - Collection of advanced synthesis methods.
@beem PWM (Pulse-Width-Modulation) for the square/pulse wave. It affects the duty cycle of the wave. You can also make a shifting wave where you can smoothly transition from one shape type to another but this is a far more complex non-standard wave. I use only basic standard waves. It is also possible to combine this standard waves to have something more complex..
Sequential playback of different sound files (Starting sound after a previous sound is finished)
For example I have five different sounds: sound1.wav, sound2.wav, sound3.wav, sound4.wav, sound5.wav.
I want to play sound2.wav after sound1.wav has finished playing. The same for the following sounds.
How to do this in pd?
[writesf~] problem
A couple of illustrations.
Let's say we want a sine wave covering 16.5 samples. To illustrate, I used SuperCollider to put two sine wave cycles into 33 samples.
The second cycle begins when the wave crosses the 0 line in the middle.
This is between samples.
So, the second cycle must be represented by sample values that are different from the sample values for the first cycle.
That is, it is possible to have that zero crossing between samples -- but the sampling process produces different values.
Let's look at it a different way: blue samples = one sine wave cycle covering 33 samples; green samples = 2 cycles in 33 samples.
If we start counting samples at 0:
- Blue 0 = Green 0.
- Blue 2 = Green 1.
- Blue 4 = Green 2. etc.
That is: read through the blue samples at double speed, and you get the 16.5 wavelength. (This is exactly what David said.)
What about the second cycle starting at 16.5?
- Blue 1 = Green 17.
- Blue 3 = Green 18. etc.
These are the sample values that were skipped the first time.
So, Green 17 (the first concrete sample value after the second cycle begins) is the value in between Green 0 and Green 1. Green 18 is in between Green 1 and Green 2.
This is interpolation.
Interpolation is the mathematically correct way to represent fractional cycles in a sampled signal.
You can try to say that this "isn't the real problem," but... this is the problem, and interpolation is the solution.
hjh
play random file from folder
Hi there,
I have two quesitons:
I want to upload a ton of .wav files into a folder and play them randomly. What is the best way to proceed?
So far I called them 1.wav, 2.wav, 3.wav, I create a random number and call the file $.wav ... but this can become exhausting, and more than that, see question 2
I wanted in question 1 to be able to play a file with a random name (e.g. "random guy from puredata forum yelling.wav") and having the name of that track printed. So far I was thinking of using names of approach 1, and have a stored .txt file with the "real name" of the track and have it printed, but i can't neither do this.
Thanks in advance for your support
Nando
Help with [key]/[keyup] inside [clone]
@4ZZ4 Sorry about the [t b f] and [notein].... it was a rush job.
[route float list symbol] is a bit special.
If you send [34 12( into [route 34 12] you will get a bang on the left outlet for 34 and one on the middle outlet for 12.
If you send it into [route float list] you will get 34 followed by 12 on the first outlet and 34 12 on the middle.
If you send [woof 23( into [route woof] you will get 23 on the left outlet.
If you send [woof 23( into [route symbol float] you will get woof on the left and 23 on the middle.
I think that is all correct. You can check it out in the [route] help file.
There is weird stuff going on that can be a pain and can be useful. Some of it is really weird.
But essentially [route] strips the tag of the atom with [route symbol list float] and sends on the atom but [route woof lala] or [route 34 35 36] strips that part and sends on what follows.
woof in the actual message is actually "symbol woof" in the internal message
34 35 36 is actually "list 34 35 36"
and 23 is actually "float 23" in the internal message.
The internal message is "tag something something something....... something]..... and float, symbol, pointer and list are the common tags.
http://puredata.info/docs/manuals/pd/x2.htm is good bedtime reading..... but don't worry about chapter 2.9 for a while.
David.
peak detection on LFO signals
Thanks for the responses.
Although I've messed with pd a bit in the past, I'm just picking it back up now with an actual concept of what I want to do. I did try the rzero object (real zero, FIR filter) and as you can imagine, the sample to sample difference of a 10 Hz sine wave is exceedingly small and when multiplied by 100000 or so, looks like we might be exploring some sort of quantization limit because "theoretically" I would expect that to be smooth, with a sine wave input. However, it is very spiky.
My LFO is built by summing two sine waves of (different) variable frequency and so, actually I don't know ahead of time when they will switch direction but I'll look at that vline object anyway.
I also thought about having something like two daisy-chained 5 msec delays and comparing those outputs, or subsampling the LFO some other way because I don't need audio sample resolution, I think 10-15 ms would be fine for this. I'm sure there's something obvious I haven't stumbled across yet.