Extension for manipulating sound samples

Extending or modifying the GP system itself (advanced!)

Moderator: MSandro

Post Reply
mguzdial
Posts: 70
Joined: Sep 15th, '15, 11:21

Extension for manipulating sound samples

Post by mguzdial » Sep 28th, '15, 15:31

My extension for manipulating sound samples is working pretty well now. I'm sharing it here, and I'll upload some of my sample projects over in the other board.
samplesExtension.gp
(5.04 KiB) Downloaded 151 times
sound-samples-extension.png
sound-samples-extension.png (22.85 KiB) Viewed 3767 times
  • get samples from (some sound) returns an array of all the sound samples from some sound in the project. Each number represents (roughly) the air pressure measured at a microphone, once ever 1/22050-th of a second. The numbers go positive and negative, because there is decrease in air pressure, too.
  • make new sound named (string) from (some samples) lets you save samples you've created in the project.
  • play samples in (array) let's you play the samples from somewhere
  • mixed samples from (array) and (array) (up to four at once) will mix the samples together. Mix a C and an E and a G, and you'll get a C major chord.
  • silence for (num) seconds returns an array of silence (0) samples. Good for spacing things out.
  • spliced samples from (array) and (array) (up to four at once) will sequence one set of samples after the other.
  • scaled by (num) samples (array) will multiply each value in array by num. Over 1.0 will increase the volume. Less than 1.0 will decrease the volume.
  • sampled by step (num) from (array) -- my favorite. Returns a new array where we step through the old array as (num) increment. 1.0 is identical. 2.0 is double the frequency and half the time. 0.5 is half the frequency and double the time. -1 is perfectly reversed.
  • segment of (num) seconds from (array) (optionally, with start position). Returns a portion of an array.
Where I hope to go next: I'd to create versions of these for pixels, too. I'd like to look more deeply at J/APL. These are all just vector manipulations. I'll bet that Ken Iverson thought of even cooler ones. I'd like to build both the sample and pixel blocks on top of a generalized vector structure. Vectors and their manipulations are a pretty powerful idea.

mguzdial
Posts: 70
Joined: Sep 15th, '15, 11:21

Re: Extension for manipulating sound samples

Post by mguzdial » Oct 7th, '15, 18:31

FYI: Here's the latest version of the extension, which includes a block to set the costume from the samples, in order to see the waveform.
Attachments
samplesExtension.gp
(5.37 KiB) Downloaded 127 times

Post Reply