I'm quite new to PD so I'll try to explain this the best I can, hope you'll understand what I mean! I need this for a project, but I feel like it's too complicated for a beginner like me to understand without proper guidance, and I haven't found a tutorial that deals with something like this yet. Please, if you can't help me, maybe you could direct me to a tutorial that deals with the things I need to understand to get this done. Please, you'd help a lot!
So, here it is. Basically, say you type in a set of numbers into a program (Word, for example) and you want to use those numbers to start up certain audio files (via PD) subsequently and then loop the whole thing. Each number corresponds to one audio file, but the files don't play until you hit enter, which is when all the files corresponding to the numbers you typed in should play, in the order in which you typed in the corresponding numbers. Basically, it's supposed to be a melody that sounds differently depending on what numbers/sets of numbers (2, 3 or 4 digit combinations) you typed in before you hit enter, which should work as a "bang" of sorts for the audio files.
Do I even need an external program for this (I'm assuming I do), or could I just be typing numbers with a PD project open and it would still work when I hit enter? If I need another program, how do I connect PD to it and make it play the files based on the numbers I typed in?
Please, if you could offer any advice or direct me to an appropriate tutorial, I would very much appreciate it! I'm very new to this and kind of lost, not sure how to put this idea into words, but I hope you got the gist of it. I realize this might be very complicated for a beginner, but any kind of help is welcome! Thank you very much in advance!
-
Playing sound files based on numbers/sets of numbers?
-
@Alexita Hello Alexita. Is this something you must do yourself (you will be assessed)?
Maybe we should not just give you a ready-made patch? although that is quite a good way to learn.
I have just made the patch for you. It took about 10 minutes, and will work in vanilla or extended (for extended you would need to add the [readsf~] object.... ((big clue!))).
Is the next stage of your project "playing backwards" or "changing pitch" etc. as that will change the way that should be used for playing the tracks?
Are you using Pd extended or Pd Vanilla for your project?
I / we could drip you little bits at a time, and then help you build an "abstraction" version (as @LiamG suggested) at the end.
David. -
@Alexita Ok..... as a beginner you have probably suffered, and learnt quite a lot in the last day.
Here you go.... 5 tracks with loop.zip
It will play up to 5 tracks and loop the sequence.
You should be able to work out how to increase the number of tracks if you need to.
David. -
Added auto on for DSP audio processing...... just in case.........5 tracks with loop.zip
@Alexita You can right click the object boxes to get help!
David -
hello
i am student in italy. i have very very easy project with "Pure Data" but i can't and i dont know anything abuot that. there is someone for helping me????thanks a lot
-
Hi A10A
please make a new thread and ask your question (including specs about your project) there. Only then people can know whether and how to help you. and also this thread is left for its original topic.
toi toi toi
johnny -
@whale-av Hello, first I just want to say thank you very much for your help and sorry for not replying sooner, I read all the messages, I just didn't want to bother people before I had an actual issue or a question that I understood enough to know how to ask what to do next. So that's why I'm only replying now. And you're totally right, I have suffered and learned in the past day so my brain's kind of all over the place right now, I'm still struggling to get the hang of this and really understand the patches you sent me (thank you so much for taking the time to make them for me!).
To answer your questions, I will not be assessed for this part of the project, it doesn't matter much how I do it as long as it works because no one will look at the project anyway, the end result is what matters in this case. The only "limitation" is that it has to be done in Pd. Also, my version of Pd is Vanilla (I'm assuming that doesn't change your patch much since you said it'd work in that version), and actually no, there's not really a next stage to this project; all I'm supposed to do is get my sound files to play in a loop when I press Enter (after I've typed all my numbers) and to be able to stop the loop again with Enter. I probably should have mentioned that oops, does that mean I need another keyup object or would the one in the patch work for both starting and stopping the sound?
I actually had a patch of my own but it was very simple and mostly improvised based on what I managed to learn (like I said, completely new to this) and nothing like yours so it probably wouldn't have worked anyway... Is it ok if I use your patch as a starting point? If it is, I'm assuming the next step would be the abstractions. From what I understand, abstractions are used for referencing and reusing old patches in order to keep the new patch clean and not messy. I do need something like that, as I have 17 wav files ready to use. But not all 17 should be used in one loop. I actually only need 5 sound files per loop (like in your patch), but the total number of files I can choose from is 17. To be able to tell the program which file to play based on its corresponding number I probably need the select object, right? Would I need it within the calling patch or the patch being called, a.k.a. abstraction (if my thinking is right, it's probably the calling patch)? There's probably an easier way to do this than an x number of select objects but I'm just not familiar enough with the program, sorry... Also, what difference does it make if it's not 1-digit numbers, but 2-digit, 3-digit and 4-digit combinations? To be more precise, the first, second and fourth sound file should correspond to a 2-digit number, the third to a 3-digit number, and the fifth to a 4-digit number (and I can't change this unfortunately, it's part of the task).
Oh, and is there a way I can make this work on any computer, for example if I copy my files onto a flash drive? Or if I can't, would it drastically affect my main patch if I changed the sound file destinations later, once I know what computer is going to be doing all this? Would I need to change the file destinations in all the patches or would it be possible to do so automatically via abstractions, by changing them in the main patch only (probably not but eh I asked...)?
This is all probably waaay too advanced for a beginner (and I have no idea why they'd give me this task without any prior preparation.......) so I realize I might be asking for too much here, and maybe I'm getting ahead of myself, but I still hope you could give some advice on what to do from here, what's the next step, the elements I need to get this done etc. I'm not in too much hurry, I have time until the 5th of February, so it's ok if you don't have the time for me right now, I can wait a bit!
Thank you so so so much, even just sending me the first patch was such a huge help, thank you! And I hope you can guide me through this for a bit longer! -
@Alexita Hello again. You don't absolutely need abstractions, but they make the building of the patch much quicker (a lot less typing). Putting 2 or 3 digit numbers is more difficult.... I will think about that. Stopping with a second enter will be possible.
The patch is already able to play only a selection of the 17 tracks...... although they must all "exist".
If the tracks are in the same folder as the patch the paths are not necessary, so it becomes much more portable.
But portable on a flash drive means putting Pd on the flash drive as well (in a portable format), and the tracks as well........ so a big enough flash drive. I am assuming that the computer the flash drive will be plugged into will not have Pd already installed. Will it always be a PC? or a Mac? or Linux? Or will it have some flavour of Pd installed already? That would be useful.It will be much easier to build with abstractions if the tracks are named 1.wav, 2.wav, 3........ 17.wav.
What are the two, three and four digit numbers? How do they choose between the 17 files? 1-17 is easily understandable. Can you post a "table" of what they should be........ like?
1 - 33
2 - 41
3 - 123
4 - 18
5 - 6072
or is there supposed to be some sort of a random function...... where you are not really selecting at all? The task makes no sense to me with this requirement (at the moment). You would need to remember the 17 large numbers!I will post an abstraction version, assuming all of the tracks in the same folder. A "sub" folder is easy as well (for the tracks).
............................ 17 tracks with loop abstractions.zip ...... now in "loop" mode already when it starts.
I have added metering, just for fun.
You must put 17 tracks named 1.wav ... 17.wav in the same folder.
The keyboard numbers 1 - 9 will work (for the moment, and for the first 9 tracks)
David.
PS..... looking for a pattern...... anyone?
Assuming...... only keys 1-9 or 0-9 used.
Of course! It's easy......... if 0 is not allowed
2 digits..... minimum total 2 max 18........ range 17
3 digits......minimum total 3 max 27........ divide by 1.5 and subtract (about) 1........ range 17
4 digits......minimum total 4 max 36........ divide by 2 and subtract (about) 1........ range 17
Need to round up or down..... look at results.....
For now.... 17 tracks loop enter start stop.zip starts and stops (stops tracks dead.... should the sequence complete?) with enter.
David. -
@Alexita Maybe........ Maybe final 2.zip
David. -
@whale-av Hello again, thank you very much for replying so quickly!
Ok so, the computer will always be a PC and will always have Pd installed so that makes things a lot easier I suppose (not sure what version it will be though, but since all those computers have only recently been equipped with Pd I'm assuming it's either vanilla or extended so it should be ok).
I just put my 17 sound files in the same folder and named them 1.wav ...... 17.wav. They are in the same folder as your patch now too.
Well, the numbers are not exactly "set", in fact, each sound file corresponds to a certain range of numbers. Ugh, I did it again, forgot to mention the range... Sorry..... I'd probably need a different object for a range... It's still kinda difficult for me to think in "computer" language about things related to music so that's why I'm forgetting to mention tons of stuff, but I'll try to fix that in this reply, sorry again!
I will just post the table to make it easier for you to understand.But first, I would just like to explain how the table works. First I need to ask if it's possible to attribute the same numbers/range to different sound files, depending on the number's "place" within the combination? (You'll understand once you see the table.) Maybe it isn't and in that case I should think of a way to change the table according to what can be done?
So, there should be 13 numbers in total within the combination (13 numbers to type, like 13 empty slots waiting to be filled with numbers), but I said there are five sub-combinations. The first, second and fourth are 2 digit numbers, the third is a 3 digit number and the fifth is a 4 digit number. Obviously, three of these are 2 digit numbers, but the thing is I can't really choose the ranges (I have a set range for each sub-combination and can only try to figure out the easiest way to work with them) and the ranges are actually intertwined, So some numbers can be repeated, that's why I'm asking if the same numbers can be attributed to different sound files based on whether it's the first, second or fourth sub-combination. If that's too complicated or even impossible, I can only think of sacrificing a couple of sound files and just let the program play the same file twice instead.Also important: is it possible to "condition" to program into playing a sound file based on the first combination, the first 2 digit number? Simply put through simple chords, say in the first combination you can type either 01 or 02, where 01 is A major and 02 is B major. Next, you can type in either 02 or 03, where 03 is E major (irrelevant right now), but 02 can be either D major or F sharp major (not A major like in the first combination), based on what the previous number was. If it was 01 (A major), then this time 02 will be D major, but if the first number was 02 (B major) then the 02 in the second combination should be F sharp major. IS something like this even possible, or do I need to figure out a way to go around this and alter my table? I CAN alter the table, but I can't work with the ranges of the combinations, or the number of the combinations, it must be 5.
Lastly, can different numbers be attributed to the same sound file based on their position within the combination?Ok so finally here's the table, and I will just give you my current table so you can tell me if it's possible to do. I understand if it's too complicated and I need to change it! Maybe you can give me some tips on how to change it to make it the easiest to do in Pd.
1st SUB-COMBINATION
01-19 - 1.wav
20-22 - 2.wav
23-31 - 3.wav
2nd SUB-COMB.
01-03 - 4.wav (if the first was 01-19 or 20-22; or shorter, 01-22)
01-03 - 5.wav (if the first was 23-31)
04-06 - 6.wav
07-09 - 7.wav (if the first was 01-19)
07-09 - 8.wav (if the first was 20-31)
10-12 - 9.wav (if the first was 01-19)
10-12 - 10.wav (if the first was 20-22)
10-22 - 11.wav (if the first was 23-31)
3rd SUB-COMB.
900-975 - 4.wav (if the first was 01-19)
900-975 - 2.wav (if the first was 20-22)
900-975 - 12.wav (if the first was 23-31)
976-999 and 000-020 - 1.wav (if the first was 10-22)
976-999 and 000-020 - 13.wav (if the first was 23-31)
4th SUB-COMB.
01-09 - 7.wav (if the first was 01-19)
01-09 - 8.wav (if the first was 20-31)
10-69 - 14.wav (if the first was 01-19)
10-69 - 3.wav (if the first was 20-31)
70-99 - 6.wav (if the first was 01-22)
70-99 - 11.wav (if the first was 23-31)
5th SUB-COMB.
(this one is arbitrary so no matter what the last 4 numbers are, the sound file that is triggered should be based on the first combination, or something like that, so...)
xxxx - 15.wav (if the first was 01-19)
xxxx - 16.wav (if the first was 20-22)
xxxx - 17.wav (if the first was 23-31)Now, I need to thank you if you had the patience to actually read all that and think about it..... I can only hope you could understand the idea, but please, if this is just too complicated, do tell me to change the table. Maybe, if you can or think I will understand, try to explain how the ranges work when playing sound files and how I can use that to my advantage to still keep all the sound files (or as many as possible) but make the thing easier to program.
Now I know I had a few more questions but I can't remember right now and I don't want to bombard you with everything all at once, I realize even this is way more than I could have asked for, you have been a huge help, really! Even if I don't entirely understand every single element of your patches, I did study them and used the help option like you advised me to, so I really am trying to get the hang of this. I completely understand if you just want to take a break from this if it's too complicated and time-consuming, I just ask that you give me some kind of feedback so I know what to expect!
Anyway, thank you for all your help and guidance until now, and for the guidance you'll provide in the future if you so choose!
-
@Alexita Time for bed where I live..... sorry. I will chew on that table. Anything (almost) is possible in Pd. I might not have time in the next few days, but I enjoy a challenge and I will come back to it. Someone else might build it for you first!
In the meanwhile try my patch (Maybe Final 2.zip.... see above) with it's audio files in a folder on a usb key..... in other computers as well if possible. Typing in the string of 13 digits (or more...... any "extras" will be ignored) should always play 5 tracks. Check that thoroughly, and understand as much as you can. The number sorting is done in the sub-patch [pd calc] that you can open (right-click again). As you start to understand that bit you might even be able to build your table logic yourself!
David. -
@whale-av Ok, thank you so much again, I'll keep learning and hopefully I'll be able to build the table by the time I hear from you again! If I do, I'll be sure to let you know, and I'll definitely try this on another computer tomorrow, since it's also time for me to go to bed. I'll see you soon!
-
@Alexita Here are some clues. The separate numbers coming in need to be "joined" so 1 followed by 9 becomes nineteen...... and then you need to do one thing if the number is between 10? and 19? and something else if not (for example)...........
calcs.zip
For three digit sequence use [* 100] and [* 10] ......etc.
To test for just one number you can use [sel] but for more complex decisions [expr] is very powerful.You need to remember that the numbers entered later are going to be "actioned" first. That is why, in the bigger patch..... [pd calc] I had to store all the numbers in [f ] objects and then send them in the correct order with a [t b b b b b b ] "trigger".
http://puredata.info/docs/manuals/pd/x2.htm Chapter 2.3.......... probably the most important reading for correct use of Pd (and the most common cause of errors in a patch).... "order of operations".
David.