Scripting Purr Data - with JavaScript?
Thanks again @lacuna - great to have that thread as reference!
Just tried it for a bit: I cannot seem to find any binary releases in the github, https://github.com/mganss/pdjs (EDIT: found them https://github.com/mganss/pdjs/releases )- so I went along with this:
I don't really understand what this .dek
file is supposed to be, but the page itself says it is a zip file, so I tried this (I use MSYS2 bash
shell in Windows):
$ wget http://puredata.info/Members/mganss/software/pdjs/1.2.63/pdjs%5Bv1.2.63%5D%28Darwin-amd64-32%29%28Linux-amd64-32%29%28Linux-arm64-32%29%28Windows-amd64-32%29.dek/at_download/file -O pdjs_v1.2.63.dek
$ unzip pdjs_v1.2.63.dek
Archive: pdjs_v1.2.63.dek
inflating: pdjs/js.dll
inflating: pdjs/js.l_arm64
inflating: pdjs/js.pd_darwin
inflating: pdjs/js-help.pd
inflating: pdjs/js.pd_linux
inflating: pdjs/js-help.js
nice, now I have a pdjs folder; so I tried copying it to my 32-bit copy of PurrData:
$ mv pdjs /c/bin/PurrData_x86_2.15.2/extra/
$ /c/bin/PurrData_x86_2.15.2/bin/pd.exe -verbose
Here, in an empty patch, I place an object [pdjs/js test.js]
(see also the note in the Github README about declare -path pdjs
); and I get:
...
tried C:\\Program Files (x86)\\Common Files\\Pd-l2ork\\pdjs\\js\\pdjs\\js.pd and failed
tried C:\\bin\\PurrData_x86_2.15.2\\extra\\pdjs\\js.m_i386 and failed
tried C:\\bin\\PurrData_x86_2.15.2\\extra\\pdjs\\js.dll and succeeded
verbose( 1):C:\\bin\\PurrData_x86_2.15.2\\extra\\pdjs\\js.dll: couldn't load
tried C:\\bin\\PurrData_x86_2.15.2\\extra\\pdjs\\js.pd and failed
tried C:\\bin\\PurrData_x86_2.15.2\\extra\\pdjs\\js.pat and failed
tried C:\\bin\\PurrData_x86_2.15.2\\extra\\pdjs\\js\\pdjs\\js.pd and failed
error: couldn't create "pdjs/js test.js"
...
Hmmm... library got found, but is not loaded; then I thought, let's check:
$ file /c/bin/PurrData_x86_2.15.2/bin/pd.exe
/c/bin/PurrData_x86_2.15.2/bin/pd.exe: PE32 executable (GUI) Intel 80386 (stripped to external PDB), for MS Windows
$ file /c/bin/PurrData_x86_2.15.2/extra/pdjs/js.dll
/c/bin/PurrData_x86_2.15.2/extra/pdjs/js.dll: PE32+ executable (DLL) (GUI) x86-64, for MS Windows
Yeah - I cannot load a 64-bit .dll by a 32-bit .exe!
So, apparently, there is no 32-bit build for pdjs
(see "Supported platforms" in the Github README), so I installed the 64-bit build of Purr Data ... and tried it there:
$ cp -a /c/bin/PurrData_x86_2.15.2/extra/pdjs /c/bin/PurrData_x86_64_2.15.2/extra/
$ /c/bin/PurrData_x86_64_2.15.2/bin/pd.exe -verbose
... and finally, could see it working - instantiating [pdjs/js test.js]
gives messages:
...
tried C:\\bin\\PurrData_x86_64_2.15.2\\extra\\pdjs\\js.m_i386 and failed
tried C:\\bin\\PurrData_x86_64_2.15.2\\extra\\pdjs\\js.dll and succeeded
pdjs version 1.2.63 (v8 version 8.6.395.24)
tried C:\\bin\\PurrData_x86_2.15.2\\test.js and failed
tried C:\\Users\\user\\AppData\\Roaming\\Pd-l2ork\\test.js and failed
tried C:\\Program Files\\Common Files\\Pd-l2ork\\test.js and failed
tried C:\\bin\\PurrData_x86_64_2.15.2\\extra\\test.js and failed
error: Script file 'test.js' not found.
... click the link above to track it down, or click the 'Find Last Error' item in the Edit menu.
error: couldn't create "pdjs/js test.js"
One invocation that works for quick test is [pdjs/js pdjs/js-help.js]
, which succeeds - and then you can right-click the object and see the Help.
Finally, note this from the README:
There is no built-in editor like in Max, source files have to be created and edited outside of Pure Data.
Well, this is nice! On to see how to work with this object...
Thanks again for the help!
Kor'In modular synthesizer made with NoxSiren system.
Here is a quick demo of the kind of things you can do with my modular synthesizer system called NoxSiren .
NoxSiren System :
https://forum.pdpatchrepo.info/topic/13122/noxsiren-modular-synthesizer-system-v4-0
Kor'In Synthesizer :
https://forum.pdpatchrepo.info/topic/13137/kor-in-advance-6-voice-polyphonic-synthesizer-made-with-noxsiren-v4-0
interrogate my Gem Installation on arch linux :),
Okay I've set up a few paths including:
bin/Gem/examples
bin/Gem/abstractions
bin/Gem
bin/Gem/help
root/pd/externals
Hopefully you can see that the objects are now recognized, so thats good.
if I want to right clicked to access a help file, hopefully you can see in the picture, within the pd window you may notice it says "sorry, couldn't find help ..." despite the path being in place?
If I want a help file I have to go through my file system and find the patch I want from within the Gem directory in bin which obviously isn't as convenient.
is there some knowledge im clearly missing here?
[pak ] / [unpak ] - lazy pack/unpack objects with 'anything' inlets/outlets
Similar to [pack ] and [unpack ] but instead of the default atom type being a float, the default type is anything.
Also comes with a new creation arg 'a' for anything. Numbers and unrecognized types will also default to anything.
For strict type checking, use f(loat), s(ymbol), and p(ointer).
The pak object will also store unrecognized types as symbols and interpret 'b' as a 'bang' symbol.
You can send lists to any of the additional pak inlets and it will store the list values with the inlet as the starting point. For example, sending the message [foo bar 3 baz( to the 2nd inlet of [pak 1 2 3 4] would result in the list: 1 foo bar 3
The example includes another object called [x ], which is a kind of trigger object that dehusks lists that consist of only 1 element when you use 'a' or nothing for creation args. For pd-vanilla users, the example also requires zexy's [demux].
You can also use "." to skip inlets and assign only specific ones.
For example, sending the message [. . 123( would assign 123 to the 3rd inlet and leave the first two values the same as they were. You can send these messages to any inlet.
The skip arg feature only applies to list and anything type messages, so if you really want to, you can still assign a single period to an inlet by sending it as a symbol.
There are two more objects [@pak] / [@unpak] - reverse pak/unpak, which output the lists in reverse order.
Strict-type error messages are muted by default and to unmute them, you need to send [mute 0( to the 1st inlet. The number sent to mute acts as a bit mask for the inlets, so when a bit is turned on, the associated inlet will output error messages.
Calculating Resonance for Delay
P. 399 of Designing Sound (p. 423 in this online version: https://ja.scribd.com/document/289610007/Designing-Sound-Andy-Farnell-pdf) describes the building of formants and a resonator for a wooden door. Here are the formants:
And here are the delay alues for the resonator:
While I imagine the formants were derived from spectograms of door recordings, I don't understand how the delay values (4.52ms, 5.06ms etc.) were derived. I thought they might derive from the formant frequencies, but while there are eight delays, there are only six filters.
Does anyone have any idea where Farnell got these values? Also, do abstractions have the same audio lag as subpatches?
EDIT: Here's the actual patch. I added that hip~ thing from the other thread to hear a single impulse, haha, with and without formants. The formants sound good- like they'd make a good spectrum for a wooden body with more resonance, but with the delays sound kind of trashy: doorcreaker.zip
python speech to text in pure data
this is a combination of speech to text and text to speech it is mainly copied from here: https://pythonspot.com/speech-recognition-using-google-speech-api/
it works offline with sphinx too, but then it is less reliable.
import speech_recognition as sr
from gtts import gTTS
import vlc
import socket
s = socket.socket()
host = socket.gethostname()
port = 3000
s.connect((host, port))
while (True == True):
r = sr.Recognizer()
with sr.Microphone() as source:
r.adjust_for_ambient_noise(source, duration=1)
print("Say something!")
audio = r.listen(source,phrase_time_limit=5)
try:
pdMessage = r.recognize_google(audio, language="en-US") + " ;"
message = r.recognize_google(audio, language="en-US")
s.send(pdMessage.encode('utf-8'))
print("PD Message: " + message)
tts = gTTS(text = str(message), lang="en-us")
tts.save("message.mp3")
p = vlc.MediaPlayer("message.mp3")
p.play()
except sr.UnknownValueError:
print("Google could not understand audio")
except sr.RequestError as e:
print("Google error; {0}".format(e))
What I would like to achieve: I have an CSV file with ~60000 quotes. The recognized word is send with [netreceive] to Pure Data and the patch chooses randomly one of the quotes where the recognized word appears. That does work.
My question: Is it possible to send the choosen quote with [netsend] back to python and transform it there into speech?
Somebody says a word and the computer answers with a quote where the word appears...
Does it make sense to use Pure Data for that task or better just use Python (but I do not know how to do that only with Python yet...)?
The Universal Sentence Encoder sounds really promising for "understanding" the meaning of a sentence and finding the most similar quote. But that is far too complicated for me to implement...
https://www.learnopencv.com/universal-sentence-encoder/
Mobmuplat Help
Nhập cư Châu Âu vĩnh viễn thông qua chương trình định cư Síp
Đầu tư định cư Síp chính là con đường giúp nhà đầu tư nhập cư Châu Âu vĩnh viễn và sở hữu quốc tịch Châu Âu - Thẻ xanh Châu Âu nhanh nhất.
Đôi nét về quốc đảo Síp
Síp (Cyprus) là đảo quốc nằm giữa biển Địa Trung Hải với khí hậu nắng ấm quanh năm và những bãi biển tuyệt đẹp. Cộng hòa Síp nằm giữa các lục địa của châu Âu (phía đông Hy Lạp), Châu Phi (phía bắc Ai Cập), và Châu Á (phía nam Thổ Nhĩ Kỳ và phía tây Syria và Li băng). Với diện tích khoảng 9,251 kilomet vuông, đây là hòn đảo lớn thứ ba ở Địa Trung Hải.
Đảo Síp là hòn đảo lớn thứ 3 ở Địa Trung Hải
Đảo Síp là hòn đảo lớn thứ 3 ở Địa Trung Hải và là địa điểm thu hút lượng lớn khách du lịch từ khắp nơi trên thế giới. Hơn nữa cộng hòa Síp còn có nhiều bệnh viện tư nhân hiện đại cung cấp dịch vụ khám chữa bệnh, dịch vụ y tế và phẫu thuật. Các bệnh viện này tọa lạc ở khắp nơi trên khắp đất nước.
Chất lượng cuộc sống tại đảo Síp rất lý tưởng nhưng chi phí sinh hoạt tại đây lại khá rẻ, rẻ hơn nhiều so với các nước Anh Quốc. Đây chính là lý do khiến đảo Síp được lựa chọn là nơi đầu tư định cư Châu Âu. THẺ XANH CHÂU ÂU giá TỐI THIỂU của các nhà đầu tư.
Đầu tư định cư Síp – Con đường nhập cư Châu Âu vĩnh viễn
Chương trình đầu tư lấy quốc tịch đảo Síp là cách đơn giản và hiệu quả nhất để nhà đầu tư được cấp quốc tịch Liên minh châu Âu và nhập cư Châu Âu vĩnh viễn. Đây là chương trình duy nhất cho phép nhà đầu tư lấy ngay quốc tịch châu Âu trong 90 ngày mà không cần phải đáp ứng bất kỳ yêu cầu nào về thời gian cư trú. Đặc biệt, nhà đầu tư và các thành viên trong gia đình được hưởng đủ mọi quyền lợi của công dân châu Âu, bao gồm quyền được sinh sống và làm việc ngay lập tức tại bất kỳ quốc gia thành viên nào thuộc khối châu Âu.
Đầu tư định cư Síp – Con đường nhập cư Châu Âu vĩnh viễn
Đặc biệt, hộ chiếu của Síp được miễn Visa ở 158 nước trong đó có Anh, Úc, Mỹ, Hồng Công.. thuộc loại hộ chiếu có quyền lực hàng đầu thế giới. Đảo Síp còn là thành viên liên minh EU và khối Schengen nên người có hộ chiếu Síp sẽ được xem như là một công dân EU thực thụ, có quyền sống, đi lại, học tập và làm việc tại 27 nước như Pháp, Đức, Bỉ..Hiện hộ chiếu Việt Nam chỉ mới được 48 nước miễn thị thực, xếp thứ 78/104 nước chỉ ngang với cộng hòa Trung Phi hay Turkmenistan. Vì vậy việc đầu tư định cư để lấy hộ chiếu Síp giúp công dân Việt Nam thuận lợi trong việc đi lại, sinh sống, học tập và làm việc.
Cho đến thời điểm hiện tại, Chính phủ Việt Nam và Chính phủ Cộng hòa Síp vẫn chưa có một ký kết nào liên quan đến việc miễn thị thực nhập cảnh cho công dân cả hai nước đảo Síp và Việt Nam. Do đó, nếu công dân Việt Nam muốn đến Cyprus du lịch hay đi công tác cần phải xin visa Cộng hòa Síp.
Nếu bạn cảm thấy hứng thú với bài viết của chúng tôi thì có thể tham khảo thêm bài viết: Đầu tư định cư Quốc tế và những điều bạn cần biết
Lissa Executable / ofxOfelia compile error (Solved)
@cuinjune I tried to compile the lissa seq patch. but when i open the executable it opens only a small empty window.
i also tried to compile a help patch for testing, with the same result.
but your example works fine(Win32Example).
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!
16 parameters for 1 voice, continued...
@whale-av hey, so I made this patch, it doesnt have abstractions, i havent practiced them yet, but would this be considered additive synthesis? 5 sinewaves, different frequencies, and start at the same volume but end differently...additive synthesis.zip :0,
for additive synthesis each sine must be at a different frequency and volume right? so I could be making glissandi in pitch and volume and it would still be considered additive synthesis?