...that deal with pure data
You are not logged in.
I'm kind of new to Pd, but have some experience with Max. Actually I did a DJ-patch in Max a couple of years ago. I have uploaded this so you can see what I want to do. See the two files staring with MUS2840.
I have searched the forum and gotten a little smarter, but I haven't really found the answer I'm looking for.
I need a (two) player that can handle long files. I want to be able to controll speed and use cue-points. I have tried to use a simple player with tabplay~ og tabread4~, but can't seem to load the whole file into the array/table.
I did also try mp3play~, but couldn't try any of my mp3's since, they were all "layer 2"? Strange! It's just regular mp3's imported from CD's into iTunes.
I have tried sfplay~, but as I have figured out from this forum, I won't be able to change speed. ?
I have tried readanysf~, but it just led me to a bunch of things I needed to install and I didn't understand a thing.
If this for some reason can't be done with Pd, I'm thinking about using Jack or Soundflower in some kind of way. The whole point is to be able to use my own hardware interface (with Arduino) to control some kind of DJ-program, and I want it to be free.
Maybe the info in this post will help:
http://puredata.hurleur.com/sujet-4301- … udio-files
Yes. It kind of helped, but I still don't understand exactly how to write the code. I've tried putting in "samplesize 158760000", "-samplesize 158760000" and "-maxsize" in everywhere but nothing happens. I'm using a *.aiff-file. Maybe that's what's wrong. ?
And I'm not sure how to write the code for setting the samplesize automaticaly when I upload a new song.
I also see another problem coming: Every song will have a different playing speed. Am I right?? This will be a problem when I want to adjust the playing speed (for scratching and for small speed-variations). If someone has a solution for this, please write it down here. What I need is a way to change the output range of the hslider.
I'm using a patch I have copyed from a youtube-video (http://www.youtube.com/user/cheetomoske … oX0v54SqtU) to try things out (uploaded).
And one more question: Can I use tabplay~ instead of tabread4~ and still set the samplesize in the way you hopefully will tell me to?
You need to set the size of the table independent of [soundfiler], so no samplesize or maxsize arguments are involved. Aiff files should work fine.
See the attached patch.
You can use either [tabplay~] or [tabread4~], the trick is getting the large files loaded into a table - then you can play them with either object. However, if you want to alter the speed of your audio files you will need to use [tabread4~].
To change the output range on a GUI object, simply right-click (or ctl-click) on the object and choose "properties".
Thank you once again!
This helped a lot, but unveiled more questions: Is there a way to make the table resize automatically when I load a new track? I tried naming the number-box from the output of soundfiler "Duration" and put "resize Duration" where you resize the table, but it did nothing. I also tried naming the send-symbol of the number-box.
And on to the other problem:
What I want to do is change the output range of the hslider automatically when I load a new song, not through the properties like you describe. Or more general: Can I change the properties through boxes in the programming enviroment (outside the properties-menu)?
1. The example patch I posted above already resizes the patch after it's been loaded - using the output of [soundfiler]. The $1 in the resize message acts as a variable and is replaced by the first argument sent to that message, in this case the number of samples as output from soundfiler.
I think you are just confused on how to use variables. Naming the number box does nothing but display a name in the GUI. Send-symbol will automatically send the value of the number box to a receive object of the same name.
Check out the dollarsign and send/receive related patches in 2.control.examples (in the help browser).
2. To set the output range of an hslider with receive-symbol "my_slider" to between 50 and 75, use the following message:
[; my_slider range 50 75;(
It's been some time since I got the time to look at this now, but finaly I got around to it.
The files loads just fine, but the table is missing the last bit. It's the right size, but the waveform are just cut right off at about 15% from the end. This is no biggie, but its strange!
Thanks for the "2.". It's a great start, but is it possible to use $1 and $2 instead of 50 and 75? I managed to controll the $1, but got "error: $2: argument number out of range" on $2 when I just used two number-boxes into the message-box.
I'm sure there will be more questions later. I'm going to look at how to pause (and set que-points in) the playback now.
You need to wait for the table to finish resizing before loading the file in. I think you can do this with multiple messages in a message box seperated by a semicolon. Each message will be executed in order, waiting for the previous message to be completed before moving on.
[; resize message goes here; load message goes here (
The load message could also just be something that triggers the load part of your patch.
In regards to your second point, you have to send both messages at the same time as a list. The attached patch demonstrates how to do this with either a single message or with separate min / max number boxes.
I don't know exactly what you mean, but I tried to put the resize before the read between loadpanel and soundfiler, but I just got an error-message. And I don't use any load-message, so I'm not sure how to use the info you gave me. I added the patch this time, so you can see what I have done.
The resizing of the sliders works perfect!! :)
Now, there's two things I need to accomplish:
1. Is it possible to play the array on from a different sample than the first one? How? (I need this to be able to use cue-points).
2. Is it possible to use the outpout from a slider only when it is in use? Like when I use the scratching and stop it, the patch will detect that the slider is no longer in constant use (after it hasn't been changed for some short time) and the tempo will be controlled by something else (that is constand)? I just remembered the change-object from Max and maybe I can use it (if it works the same in PD) with some sort of gate (spigot or something)? I'll look at that next time, but if someone could tell me something about this, please do!
Not sure what to search for, so I asked. Sorry if there is other threads on these things.
EDIT: All references to [phasor~] in this post and the attached patch should actually be [vline~]. Oops.
To start playing from a sample besides the first one just start the [phasor~] at a number higher than 0. The number you input into [phasor~] cooresponds with the sample number being played. See the attached patch (the phasor~ and tabread4~ objects are just to demonstrate where they would go in the chain).
To load after the table has been resized, just add the following to the end of your resize message box:
Then create a [r load_now] object that feeds into [pd load] (or the [o] above it).
In regards to your 2nd question...
You can feed the scratch slider(s) into the [line] object in the attached patch. This will interrupt existing playback whenever you start scratching. In order to have playback continue after you stop you will need to store the current sample number and then use a combination of [delay] [==] and/or [metro] in order to check if the current sample has changed in a given amount of time (and if not, to send a new playback message through the attached patch with the current sample and end sample as arguments).
Last edited by pd123 (2010-10-28 22:19:32)
At first I was gonna write: "Strange. The only thing going into phasor~ in my patch is a number representing the speed (it's about 0,002 with the song I'm using as test-song). I don't see how that fits with what you're telling me. ??" and not try it out. But I didn't want to ask about things if I didn't have to.
I tried it out, and discovered that I was right: The number that goes into phasor~ controlls the speed. In other words: When I put a line going from 30000 to 500000 into it, all I heard was noise because the song played really(!!) fast in a loop. This also reflected in the time-bar below the waveform.
Is there something I have overlooked or misunderstood??
Anyway, if it is and I can use this: I need the start and stop to be flexible, so I can set it along the way. I messed around with this a bit, using $ (from the slider_resize.pd) and pack/unpack and stuff, but nothing worked.
The resize-tip gave me nothing new, but thank you anyway. :)
Ah, I see where I misunderstood. I never use [phasor~] for playback, always [vline~].
Using [vline~], you send it a message [a, b c ( where a = starting sample, b = ending sample, c = time in ms to take to get there.
Sorry, that was a silly mistake. I should've tested it first.
The resizing and loading works for me as described above.
Hey, I just wanted to pop in and say "Thanks" to pd123 because the information in this thread and especially the sample large-file loader have been really helpful to me. I'm working on my own DJ'ing patch which I'll be releasing soon. I'd worked out most of the problems, but now it'll also be long-song enabled, which is really cool. So, thanks!
After a few months away from my DIY-projects, due to wirting my masters thesis, I'm now back on track.
I didn't see your correction about the phasor~/vline~ before now, so my last post is kind of not relevant.
I will start a new thread about my project soon. I've gotten some new info and seen a working DJ-patch which has given me new thouughts and questions. Hope to see you there. :)
And thank you once again. You've all been great help!!