Playing sound files based on numbers/sets of numbers?
@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.
Playing sound files based on numbers/sets of numbers?
@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!
Book on Pd and Arduino just published
Hi all,
After a long time of hard and intensive work, my first book, 'Digital Electronics for Musicians' is out!
The book focuses on Pd patching and Arduino programming, and in the communication between the two platforms, creating musical interfaces. Some projects incorporate embedded computers, focusing on the Raspberry Pi, but giving generic information on this subject. Hopefully some people will find this helpful and fun!
http://www.apress.com/9781484215845?gtmf=s
On Amazon you can have a glance at some of its contents!
http://www.amazon.com/Digital-Electronics-Musicians-Alexandros-Drymonitis/dp/1484215842/ref=sr_1_1?s=books&ie=UTF8&qid=1450708668&sr=1-1&keywords=digital+electronics+for+musicians
pd open
Hi David, I am also David.
m0oonlib doesn't come with Pd-vanilla, but I am willing to get Pd-extended working (I'm actually prototyping for a patch that will run on a raspberry pi.) I definitely want to share these patches when I'm done, so I am using relative paths because I want it to run on different environments, with different file structures, with everything relative to the main patch.
If I declare /synths
wouldn't that be an absolute location (at the root of my filesystem?)
open
messages require 2 params, the second of which is the path. If you leave it off you will get this error:
Bad arguments for message 'open' to object 'pd'
I have tried it several ways, and all do not work:
(I get the Bad Argument
error)
With all of these I get Device not configured
:
These work, but are not ideal:
I'd prefer not hardcoding an absolute path.
moonlib/absolutepath
doesn't seem to work with a directory name, only a file. That means this works:
But not this (the format I actually need for path):
This works, but really I'd just prefer a solution that works in Pd-vanilla:
Midi to hz, and hz to midi formulas
@dangrondang wrote:
The circles we calculated the orbits to be proved each to be slightly short of a true, pure circle, thus returning the satellites to the ground. Pi more precisely can be evaluated to 3.1446055, and not the perpetuation of imperfection, and the maintenance of ignorance still taught today.
Sorry to be blunt, but what you are stating is awfully incorrect and the way you proclaim to know this "hidden truth" is really awufully ignorant. So you are stating that there is a mistake on the 3rd decimal digit of pi... It so happens that this decimal place was precisely calculated centuries ago, and the result still (obviously) stands today. There are tons of different approaches on how to get correct digits of pi, such as by using certain convergence series as mentioned by @seb-harmonik.ar. One can manually calculate the 3rd digit of pi using these type of series, and this result has been known for more than a millennium (in the year 480, the value known was 3.1415926, which is way more precise than what you state. By the early 18th century, we knew 100 digits of pi, none of which have been "corrected" later on. See: https://en.wikipedia.org/wiki/Chronology_of_computation_of_π). There is no way that in the 1960's pi had to be defined as 3.1446... instead of 3.1415..., that is just pure ignorance and witchery.
But reading about your number on the internet, I found that this 3.1446055 appears in several articles about satellites, pyramids and all that "dark hidden world that nobody tells you about open your eyes sheep people controlled by the illuminati" kind of talk, but not a single time in a serious mathematical or physics website/journal/wiki. Sorry but the world is not a dark place controlled by people with magic powers trying to keep you in the shadows... simply do not use random blogs as source of information.
The assumption of equal temperament proves a repetitious vexation, denotes ignorance, apathy, laziness, and/or unfamiliarity with the math of music. Worse, this assumption proves far too common among engineers / mathematicians / scientists / software programmers. Which then deprives us musicians of useable tools, and the stupidity of the need for MIDI tuning standard / scala / etc, is the vacuum such engenders.
As for the "stupidity" of using a tempered system, that is just as stupid as using a non-tempered one: it is simply a convention, upon which we built centuries of music. Western music has been based on it for long time (although contemporary composers, myself included, often choose to use micro-intervals), and the decision to create MIDI around this is as logical as it gets when you think what they were aiming at. Or should we have went through all sorts of trouble to incorporate all crazy stuff in the MIDI protocol (which is an Western creation), such as the possibility of having Indian micro-tonal scales? But wait, then what about gamelan scales? No wait, what about <insert ethnomusic genre here> scales?
From a practical point of view, you can still use MIDI cents, and you can also directly use frequencies if you want to precisely define the pitch of a sound. You can compose music in 12-tones, 27-tones or 193-tones if you wish to. The tools are here, and Pd allows you to do whatever you want with them (I myself have composed works using Pd and MIDI that deals with microtones and microtonal glissandi in real-time).
I hope you won't get personally offended with my message, but I can't really read this type of statement, which tries to propagate pseudo-scientific kind of stuff, without writing a strong reply.
Best,
Gilberto
Arduino, ultrasonics and Pd: HELP needed for degree project!
Dear Pd'ers… I'm fairly new to Pd and have been using it during my 'Audio Production' degree at SAE college in London. I'm here to ask for help on my final degree project, which aims to control objects within Pd by way of proximity sensors connected to Arduino.
I have had moderate success, first using a Sharp GPD12 IR sensor connected to an analog port on an Arduino Diecimila, then a Devantech SRF02 connected via I2C to Arduino. I have managed to get Pure Data reading the sensor values using the Pure Data example included in SimpleMessageSystem (http://www.arduino.cc/playground/uploads/Code/SimpleMessageSystem.zip)... and only altering the number of the comport the Arduino appears on.
On the Arduino end, I have added the SimpleMessageSystem library, and am using the following sketch to run one or both of the sensors depending on whether or not I omit the SRF02 or GPD12 parts of the code.
// top //
#include <Wire.h>
#include <Servo.h>
#include <SimpleMessageSystem.h>
int sensorPin = 0;
int sensorValue = 0;
Servo servo1;
#define sensorAddress 0x70
#define readInches 0x50
#define readCentimeters 0x51
#define readMicroseconds 0x52
#define resultRegister 0x02
void setup()
{
Wire.begin();
Serial.begin(9600);
}
void sendCommand (int address, int command) {
Wire.beginTransmission(address);
Wire.send(0x00);
Wire.send(command);
Wire.endTransmission();
}
void setRegister(int address, int thisRegister) {
Wire.beginTransmission(address);
Wire.send(thisRegister);
Wire.endTransmission();
}
int readData(int address, int numBytes) {
int result = 0;
Wire.requestFrom(address, numBytes);
while (Wire.available() < 2 );{
}
result = Wire.receive() * 256;
result = result + Wire.receive();
return result;
}
void loop()
{
// SRF02 READING //
sendCommand(sensorAddress, readInches);
delay(70);
setRegister(sensorAddress, resultRegister);
int sensorReading = readData(sensorAddress, 2);
Serial.println(sensorReading);
delay (200);
// GPD12 READING //
sensorValue = analogRead(sensorPin);
int range = (6787 / sensorValue);
Serial.println(range);
delay(200);
}
// bottom //
Pure data is picking up the sensor's output as a decimal number, through the serial port, correctly, and showing this as a number in the SPECIAL CHARACTER section of the Pd patch, which I can then use to control various Pd parameters, like a slider for example.
If printing both sensor readings to the serial, the Pd patch will pick up the two sensor values alternately, but there seems no way of differentiating the two sensors within Pd, as they both come through the serial. I have tried prepending the serial print at the Arduino stage with a tag such as "IR" or "UL" for each sensor, but this simply ends up in nothing coming through in Pd.
Using one sensor gives the ability to control parameters with a fairly narrow detection range, but for the final version I would like to incorporate 4 or 5 sensors in order that I can cover nearly a full 360 degree range.
After a bit of research I have gone and bought 4 x Maxsonar EZ0's. They've got a wider range than the Devantech sensors, and can operate via I2C, serial or PWM. A number of people online seem to mention the improved stability when operating via PWM, so I thought this could be kinda useful.
I am going to London Hackspace tomorrow to get help with wiring up the sensors to my Arduino Diecimila, but for now, my main problem seems to be how to achieve greater communication between Pure Data and the sensors. It's all very good and well being able to take the decimal readout from an analog input to give one set of values in Pd, but I would like to know how to either to read (and trigger) each sensor discretely via PWM, or to somehow differentiate between each sensor's analog output, so that I can have the different sensors controlling different objects within Pd.
As well as SimpleMessageSystem, I looked at using the Pduino object. But to be honest, it is either not working properly (I have noticed reported issues with bugginess), or I am being stupid, as it has totally boggled my brain. In theory though, it seems like it should be able to do what I want, ie. send and receive commands between Arduino and Pd.
****************************************
So…. my questions for anyone out there with a knowledge of using Arduino + multiple sensors (preferably Maxsonar EZ's) with Pd are:
What is most appropriate for my project?
- Simple Message System or Pduino?
- analog or PWM?
And how do I get proper communication between the two platforms so I can discern discrete values from each sensor?
I'd really like to get a discussion going with this as (a) it would really help me in my degree (which ends in about 4 weeks!!!) and (b) I really want to share what I am doing, especially as the discussions on Arduino/Pd communication on the various forums seem a little patchy (at least for noobs like me). I also hope to continue my research in the future, sharing any findings I make with the community…
****************************************
PS. In the sharing spirit, please check out the Radio Tuner patch I've just posted over on the patch section of this forum - it's my first successful attempt at Pd... I hope you enjoy
Make art - call for projects "in-between design" - deadline 31st July
_
_ _ ____ _ _ ||
| | | | ||_ | | || | |
| || | | || | | ||| | |_____
| | || | | | ____ | | | | |
| | | | | | | | | | || | |_
|| || || || || || ||
|| ____ _______ _________
|| || | | | | _
| || | | ||| | | || ||
from | __ | | _ | | |
4 to 7 | | | | | | ||__ ||
NOVEMBER 2010 || || || |_| ||
*CALL FOR PROJECTS*
The sixth edition of make art – in-between design: rediscovering
collaboration in digital art – will take place in Poitiers (FR), from
the 4th to the 7th of November 2010.
make art is an international festival dedicated to the integration
of Free/Libre/Open Source Software (FLOSS) in digital art.
make art offers performances, presentations, workshops and an
exhibition, focusing on the encounter between digital art and free
software.
*in-between design: rediscovering collaboration in digital art*
Today's market production accelerates the spread of non-critical and
standardized aesthetics, by means of locked top-down distribution
mechanisms and a series of tools that enforce it. At the same time
new forms of methodologies inspired or powered by free software,
participatory practices and peer-to-peer networks are fueling many
Internet subcultures. Some of these emerging practices will lead to
competitive social productions, while other will remain as pure
artistic experiments.
By adopting production and distribution methods based on free software
and open standards and by sharing the sources of one's work with
others, the collective knowledge base and aesthetic sensibilities can
freely interact to explore uncharted, hybrid directions which no
longer reflect the supremacy of a single idea.
- Does the sharing of artworks "recipes" and tools help debunk
the myth of the isolated design genius? - By leaving the possibility of ongoing development and refinement,
is it possible to ever produce a "final" design? - Can these methods and technologies inspire new forms of creation or
tools, beyond self-referential productions? - Is it wishful thinking to approach collaborative graphical design
in the same way as an open source software project? - Is Free and Open Source licensing a catalyst for creation or does
it add an extra level of complexity? - Can the limitation of one license trigger new forms of constrained
creativity?
We're currently seeking new, innovative media art and design works and
projects focusing on the above theme and questions:
- graphical artworks and installations
- lectures
- project presentations
- software and hardware demos
We're also seeking audiovisual performances that will take place
during the festival evenings.
The submitted projects must fit this focus and be made in a free/libre
and open source environment, this includes both its optional
dependencies or production tools and the operating system. We are
asking you to publish the sources of your project under a free culture
license of your choice or release it into the public domain.
Projects that do not meet these criteria will not be considered.
*How to apply*
Submission form and a list of additional requirements are available at:
http://makeart.goto10.org/call/
Deadline: *Saturday 31 July 2010*
Incomplete or late applications will not be processed.
*Timeline*
31st of July 2010 – Deadline call for proposals
Beginning of September – Selected projects notifications
4th-7th of November 10 – make art 2010 - Poitiers (FR)
For examples of previous editions, please visit the archives :
http://makeart.goto10.org/
make art is powered by GOTO10
Digital inputs not reading in arduino/pduino
Hi all..
I've been having troubles reading the digital inputs of an arduino duemilanove (328) using the pduino firmware. I mean having troubles like not reading anything from them at all.
Analog ins and digital outs work fine, but the DI do not want to read anything. I've checked that they are OK (I can effectively read them) with other sketches including the button read example from the arduino website, so there are no hardware issues.
I've tried he latest version of the pduino firmware, and went all the way back to pduino 0.4 with firmata 2.0. I even changed the moocow objects for flatspace as someone hinted somewhere here but to no avail (yes, I'm on windows XP).
I've tried the pduino-help and pduino-test patches included with the download and everything works except the digital input reading.
.. and of course, the digital ports are enabled and the pins' output mode are in 0 (input) and the serial port is set correctly both with the selector and inside the [arduino] object (just in case)
The toggle objects do not change at all in the lower right section of the pduino-test patch. As a matter of fact nothing comes out of any [route digital] object, even if it is directly connected to the [arduino] object
Am I missing something here?
any help would be appreciated
thanks
rick
Firmata on arduino pro mini
Hans,
I just downloaded the http://at.or.at/hans/pd/Pduino-0.5beta3.zip package.
results of my tests:
on the duemilanove Atmel 168 SimpleAnalogFirmata:
quick testing seems ok, but only harwarePWM (no soft pwm on e.g. pin 13) I don't know if this was intended, but in the source it says:
/* Supports as many analog inputs and analog PWM outputs as possible.
So I was hoping for automagic softPWM, but for the rest everything seems fine (I tested PWM digital out)
on the nanopromini I saw some weirdness...
first of all I could not compile firmata for it on linux (32bit) in arduino0017 or at least not upload, so I think it has got to do with the cable I use. which also explains why I cannot send data toç/from linux I guess. On OSX this upload works, and [pd device info] reports firmata-237.220 and also SimpleAnalogFirmata-0.1 This seems ok, but I think it still wrong somewhere.
I I just upload a patch that fades some pins, everything seems ok. With firmata <-> pd the arduino gets hot and operation seems a bit of what to expect.
I'll have to run more tests later.
al I can say for sure is that the problems from the first post (unknown command) remain.
I need to get my scope back or at least a descent multimeter
I'll test some stuff later this week
K
Memory Issues with Leopard and PD-Extended 0.41.4 (Malloc Error)
Hi...
I'm currently looking at PD-Extended 0.41.4 not being able to handle playing back 1920 x 1080 video files. My patch is hyper-simple.... just loading two layers of 1920 x 1080 HD video files... switching videos in and out as they play using a shell command. unfortunately this process needs to continue stably for longer than a few hours (which is all I've got right now).... When I let things run, PD crashes and I get the following error in Console.
8/25/09 1:38:48 PM [0x0-0x18018].org.puredata.pd.wish[271] pd(272,0xa03ce720) malloc: *** mmap(size=4149248) failed (error code=12)
8/25/09 1:38:48 PM [0x0-0x18018].org.puredata.pd.wish[271] *** error: can't allocate region
8/25/09 1:38:48 PM [0x0-0x18018].org.puredata.pd.wish[271] *** set a breakpoint in malloc_error_break to debug
8/25/09 1:38:48 PM [0x0-0x18018].org.puredata.pd.wish[271] terminate called after throwing an instance of 'std::bad_alloc'
Any ideas? Thoughts? I'm not currently on the computer with the patch, but I can post sample content that is causing this crash later.... This is happening on a quad core Intel-Xeon Mac with 4 GB of memory.
Memory allocation and Malloc is an area where I'm less than confident and would great appreciate some insight into why this is going on.... or may be going on.
Thanks!