• ### Specifying notes and printing info about notes

I am fairly new to prue data and I have been dabbing for the past few hours. I need to learn how to
learn how to write a Pure Data patch that lets the user of my patch
specify a note and then print some information about that note and play that note via MIDI
output.. Any help that can be given is great and if you could direct me to any useful resources that would be great too. I am trying toconvert an octave number and a number of half steps into a hertz frequency.

• Posts 4 | Views 4019
• How do you need the user to specify a note, as a MIDI note or via its name (like Cmiddle or something)?
There's [mtof] in Pd which stands for MIDI to Frequency. You provide a MIDI note (60 for middle C) and it outputs the right frequency of the well-tempered scale based on a 440Hz A.
If you need the user to give names, like A, B, C etc. you could easily map these to notes and use the symbol "middle" or whatever you specify the octave by adding multiples of 12 (just a thought as I'm writing).

• Id like them to specify it as a midi note, how do i

• Let the user use a number box to choose the SPN/ISP/ASPN octave of the note
-Let the user use a number box to choose the number of half-steps above C the note is,
given as an integer restricted to the range 0-11
Let the user click a bang box (after the octave and the half-steps have been set) to then
• Print out the frequency of the note, expressed in Hertz
• Print out the MIDI note number corresponding to that frequency
• Play the note on MIDI channel 1 with a velocity of 100 for 1 second
• I can answer to a few things:
I guess you'll need to use Graph-On-Parent (a.k.a. GOP) in a subpatch or abstraction so that the user only sees a number atom (right-click on an empty part of the patch and tick the Graph-On-Parent tick-box; look up the internet for info on how this works).
To restrict the values setting a maximum value in the number atom won't do as if you type a value beyond the specified range it will go through, so you'll probably need to use [clip] (check its help patch).

To print the frequency of the given midi note you'll either use [print], or send it to an [outlet] and in the parent patch show it in a number atom.
Why print the midi note of the frequency since the note will be provided as midi?
To play a midi note I think you'll need [midiout]. Don't know much about it as I rarely use midi.

Start patching and it will start coming, don't expect someone in this forum to explain your patch step by step.

Posts 4 | Views 4019
Internal error.

Oops! Looks like something went wrong!