DNA Sequence (Nucleotide) Player: Converting nucleotide sequences to (midi) Music
gene-seq-to-music-via-pd~-help.pd
gene-seq-to-music-via-pd~.pd
DNA Sequence (Nucleotide) Player: Converting nucleotide sequences to (midi) Music
Credits:
All source data is retrieved from the "Nucleotide Database" (DB) via National Center for Biotechnology Information, U.S. National Library of Medicine (NCBI) at
https://www.ncbi.nlm.nih.gov/nucleotide/
Miller Puckette for the J08.classicsynth
and
the creator(?) of the vlist2symbol abstraction.
Requirements:
wget, Linux command line web retrieval tool
Linux
ggee, [shell]
cyclone, [counter]
Use Case:
Actors: those who want to hear the patterns in DNA nucleotide sequences and/or comprehend how Nature makes Music not "noise"/Gene sequences are like one of Nature's "voices"/
Case:
Enter the "Accession" (identification number (id)) of a NCBI DB entry into the id symbol field
Case:
Click on "LOAD"
Case:
Click "PLAY".
Instructions:
1-Go to the DB (https://www.ncbi.nlm.nih.gov/nucleotide/) and find an Accession(id) of a sequence;
2-Enter that value into the ID [symbol] box of the patch
3-Click the "LOAD" [button/bang];
4-Set pitch, velocity, duration, and repeat for G,A,C, and T (representing the four nucleotide bases of a DNA strand — guanine, cytosine, adenine, and thymine);
5-Toggle "PLAY" to 1, i.e. to On, to hear the sequence using the variables you set in 4) and to "0" to stop it.
How It Works:
The patch takes the input ID and packs it into a string as the FILE(Path) for wget.
The wget command is then sent as a list to a shell object.
The output of the shell object is then parsed (using an intermediate [text] object) into a [text] object with each line being 4 characters long, each character being either G,C,A, or T.
Once loaded and Play is clicked, each line is then reconstructed as a midi note with the pitch as determined by the first character, velocity (2nd) and duration (3rd) and repeated as many times as the 4th character dictates (as set in 4) above).
Once the entire sequence is played, the player stops sending notes.
Inlets(left to right):
id, either numbers or symbols
values, a 16 item list of 4x4 sets of pitch, velocity, duration, repeat (i.e. one set per nucleotide type, G,C,A, or T) (Note: the sequence, if loaded, will play immediately upon receipt of this list.)
beats per minute, bpm, esp. as it relates to note durations.
Outlets:
the current midi note, i.e. pitch/velocity/duration
id (of the gene sequence)
sequence name, as listed by the NCBI DB
nucleotide being played as a string, ex. GGAC
AFTERWARD:
-
Since it really is only sending midi value it can be connected to whatever synth you would like;
-
Elsewhere on this Forum, I shared a patch which took "noise" as its input and converted it into music using sigmund~, in that case "running water" as its source. (See for reference: https://forum.pdpatchrepo.info/topic/12108/converting-noise-to-music-rushing-water-using-sigmund) This patch takes that concept and applies it to what might also be called "noise", DNA sequences, were it not that the results (like the running water, yet even more so) sound like "Music".
This exploration has me wondering...
How can we delineate what is noise (only natural at this point) and what is music?
Is the creative/ordering/soulful nature's being expressed in our own music not also being expressed by Nature itself? ...so that we might be considered one "bow" playing upon it?
And, if by Music we mean notes laid down on purpose, might not it be said that is what Nature has been done? Is doing?
I hope you find the patch useful, stimulating, and exciting, or at the very least funny to think about.
Love through Music, no matter in what state Life may find you,
Peace,
Scott
How do I play up to 64 txt files at once. 16 digits can be 1's or 0's loaded as toggle states.
So I have 64 txt files containing 16 digits that could be a 1 or 0. these digits are used as toggle states for my sequencer. the state of a toggle is sent to [s seqstep1] to [s seqstep16] and recieved to its 1 of the 16 toggles boxes in the sequencer. When a sequence is loaded a file path with the sequence number attached to it like this for example pattern-1.txt to pattern-64.tx there can be up to 64 sequences play at any given time based on the [s seqstep1 ] for the loaded txt file.
I am able to play them one at a time by changing the number atom and pushing play but im not sure how I should go about loading and playing all 64 txt files at once.
The below screen shot is how the sound is trigger using the [OBBangOnMetronome] abstract. The outlet is sent to second inlet of [OBPlayPadSample]. The first inlet is the selected sequence (the sequence that we want to play) number atom.
I need a a [Play all] button is the easiest way I can describe it.
The last screen shot is simply for visual representation of how the sequencer looks.
[Solved] Only have one instance of Pd open on RPi...
@nicnut Happy thanksgiving to you too!
I am in France..... hence help will be slow.... but anyway.....
You should send a message from Python directly to Pd.
There is some help on how to do that here....... https://guitarextended.wordpress.com/2012/11/03/make-python-and-pure-data-communicate-on-the-raspberry-pi/
Then you can receive the filename that you have sent from python.
If you send the filename and the path from python then (probably)......... if you use port 3000 as in the link above....
But that could easily be wrong. It will depend on a few things.
Are you using Extended or Vanilla..... you will need to look at the help for [netreceive] and set it to tcp or udp (depends what you are sending from Python).
The above should work if the message sent from python is a string "filename <space> path to file".
The $1 will be replaced by "filename" and the $2 by "path to file"
If you know in Pd already the "path to file" then you do not need to send it from python.
You can put the message......
[open $1 C:/thepath(
Don't despair....!
Many great experts are on this forum and will reply, so ask your questions at any time.
Posting the Python code you have made into this thread will help us see any problems.
But the Python code to create the "filename" string you probably know more about than me......
David.
installing external libraries
hi @whale-av
sorry, i misspelled it. it's adrian moore's book "Sonic Art: an introduction to electroacoustic music composition". Here is the link for the external library: https://www.sheffield.ac.uk/usss/ussstools
i have the 64-bit Pd installed.
thank you for your help!
i have already set the paths and runned the 'find externals' option...
Touchscreen Interaction Issues
@itcoil Pd communicates with mouse and screen just like any other program. You will have to look to the X Manager (window manager) for some way to modify settings for the touch screen I think.
You are looking to set "touch and hold" for a mouse left-click emulation.
Somewhere you should be able to set how long it will hold for.
Or it could be a sensitivity setting.
Google might help.
I found this for "right-click" touch and hold with X11........https://forums.pimoroni.com/t/official-7-raspberry-pi-touch-screen-faq/959
PS..... I have just read that most PI os's are really desktop (mouse and screen) oriented, and a specialised os or software can be necessary to interpret swipes and similar.
This looks more useful....... https://www.raspberrypi.org/forums/viewtopic.php?t=189855
David.
Touchscreen Interaction Issues
Hi,
I've tested two separate touchscreens on a Pi 3B+ (Raspbian Stretch) running Pd-l2ork-2.5.1. One screen is a 5" resistive (https://www.adafruit.com/product/2260) and one is a 7" capacitive (https://www.waveshare.com/7inch-hdmi-lcd-c.htm). They both connect with an HDMI cable, and a USB cable for touch.
The resistive screen operates as expected. I can slide my finger to operate an hslider. I can use the cursor object and see x/y parameters as I slide my finger in a patch.
The capacitive screen operates differently. I have to tap the screen to operate an hslider. I can't slide it. Also, the cursor object only shows x/y as I tap the screen, not as I slide on it even though the screen cursor is moving along directly under my finger as I slide it. The hid object with this touchscreen shows absolute x/y but hid is a very expensive object when polled fast enough for what I need, and it'd be a lot cleaner for me to have the touchscreen work directly with sliders.
Does anybody have any suggestions how I could filter or transform the interaction between pd and the capacitive screen so it's like the resistive screen? It's strange because the onscreen cursor moves just as if a mouse is moving it but pd doesn't recognize it unless I'm tapping instead of sliding.
Thank you for any insight.
Installing PureData 32 bits on 64 bits host for the life of a project
Hi everyone,
I am comming to you today because i want to make a project live !.
This project work with pureData and some external pd object :
fluid~ , freeverb~..
My objectiv is to install a 32 bits version of pureData to make external pd work.
I tried these solutions :
Multi arch ubuntu 64 bits host
- On a 64 bits ubuntu
- add i386 arch
- update , dist-upgrade..
Then when installing : $> apt-get install puredata:i386
This package is no more available :
These packet a replacing it :
puredata-utils puredata-utils:i386 puredata-extra:i386 puredata-core:i386
puredata-core puredata-dev puredata-doc puredata-extra puredata-gui
So i installed
$> apt-get install puredata-utils:i386 puredata-extra:i386 puredata-core:i386 puredata-gui
pureData is now installed. But when i run it i have this message :
ALSA lib conf.c:3357:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so
ALSA lib control.c:954:(snd_ctl_open_noupdate) Invalid CTL hw:0
ALSA card scan error
Still i can use the debugger and hear sound..
When running my stido project using some object like :
udpReceive or udpSend...
i got this on the initialisation (you can see also all the pd objects used) :
import mrpeach/routeOSC
... couldn't create
import mrpeach/udpreceive
... couldn't create
import mrpeach/udpsend
... couldn't create
import mrpeach/packOSC
... couldn't create
import mrpeach/unpackOSC
... couldn't create
import flatspace/prepend
... couldn't create
import flatspace/prepend
... couldn't create
import moocow/sprinkler
... couldn't create
import cyclone/speedlim
... couldn't create
./libs/fluid~.pd_linux: libreadline.so.5: cannot open shared object file: No such file or directory
fluid~
... couldn't create
freeverb~
... couldn't create
beware! this is xeq 0.1, 3rd beta build... it may bite!
./
So its not working ^^
Solution 2 - Docker
I was thinking : maybe i can just make a puredata container with all the 32 bits libs, So i tried to find some puredata 32 bits image. But nothing.. And Docker is a little tricky with 32 bits container as he didn't provide any support yet.
Still its possible to run 32 bits linux on it .. i found some 32 bits images on the net, but no way how to create one..
If someone has a solution please..
I am working as a volunteer on this project because i believe on it. I have no time yet to update the pd engine for 64 bits..
This project is helping disabled people and your respons will help me so much to provide them a long term support for this software
If you wanna take a look at the project http://orguesensoriel.com
Thank you a lot,
Damien
FFT analysis in wav files
Hi, guys!
I'm relatively new to Pure Data and I'm making a visual project — with Pure Data (Purr Data version) and Processing — that depends on a good FFT analysis.
I've been trying to solve this problem for some time now.
I made the patch that is in this tutorial:
This patch opens a file and "draws" the left and right channels on two arrays.
I'm trying to mix this patch with the "patches/3-8-1-1-rfft-array.pd" of this tutorial:
http://www.pd-tutorial.com/english/ch03s08.html#id431716
So, what I'm trying to do is to make an FFT analysis to an wav file to represent visually the amplitude of each range of frequencies from the lower frequencies to the higher frequencies for different songs.
When I test the FFT analysis with an [osc~] object (writing it in an array), everything is kind of fine: 10000Hz in the middle, 20000Hz glued to the right. But I noticed that when I put [osc~ 0], the amplitude glued to the left is really high. Same with 50Hz, 100Hz, 150Hz, etc.. until around 1500Hz. Another thing I noticed is that each frequency has a different amplitude.
So, one thing I tried to do: I put the FFT code in a subpatch and changed the blocksize inside it to 4096 with the object [block~]. Since only the first 32 bins shows the frequencies, I put the size of the array with half the blocksize: 2048. Then, since the main frequencies of the majority of the songs goes until around 5000Hz — I've been told that C8 correspond to around 4200Hz, and that would be in the 7th bin in a block size of 64 —, I tried to reduce the size of the array to 512:
20000 (total frequencies) / 2048 (bins) = 9,76 (frequencies per bin)
5000 (frequencies for songs) / 9,76 (frequencies per bin) = 512 (bins)
In a blocksize of 64, this would correspond to the first 8 bins.
But still, after all this, the frequencies are always glued to the left:
I've tried everything to make a well-distributed FFT analysis, like it should be, but it's ALWAYS glued to the left with all the songs that I tried with...
Sorry for the long post and let me know if I wasn't clear in my question...
Thank you in advance!
Receiving multiple variables from puredata in python
Hello everyone,
I've been working lately with puredata and python together using python as the brain of the system and puredata as the audio engine. For the moment I've been successfully sending messages from python to puredata thanks to this tutorial:
Make Python and Pure Data communicate on the Raspberry Pi
Now I want to reverse the process sending float values from puredata's vumeters to python and then represent them in led vumeters that are connected to the raspberry gpios.
One question is, how do I package the different vumeters values to connect them separately to the netsend object in pd? (Like the following screenshot)
I made a python script with the pdreceive command but I don't know how to take the message from the string concatenation:
I need to take each vumeter value separately from puredata and be able to identificate them in python.
Does anyone knows how to solve this problem?
Thank you!
Uninstall from Ubuntu 16.04
@EEight It doesn't work, because it says that "El paquete «puredata» no está instalado", that puredata is not installed... isn't it rare?
anibal@anibal-ubuntu:~$ sudo apt-get purge pd
[sudo] password for anibal:
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias
Leyendo la información de estado... Hecho
Nota, seleccionando «puredata-core» en lugar de «pd»
Los paquetes indicados a continuación se instalaron de forma automática y ya no son necesarios.
libgsl0ldbl ttf-dejavu-core
Utilice «sudo apt autoremove» para eliminarlos.
0 actualizados, 0 nuevos se instalarán, 0 para eliminar y 2 no actualizados.
anibal@anibal-ubuntu:~$ sudo apt-get purge puredata
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias
Leyendo la información de estado... Hecho
El paquete «puredata» no está instalado, no se eliminará
Los paquetes indicados a continuación se instalaron de forma automática y ya no son necesarios.
libgsl0ldbl ttf-dejavu-core
Utilice «sudo apt autoremove» para eliminarlos.
0 actualizados, 0 nuevos se instalarán, 0 para eliminar y 2 no actualizados.
anibal@anibal-ubuntu:~$
Then I did:
anibal@anibal-ubuntu:~$ sudo apt-get purge puredata-core
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias
Leyendo la información de estado... Hecho
Los paquetes indicados a continuación se instalaron de forma automática y ya no son necesarios.
libgsl0ldbl ttf-dejavu-core
Utilice «sudo apt autoremove» para eliminarlos.
Los siguientes paquetes se ELIMINARÁN:
puredata-core*
0 actualizados, 0 nuevos se instalarán, 1 para eliminar y 2 no actualizados.
Se liberarán 2.680 kB después de esta operación.
¿Desea continuar? [S/n] s
(Leyendo la base de datos ... 242946 ficheros o directorios instalados actualmente.)
Desinstalando puredata-core (0.46.7-3) ...
Purgando ficheros de configuración de puredata-core (0.46.7-3) ...
Procesando disparadores para man-db (2.7.5-1) ...
anibal@anibal-ubuntu:~$ pd
anibal@anibal-ubuntu:~$
...and I launched pd fine... The puredata-core corresponded to an earlier installation. Thanks!