• Coalman

    Hi @Lacuna thanks so much for these suggestions and the links.
    Certainly, I am reading the data sheets and documentation.
    However, I had missed the forum topic you posted and I will check this github.

    I have been also using an old laptop with comport for a lot of projects in fact, comport is an old friend. I guess what I am trying to do, is get the most from these bits of technology rather than multiply them, and especially in a single project. I find myself using both raspberry pi AND arduino because I can manage the audio well on the pi (or well enough) and other stuff on arduino, but really I know the pins on the Pi can do that stuff too, so I just thought I would start to look for perspectives on how other people are doing these things.

    I am going to explore your suggestion of doing the PWM in Pd and then sending this across the pins on the Bela to control things, I think this is the sort of very direct approach I was finding myself hazy about.
    All the best,
    Jorge

    posted in I/O hardware diyread more
  • Coalman

    hello! this question intersects with Pd even if it is not about Pd specifically...
    I currently have several (installation) pieces in which the sound is run from Pd and then I have motors or sensors being run off other things.
    This means that in one case I am using a raspberry pi for the Pd part and an Arduino mega for the motor part
    In another case I have Pd running on a Bela/BBB and then an Arduino doing the motor stuff.

    The reason for this inefficiency is that my knowledge is fairly limited on these platforms. However, it is annoying to have to use the extra gear when I don't have to. Especially because I know that both the raspberry and the Bela have pins that could be used in place of the arduino for this purpose. Since the Bela is a simpler case and the pins can be addressed directly from Pure Data, I will ask about that and leave the Raspberry behind for now (as I think I would end up running Pd AND Arduino on that board anyway, whereas with Bela, one can easily address the pins from inside Pd without any other programs or libraries).

    My question is this: does anyone know how the standard mappings of pins Analog/Digital/and PWM pins on the Arduino lines up on the Bela? Does the Bela have have PWM pins like, for example pins 8,9, 10,11 on Arduino Mega or Dueminanove? And if so, what is the best way to address them from Pure Data? Basically, I'd like to convert my already very simple Arduino sketches over to Pd, so that both motors and Audio can run from the same patch.

    I know this isn't specifically a Pd issue but I have asked a related question on the Bela forum but didn't get an answer so I hoped someone might know or be able to suggest a resource over here...
    I have traversed the Bela documentation already of course....and will continue with that meanwhile.

    Jorge

    posted in I/O hardware diyread more
  • Coalman

    In one of the classic pd books (but not Kreidler, Pucketter, nor Farnell I don't think) there is a great example in which three different approaches to making granular synthesis are given using three different ways of overlapping windowing functions.

    Does anyone know where or what this book is?

    I was trying to demonstrate something related to this the other day and I remembered these examples but can't for the life of me recall where I saw them.

    posted in technical issues read more
  • Coalman

    yes, the OSC option is definitely a good one (though I wonder what a good program for this is on android...I have to check if 'control' does this...there is osculator on mac stuff but it is paid...in fact the libpd thread started just before this one (https://forum.pdpatchrepo.info/topic/13969/questions-about-using-lib-pd) is also helpful...

    I am interested not so much in grabbing sensor data and sending it to pd on a computer but rather somehow using Pd directly on a mobile platform, and getting sensor data and particular gps data directly in there. There was also a post today on the Pd Forum about webpd being rebuilt, so that could help with that (you will be able to run vanilla Pd in a browser if that happens)

    MobMuPlat grabs data from several of these sensors very well already...but you have to deal with the pd patch +java interface with that, and also the limitation of the 32-bit floating point numbers...so I am looking for other options. Especially because of the 32 bit floating point number issue as the GPS values that are interesting to me 6-7 digits long. Hopefully webpd will be 64 bit.

    posted in technical issues read more
  • Coalman

    just wondered if anyone is using this?
    https://github.com/deusanyjunior/Sensors2PD
    It seems to suggest that you can run Pd patches off of an SD card on an Android phone...not sure which wrapper or what or how it works.
    I have been using MobMuPlat but this seems like another nice way to get phone sensor data into a patch...maybe more easily even.

    I wondered about setting up libpd using the PdCore module from that without too much coding. The program above requires that but not sure if it simply requires it to be installed or if you have to configure it through scripting somehow. This and actually compiling libpd has been a roadblock for me so far as I don't know what I am doing with that and get endless errors...

    Any thoughts on this? Just curious if anyone is using it and if so how...

    posted in technical issues read more
  • Coalman

    @bocanegra
    super clear
    thanks again!
    J

    posted in technical issues read more
  • Coalman

    So, I have it that the block size is the number of samples per block and that the numbers attached to each is the value of each sample in that block.

    Then, I am looking at an FFT from which you can get a similar-looking array
    and is it that the first value will be the lowest frequency and then each subsequent value is another frequency band, with the total number of bands being the block size
    (so, if the blocks are set to 512, then there are 512 bands of analysis arranged low to high?)
    How do you find out what the center of each of these frequency bands is (I mean without a gui, from the design side)
    are each of these bands just equally divided (linear) values in hz based on the nyquist frequency or sampling rate (i.e. (44100/2)/512)
    or is there some other logic to the spread of frequencies represented by the different bands?

    posted in technical issues read more
  • Coalman

    @bocanegra
    thank you! well explained!

    posted in technical issues read more
  • Coalman

    if I make a simple patch like this:
    [osc~ 220]
    | [bang]
    |
    [print~]

    I get an array of numbers for each bang in the console.
    Can someone tell me what these numbers represent?

    are they amplitudes of the signal at various time points in chronological order?
    if I use [tabwrite~] to store them in an array in my patch instead of printing them to the console are the indices then in chronological order?

    how does one get the frequency content of the signal back from this array of amplitude/time points?
    I guess this is a question that is related to how FFTs work maybe...

    I am giving away the fact that I am not a signal processing wizard here, but I would be very interested to know how these different numeric representations of these signals show their (the same?) information..
    thanks!
    J

    posted in technical issues read more
  • Coalman

    Wow! Great. I hope to get a chance to try this out soooon!!!

    posted in pixel# read more
  • Coalman

    thats great, I am going out of town for a few days but excited to give it a try. Will send feedback. great!

    posted in patch~ read more
  • Coalman

    I was searching for something else but landed on this, downloaded the old version and will give it a test. Would love to see the new version too, it looks like a nicer version of something I was working on a while back!
    cheers,
    J

    posted in patch~ read more
  • Coalman

    Thanks everyone!
    Great and informative answers!
    Jorge

    posted in technical issues read more
  • Coalman

    hi,
    Recently someone posted something over on the Pd list that had this question inside part of a bigger question. I was interested in it but it didn't seem to get an answer so I thought I would try here...I know that Max has limits for list length but I was wondering if in Pd there is a maximum number of elements that can be listed?
    Likewise are the maximum limits to what can go into a message box?
    What about an array?

    I am sure someone has asked this before but I did not see any results when I searched for it.
    thanks in advance!
    jorge

    posted in technical issues read more
  • Coalman

    First off thank you all for your help and suggestions!
    I managed to find a solution with a little help from my friends.

    So, my main problem turned out to be that I needed to create my socket BEFORE defining my function. Then only after both of these are done I could set up the string to send to Pd (because Python does this sort of weird recursivey thing).

    Also as some of you suggested my string was named badly, first I was using a the wrong variable data type ("b") then I tried to make a string using "str" as a name which confuses Python as "str" is the string data type. So for anyone else dealing with this be sure to call your string something like "data" or "lsdfdjkhgs" but not "str"!

    Anyway, it works now and I can send data over to [netrecieve]
    incidentally @whale-av 's suggestion to use Pd's built in messaging scripts located in the application folder (pdsend & pdreceive) brought up a lot of interesting possibilities that I will be exploring later and for anybody wanting to send messages between Pd and other programs this looks like a cool way to do it.

    anyway, I will share the code here in hopes it will help someone else:

    import socket
    from obspy.clients.seedlink.easyseedlink import create_client
    
    # first get all the socket declaration out of the way
    s = socket.socket()
    host = 'localhost'
    port =  #put (your) open port here, this is also part of Pd's [netreceive] argument
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((host, port))
    
    # then we define our callback which happens when we receive data
    # out socket is already set up so we can reference it here in the callback
    def handle_data(trace):
        # trace is an obspy.trace class so we must convert to string
        # I have to mess around with this "trace" because it is part of the class my client code is using
       data = str(trace)
    
       # we can then neatly append a ; with a "f-string" to make it work with Pd's FUDI protocol (Pd messages end in ";")
       data = f'{data};'
    
       # or
       # data = str(trace) + ';'
       # if you like
       
       # and send it over our socket
       s.sendall(data.encode('utf-8'))
    
    #then AFTER all this my code connecting to the server (that returns the data as a string "trace" above, but the entire part for communicating with Pd is up there, and surprisingly simple despite the 'strange loops'!
    
    

    posted in technical issues read more
  • Coalman

    @whale-av , @ingox , @FFW
    Thank you so much for these detailed suggestions and examples. I have been submerged in other stuff this morning, but I will look through all of these and report back with the solution for the next person trying to do this.
    I think with all this to look at I should be able to sort one, these examples look great.

    best,
    Jorge

    posted in technical issues read more
  • Coalman

    @seb-harmonik-ar I think you are right about the variable type, a string would be better since the data type returned from the server is a mixture of alpha-numerics, spaces, and periods

    I have tried these things and despite trying several combinations of ways of writing the variable and encoding it I still don't seem to be able to send across what prints from the code above. I basically want to send to Pd the same data I am able to print from the ```
    print(trace)
    above, of course isn't necessary to print it first, and I am successfully sending strings across without printing it first
    the odd thing is that I can send an arbitrary string across fine and receive it in Pd
    (like yelkdsjf 032742n sdkjfh \ sldfjsldfkjlkdsjf 8493 sends fine using the code above (in place of "yello")
    but the data I am getting from the server (a line of which looks like "
    IU.SFJD.00.BHZ | 2021-08-19T12:45:49.019538Z - 2021-08-19T12:46:05.269538Z | 20.0 Hz, 326 samples
    doesn't send.
    in both cases I am adding the ";" at the end as Pd requires for messages...so it must be something about how I am dealing with the data I am receiving from the server because the actual data doesn't seem any weirder or to have any other prohibited characters than my arbitrary test data and it sends ok.

    so it must be that I am writing it to a variable wrong somehow, or
    maybe utf-8
    isn't the best encoding for something like that
    will continue to dig....

    posted in technical issues read more
  • Coalman

    that sounds cool, I might download that and give it a try when some time opens up!
    I don't think banging pots and pans around is such a bad idea either, but your track was a lot more sophisticated than that in any case!

    posted in output~ read more
  • Coalman

    I notice the bottom of the code box is cut off in my browser, so if that doesn't make sense for you, try to click the box and scroll up to see the rest of the code.

    posted in technical issues read more
  • Coalman

    @seb-harmonik-ar thanks for helping think this through, I am at a very low level with python myself, but it is useful for this kind of stuff.

    I don't think the problem is sending the variable over, because, as you say you could send a variable over in a simple way. Its more of how to assign dynamically updated values (from the server) to a variable.

    I will try to show you what I mean:
    here I define a function:

    import socket
    
    def handle_data(trace):
        #print('Received the following trace:')
        print(trace)
        print()````
    
    #(I am leaving out the code that sets up a client and queries data from a server because it is a bit #long, 
    #but I am using a package called obspy which is a package for doing this with seismographic data)
    
    #then I do this:
    
    s = socket.socket()
    host = 'localhost'
    port = #put an open port here
    
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    
    s.connect((host, port))
    
    b = client.run()
    
    s.sendall(b + ";")
    
    # problem is to get the data that prints from the client.run() sent over.  
    #That is what I have been trying here with "b".  
    #The way I do it for a static value is this 
    #(posting this because it might actually help someone else doing this stuff)
    
    s.connect((host, port))
    mess = "yello"
    Msg = mess + " ;"
    s.send(Msg.encode('utf-8'))
    
    # the ";" is because Pd likes messages in this 'FUDI' format 
    #which I think needs the semicolon like normal message boxes in Pd 
    #(and also if I am not mistaken there should be tab-separations between 
    #parts of. a message so that they can be separated as lists are in Pd)

    posted in technical issues read more
Internal error.

Oops! Looks like something went wrong!