PURE DATA forum~

...that deal with pure data

You are not logged in.

#1 2010-07-05 22:32:57

YodAmygdala
Member

Questions about a patch for DJing

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.

Thank you!


Attachments:
Attachment Icon Eksamen.zip, Size: 24,865 bytes, Downloads: 70

Offline

 

#2 2010-07-06 19:25:15

pd123
Member

Re: Questions about a patch for DJing

Maybe the info in this post will help:

http://puredata.hurleur.com/sujet-4301- … udio-files

Offline

 

#3 2010-07-06 23:25:11

YodAmygdala
Member

Re: Questions about a patch for DJing

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?

Thank you!


Attachments:
Attachment Icon Player.pd, Size: 2,685 bytes, Downloads: 72

Offline

 

#4 2010-07-07 00:05:54

pd123
Member

Re: Questions about a patch for DJing

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".


Attachments:
Attachment Icon load_large_audio.pd, Size: 1,374 bytes, Downloads: 238

Offline

 

#5 2010-07-07 20:06:45

YodAmygdala
Member

Re: Questions about a patch for DJing

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)?

Offline

 

#6 2010-07-07 20:54:22

pd123
Member

Re: Questions about a patch for DJing

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;(

Offline

 

#7 2010-10-05 22:02:00

YodAmygdala
Member

Re: Questions about a patch for DJing

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.

Offline

 

#8 2010-10-05 22:16:20

pd123
Member

Re: Questions about a patch for DJing

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.

Ex.

[; 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.


Attachments:
Attachment Icon slider_resize.pd, Size: 585 bytes, Downloads: 83

Offline

 

#9 2010-10-06 22:07:30

YodAmygdala
Member

Re: Questions about a patch for DJing

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.

Thank you!!


Attachments:
Attachment Icon Player3.pd, Size: 5,047 bytes, Downloads: 84

Offline

 

#10 2010-10-15 20:33:35

pd123
Member

Re: Questions about a patch for DJing

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:

Code:

load_now bang;

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)


Attachments:
Attachment Icon playfromanywhere.pd, Size: 943 bytes, Downloads: 116

Offline

 

#11 2010-10-28 22:00:23

YodAmygdala
Member

Re: Questions about a patch for DJing

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. :)

Offline

 

#12 2010-10-28 22:11:51

pd123
Member

Re: Questions about a patch for DJing

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.

Offline

 

#13 2011-03-11 07:33:33

KeithIrwin
Member

Re: Questions about a patch for DJing

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!

Offline

 

#14 2011-03-11 17:50:55

pd123
Member

Re: Questions about a patch for DJing

Thanks for the "Thanks" Keith, glad to have helped!

Offline

 

#15 2011-05-24 14:57:07

YodAmygdala
Member

Re: Questions about a patch for DJing

Hi!

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!!

Offline

 

#16 2013-10-28 02:19:34

bonehead696
Member

Re: Questions about a patch for DJing

i've tried to get my head around loading and resizing following pd123 suggestions - and can't get it to work - I obviously have things confused... basically I get the ending of any large sample left off the table, it only draws about 1/2 to 2/3rds of the file.

I have attached the patch posted by YodAmygdala with what I thought was suggested by pd123 - but have got it wrong somewhere.

any help appreciated

thanks


Attachments:
Attachment Icon Player3 (1).pd, Size: 5,102 bytes, Downloads: 20

Offline

 

#17 2013-10-29 09:50:13

Maelstorm
Administrator

Re: Questions about a patch for DJing

Anything that's larger than 2^24 samples is going to be a little off. This is because Pd uses 32-bit floats, which only have 24-bit integer precision. Since indices of tables are represented by integers in Pd, you are restricted to 24-bits of accuracy when passing them around and resizing.

You can still load larger files, but don't expect the resize to be accurate, and don't read them using [tabread~] et al., because anything over 2^24 will distort. I think [tabplay~] is the only one that won't distort while playing back (I think it uses pointer arithmetic internally).


.mmb   |   My library

Offline

 

#18 2013-10-30 10:07:22

bonehead696
Member

Re: Questions about a patch for DJing

thanks Maelstorm,

that makes it a bit more clear,

ta

Offline

 

Board footer

Powered by PunBB
Copyright 20022005 Rickard Andersson


pd.webring info