Midi to hz, and hz to midi formulas
well, to contribute to the vile institution of equal temperament then:
in the first equation the input has 69 subtracted from it. This is in order to get the semitones difference between the input note and 69, which is the a above middle c, (the standard is that this note has a frequency of 440). Then this is divided by 12 in order to get the number of octaves that the input is different from a440 (linearly). 2 is then raised to this power.
The reason for this is that if 2 were raised to the 1st power, 1 octave would be traversed upward. similarly, if 2 were raised to the -1 power the octave would be traversed down, because 2^-1 = 0.5, which is a frequency of the octave below.
And because the midi note 69 was the reference point, what is being determined is the ratio of the frequency difference between the input and a440. Therefore, once we know the frequency ratio between the input note and midi note number 69, it is multiplied by 440 in order to get the result
the next formula is this one in inverse:
The input frequency is divided by 440 to get the frequency ratio between the input and 440. Then log2 is taken of it, which is the power that 2 needs to be raised by in order to get the ratio. So this will be the number of octaves difference between the 2 notes.
The number is multiplied by 12 to convert to 1/2 steps, and then 69 is added to get back up to the note a above middle c because 440 was the reference point in the beginning
@dangrondang out of curiosity, do you have any references for the accepted value of pi being wrong? for all of the talk about the sanctity of mathematics this other value does not seem to agree with mathematical principles relating to series convergence formulas for pi. A simple one of these formulas is the Leibniz one. There is a proof of it on the page also
Regarding your putrid opinion on equal temperament, I would also be curious how you would modulate freely between keys on a keyboard instrument. Are you advocating for well-temperament? a system of pythagorean tuning with movable root? The reason equal temperament exists is mainly to create a system where all keys sound the same. Much of music by the mid-1800s e.g. Beethoven was already freely modulating to far away keys and that does NOT sound very good in pythagorean or even simple well temperament (although certain keyboards in the day had many "versions" of notes and scales)
edit: didn't realize this was such an old topic! oh well, perhaps useful still
Loading patches on the fly
How does one change an object on the fly? E.g. I have effect1_patch~ as an object, but I want to change it to effect2_patch~ , effect99_patch~, or any arbitrary patch in order to switch between my library of effects during performance (without hard coding each effect into the main program).
So I am making a live performance setup.
The pipeline I have set up now within my main PD program is: read mic/midi --> effects --> looper --> mixer --> out
The problem is I have a lot of different effects patches already and plan to have many more. The ideal would be that my effects program takes a midi input and dynamically loads a corresponding patch. I know how to handle the midi input, but is there an easy way to do dynamic loading of patches i.e. changing the patch a PD object refers to on the fly?
Thanks for your help!!
"audio i/o stuck"
For each program that is using the ASIO drivers, an ASIO control panel will pop up in the system tray (you might need to adjust your system tray preferences). Each panel controls an instance of the ASIO drivers for that program. You can open that panel and set the inputs and outputs you want to use for that instance.
I said in the above post that ASIO can connect to one program at a time....but that isn't the full explanation. Each ASIO instance can connect 1 program to the same hardware inputs and outputs at a time.
So if you had a soundcard that had 4 outputs, you can setup 2 programs to use the ASIO drivers, one instance goes to output1 and output2, and the other instance can go to output3 and output4.
Getting your sound program running through ASIO (that's by default connected to all inputs and outputs) and getting sound from the browser (Firefox? Chrome? IE?)
is tricky. The browser doesn't use ASIO, it's using the default windows sound driver to access the soundcard. Try loading the browser first then load PD with ASIO or vica versa.
I've only been able to get a consistent working setup by having multiple (2 or more) soundcards. Windows controls one (browser sound, programs that don't use ASIO) and ASIO drivers control the other (PD, tracktor, cubase, FLstudio, etc). Route the sound output from both cards into an external mixer, and the mixer controls the main speakers (or monitors)
I conceptualized this the other day. The main reason I wanted to make this is because I'm a little tired of complicated ableton live. I wanted to just be able to right click parameters and tell them to follow midi tracks.
The big feature in this abstract is a "Midi CC Module Window" That contains an unlimited (or potentially very large)number of Midi CC Envelope Modules. In each Midi CC Envelope Module are Midi CC Envelope Clips. These clips hold a waveform that is plotted on a tempo divided graph. The waveform is played in a loop and synced to the tempo according to how long the loop is. Only one clip can be playing per module. If a parameter is right clicked, you can choose "Follow Midi CC Envelope Module 1" and the parameter will then be following the envelope that is looping in "Midi CC Envelope Module 1".
Midi note clips function in the same way. Every instrument will be able to select one Midi Notes Module. If you right clicked "Instrument Module 2" in the "Instrument Module Window" and selected "Midi input from Midi Notes Module 1", then the notes coming out of "Midi Notes Module 1" would be playing through the single virtual instrument you placed in "Instrument Module 2".
If you want the sound to come out of your speakers, then navigate to the "Bus" window. Select "Instrument Module 2" with a drop-down check off menu by right-clicking "Inputs". While still in the "Bus" window look at the "Output" window and check the box that says "Audio Output". Now the sound is coming through your speakers. Check off more Instrument Modules or Audio Track Modules to get more sound coming through the same bus.
Turn the "Aux" on to put all audio through effects.
Work in "Bounce" by selecting inputs like "Input Module 3" by right clicking and checking off Input Modules. Then press record and stop. Copy and paste your clip to an Audio Track Module, the "Sampler" or a Side Chain Audio Track Module.
Work in "Master Bounce" to produce audio clips by recording whatever is coming through the system for everyone to hear.
Chop and screw your audio in the sampler with highlight and right click processing effects. Glue your sample together and put it in an Audio Track Module or a Side Chain Audio Track Module.
Use the "Threshold Setter" to perform long linear modulation. Right click any parameter and select "Adjust to Threshold". The parameter will then adjust its minimum and maximum values over the length of time described in the "Threshold Setter".
The "Execution Engine" is used to make sure all changes happen in sync with the music.
IE>If you selected a subdivision of 2, and a length of 2, then it would take four quarter beats(starting from the next quarter beat) for the change to take place. So if you're somewhere in the a (1e+a) then you will have to wait for 2, 3, 4, 5, to pass and your change would happen on 6.
IE>If you selected a subdivision of 1 and a length of 3, you would have to wait 12 beats starting on the next quater beat.
IE>If you selected a subdivision of 8 and a length of 3, you would have to wait one and a half quarter beats starting on the next 8th note.
I am trying to figure out midi routing in PD. However (1)in the help the midiin and midiout objects show as 'not documented' and (2) inthe midi setup, it only allows for 4 inputs and 2 outputs. I am trying to setup up routing between input and output ports across 4 MidiSport 8x8 units so I have a total of 32 inputs and 32 outputs in these units alone.
Can someone give me some guidance as to how to connect midi input to midi output and also how to extend the inputs and outputs
Learn Pure Data in NYC!
JOIN US FOR A 4-week long class in Pure Data!
Class Description: Pure data is a real-time graphical programming environment for audio, video, and graphical processing. It is the third major branch of the family of patcher programming languages known as Max (MAX/MSP/Jitter). PURE DATA can offer artists a wide variety of possibilities, such as real-time manipulation of digital video and audio, as well as creation of physical interactive environments using sensor technologies.
This class will teach the basics of programming with Pure Data and then move into techniques for audio visual manipulation. For those not familiar with the program, we encourage you to sign up. No previous programming experience is required!
WHEN: Mondays and Wednesdays, starting July 25th ending Aug. 17. Evenings 7-9pm
WHERE: Outpost Artists Resources in Bushwick, 1665 Norman St. off the Halsey stop on the L-train. Between
To reserve your spot in the class call 718-599-2385 or email firstname.lastname@example.org
Reading multiplexed input streams from arduino
I'm currently building something with an arduino and pd. Arduino vets- help is appreciated!
So, I'm using [comport] and [convert.ascii2pd] to read inputs from an arduino. I'm not using pduino, firmata, etc. because I'm multiplexing the input.
I have a multiplexer read 8 potentiometers going into 1 analog input on my arduino. So I rapidly read all 8 of the inputs in a loop and print them out over serial.
My problem is I don't know how to take this stream and put it to an array properly. Out of [comport] to [convert.ascii2pd] to printing the results looks like this:
I'm seperating the values with special characters, which can be weeded out with [route] if need be. I have the end of each 8 input read banging.
But it's late and my head is reeling. Not sure where to start next in terms of putting these properly in a list or an array. The end goal being that I have 8 potentiometers that can control things in pure data. Any way to make sense of this input?
The things we do for more inputs!
Software Design Patterns for programming Pure Data
It is a topic worth discussing. In my experience most people programming in PD do not have a software engineering background and end up doing a lot of things that are frowned upon by software engineers, eg: unmaintainable copy-past code, always starting from scratch, monolithic code.
A the end of they day though we shouldn't just apply higher level SE principals just for the sake of it, it should be done to help us be more productive and efficient in writing our code. One thing that I've personally found useful is decoupling programing interface from implementation code. Basically I'll create an abstraction with an expected number of arguments and certain inlets and outlets for a doing a job and then several different abstractions for doing that job. As an example I'll create a compressor abstraction that is instantiated like this:
[compressor name ratio threshold attack release]
The guts of this object would look like this:
[$1Compressor $2 $3 $4 $5]
So in order to work there must exist in PD's path an patch called nameCompressor.pd. This patch would then hold the implementation details for a particular kind of compressor. The advantage of coding like this is that it allows your code to be modular. I can have a few different algorithms (linear, non-linear, with or without antialiasing, etc) but since the patches deal with them through the compressor abstraction it becomes very easy to plug them in and out of my existing projects without breaking anything. It also forces me to develop any future compression patch to work with this interface for the same reason, ease of using it with my existing projects.
The example I gave here is pretty trivial. When we start dealing with varied controllers (midi, keyboard/pointer, osc, netsend) the advantages become more obvious. You can create a new instrument (synthesizer, sampler, etc) and easily change the controlling device without having to directly change the code of the instrument itself precisely because the code that handles the input from the controller is decoupled from the patch that is using that input.
Having trouble getting s-abstractions to load
This is a strange problem because I have loaded libraries and things with the 'Paths' dialog under the file menu before and had no problems.
I am trying to get Chris McCormick's s-abstractions to load. The folder is in the same folder as my other libraries and it is listed in both the "paths" and "startup" areas. It wasn't before but I added it.
I am running windows 7 64 bit. Another oddity that I noticed is that in my Program Files (x86) which is where the 64 bit programs live, I have pd installed and the folder is simply called pd. However in the Program Files folder (missing the x86, where the non-64 bit programs live) I have a folder called "Pd-0.42.5-extended"
I wonder if that couldn't be the problem. The s-abstractions folder is included in both though...
Hopefully somebody has some idea about this...
Use with Gakken SX150
I am considering getting a Gakken SX150 ( http://www.makershed.com/ProductDetails.asp?ProductCode=MKGK8 ), and want to make it into a MIDI controller. However, I do not have much money and would not like to spend money on hardware mods. I came across this program ( http://cmpercussion.blogspot.com/2008/08/theremin-to-midi-control-program-in-pd.html ) for use with Theremins, when I was researching Theremins, and was wondering if it could be used with a Gakken SX150. Would I need to keep it on a clean tone? If I needed to modify this program, how extensively and how much knowledge of pd would I need? And finally, would it still work if I decided to add a ribbon controller to the Gakken, like this http://www.coagula.org/content/pages/gakken-sx-150-hacking-controller-tutorial ?