11

I'm creating a program to output the values of pi as sound. I've seen a few videos and some other representations, and want to try to make my own for fun, except i'm unsure how to proceed.

There are the notes A,B,C,D,E,F, and G.

Unfortunately, there are 10 possible values for a digit, 1,2,3,4,5,6,7,8,9, or 0. I read something about a rule of fifths, but I am unsure how I would map the 10 numbers to sound. I'm not sure if this is the right place to ask this question.

How would you go about mapping a sound to numbers 0-9? I'd like to keep the spread as even as possible, so if every possible sound was on a line, 0-9 would be evenly distributed, if that makes sense.

Sorry if this is in the wrong location.

Josue Espinosa
  • 229
  • 2
  • 6
  • 2
    http://music.stackexchange.com/questions/11923/how-to-algorithmically-find-a-chord-progression-for-an-infinite-arbitrary-melody – leftaroundabout Aug 28 '14 at 21:57
  • 1
    It's pretty irrelevant, but I just had to post this, as I love it: https://m.youtube.com/watch?v=BDMBtQjS1bQ – Bob Broadley Aug 28 '14 at 23:00
  • 8
    I'm rather surprised this got so many upvotes. As both a musician and a mathematician, I'd reject this question for vapidity! If you want to **encode** $\pi$ into tones, then map each digit to a note. If you want to create a piece which is *representative* of $\pi$ , then write something evocative of circles, spheres, and radiuses. – Carl Witthoft Aug 29 '14 at 11:58
  • 3
    I know little of music, but if you have seven notes, just use pi in base 7 mathematically... http://turner.faculty.swau.edu/mathematics/materialslibrary/pi/pibases.html – Mark Aug 29 '14 at 13:12
  • 1
    @CarlWitthoft: I agree. Alternatively, one might use a π/4 time signature, or use intervals with frequency ratio π:3 as the melodic step size. But using the _digits_ of π is basically just like using a random stream of numbers. – leftaroundabout Aug 29 '14 at 14:18
  • Hey @Dave. I think everybody understood what you *meant* with your answer... (Besides, include the octave and you're spot on...) – Bob Broadley Aug 29 '14 at 17:32
  • 1
    @CarlWitthoft Not everyone is a formally trained musician and mathematician. Concepts and dynamics that might come as obvious for some are not so apparent to others. The popularity of this thread, even if it makes you grumpy, suggests that the questions and answers are interesting to many. – NPN328 Aug 29 '14 at 23:36
  • @JCPedroza sure, and at the same time the upvotes on my comment suggest the opposite for many folks as well :-) De Gustibus non disputandum – Carl Witthoft Aug 30 '14 at 15:52
  • 1
    @CarlWitthoft I don't know, they might just share your grupmyness (and since when 4 is "many"?) In any case, that just proves my point, we are a heterogeneous community. That type of diversity is expected and shouldn't come as a surprise. – NPN328 Aug 30 '14 at 17:47
  • possibly relevant: https://www.youtube.com/watch?v=rAUXyOsenhI – Dave Sep 02 '14 at 17:20
  • I'm pretty late so I'll just add a suggestion here: If you want to make it more of an actual song rather than just a series of notes, you can throw some chords in to create a harmony. You can use digits 0-6 for the seven diatonic notes of C Major (C,D,E,F,G,A,B), then 7,8,9 could be chords (I,IV,V being popular choices- 7 would be C Major, 8 would be F Major, 9 would be G Major). You can also use others: Dmin, Emin, or Amin instead would change the flavor.. This way all the notes are in key, and you might find some interesting melodies in there. – charlie Sep 28 '14 at 06:09

11 Answers11

25

One option if you're primarily interested in representing the individual digits of pi is to use a representation in a base other than 10. For example pi base 12 would have an individual digital for each chromatic note.

Here's a website that might help get you started: http://www.virtuescience.com/pi-in-other-bases.html

13

The number 10 doesn't necessarily map well to values in traditional musical theory. (For instance, there are 12 chromatic pitches per octave, using conventional divisions of the octave; diatonic scales have seven pitches; note durations are related as powers or negative powers of 2). So, for this reason, the world is your oyster! I guess you can choose any 10 values to map to the 10 digits.

This does mean that you are unlikely to get a definitive answer (and so some may consider this post to be off-topic), but here are some of my own suggestions for suitable mappings:

  1. Divide an octave by ten (i.e. use 10-TET) although this youtube clip suggests somebody may have beaten you to it…!
  2. Use 10 different chords.
  3. Use 10 different note durations (which could be either related by powers of 2, or as tenths of a particular value).
  4. Use a pair of interlocking pentatonic scales (I like this idea, maybe stereo separated, but it's not my project…)
  5. Use a combination of the ideas above, eg. different frequencies each also have their own related duration (and stereo positioning…)

In the end, I came up with these ideas very quickly, the possibilities are vast, and experimentation is the key.

ADDITIONAL INFO: If you are trying to find the frequencies in 10-TET tuning you would multiply a starting frequency by 2 to the power of n/10, where n is integer values in the range 0-9.

Bob Broadley
  • 21,161
  • 6
  • 67
  • 121
5

Pi can also be expressed through various infinite series. I like François Viète series discovered in 1593:

enter image description here

Square root from 2 is half octave distance. Maybe it is possible to represent the series as some sequence of sounds? Or maybe some other series would fit better? This might reproduce the spirit of Pi even better than replaying its decimal representation.

h22
  • 4,454
  • 6
  • 24
  • 61
4

One Idea I haven't seen mentioned is rhythm. Perhaps you can use some of the spare digits as a change in pace (f.e. switch from eights to quavers). Or you could map the spare digits to pre-conceived rhythmic motives.

Another idea would be to use the digits that are not mapped to a note to switch instrument.

HTH.

Roland Bouman
  • 3,507
  • 17
  • 27
3

Why use base 10? You have to make some compromise somewhere, and since π is already transcendental, there is no rational radix that will accurately represent π. If you use heptary, π ≈ 3.0663651432036134110263402244652226643520650240155443215426431025161154565220002622436103301443233631. These digits map perfectly to the seven pitches in an octave. Using octal would add in either a b3, b7, or #4. Quintary would yield a perfect pentatonic scale.

Fennelouski
  • 131
  • 2
3

If you want to make a nice piece of music (which I presume you do, simply encoding pi would seem a bit wasteful), I'd avoid trying to generate the music mechanically, and instead use pieces of pi as inspiration.

For instance:

  • Writing it in 22/7 (an approximation of pi)
  • Using the first 5 or so digits as a motif in some way, and using the others not as much. You could then have another 50 or so digits as a fast cadenza type section.
  • Using cyclical chord progressions (pi being about circles)
rlms
  • 641
  • 1
  • 7
  • 15
2

An option which no one has really mentioned is to use those extra digits for special purposes (ie Change tempo, another instrument). If the primary instrument is a piano, I'd imagine that simply assigning a digit to the snare, bass and cymbal would add a lot of flair to your final music.

In fact, adding new instruments will open you up to a bunch of new ways to do this. You could let each digit represent an operation. Each operation could represent an instrument, tempo, or effect change, etc... Also, each operation would then read in as many more digits as it needed in order to satisfy it's parameter count. This will allow for your beats to have things like sustain, accent, etc... for your notes.

This will actually make the problem of having more data space than note space even more of a problem except for the fact that it was never really a problem to begin with. Just pad the extra space with the next higher and lower octaves. This will result in a slight imbalance of notes but we don't really want a balance anyway...

Which does lead us to another problem. I think your best bet is to use patterns found in popular music to ensure that your note dispersion is pleasant. I found this site which has the data we'd want for determining that:

enter image description here

Your application will be more likely to sound better when it produces notes with a similar dispersion pattern to this. You may find that some instruments may work vastly differently though so (as with all of this) experimentation will be important.

Once you have this system working, I'd suggest trying to think of another song which it sounds similar to what you have and doing a more exact note dispersion graph which actually matches a song in the same key. Read the page at the link above to see what I mean.

If you wanted to step it up another notch, you'll have the ability to add as many functions as you want. You just need to decide how large an op code is (1,2,3 chars) depending on how many different functions you have and handle them all (even if large blocks of them do the same thing). If you really want this to be a complex symphony, I would suggest that you separate the processing step from the playback step to eliminate any timing issues you'll have due to the variable data rate inherent to such a design. Fortunately, there are standards. One popular standard is called MusicXML. If you make your program to simply generate those files. Then you can later play those files back using a MusicXML player.

Update: If you'd like to see my experiments with this you may get them here.

krowe
  • 137
  • 3
  • `For the most part, instruments will sound better when they use the keys towards the top of the list and less pleasant as they move down it.` More common keys are more pleasant? Do you have a source (or an argument) for that claim? I think you severely misunderstood the data. Those keys are common because they are easier to write, read, and play. It's not that F# is "the most unpleasant key". – NPN328 Aug 29 '14 at 19:54
  • 1
    http://www.hooktheory.com/blog/i-analyzed-the-chords-of-1300-popular-songs-for-patterns-this-is-what-i-found/ It says nothing about "instruments sounding better" in a specific key. It just presents the data as "there is a general trend favoring key signatures with less sharps and flats but this is not universal." – NPN328 Aug 29 '14 at 19:57
  • @JCPedroza You clearly did not actually read the entire article. – krowe Aug 29 '14 at 20:39
  • I did read it entirely, it is a pretty well known article. Where does it claim that keys with more sharps or flats are less pleasant? – NPN328 Aug 29 '14 at 23:31
  • @JCPedroza The 'Smart Instruments' application allows users to basically hit any note and sound like a pro. That is due to the fact that these notes do sound more pleasant. The basic claim of this application is that you just need to get the beat right and and it doesn't matter which of these notes you actually play, you will sound like a pro. Most people find this hard to believe but there it is and you can try the app yourself if you doubt this to be true. – krowe Aug 29 '14 at 23:52
  • 2
    That's not how it works, at all. That's now what the article claims, at all. The Garage Band application (the "smart instruments" app) shows and uses the diatonic chords of the harmony you select, you can select any key. It sounds good because of the diatonicism of the possible chord progressions, not because it is in a specific key. Your understanding of the article is completely broken, distorted, misleading, and completely wrong. You and the article are claiming and talking about very different things. It's evident that you don't know about what you are talking about. – NPN328 Aug 30 '14 at 00:18
  • 2
    I've got to back @JCPedroza up on this one. Unless you have perfect pitch you won't know the difference between C major and Db major when you listen to piece. It's completely wrong to think that this half step accounts for a 20% drop in popularity because C major sounds better. C major is popular because it's all natural notes (i.e. white keys on the piano) which are easier to play and write, especially for people without formal training. Your'e 100% wrong, krowe, in the conclusions you've drawn from this article. –  Aug 31 '14 at 03:56
  • @JCPedroza I'm sorry that it was so hard for you to understand my statement when you pulled it out of context like that. I've fixed it so that no matter how you distort what I'm saying it will hopefully remain fairly obvoius. All I'm trying to do in the portion of my post which you seem to have issue with is give some sample data to build on. In the very next step I tell the OP that he should throw that part out and run an analysis on a particular song to get a better dispersion graph for a particular instrument\key combination. – krowe Aug 31 '14 at 13:32
  • @JCPedroza If you really want me to argue that these are the most pleasant keys then I will just point to the stats. At the end of the day these keys are the most common because they sound better; NOT for the reasons you've given. No one designs a tabulatur which makes the best stuff hardest to read or write and no one designs an instrument which makes the best notes hardest to play. No, they design these things around what IS the best. Do you think composers generally write the song before they play it? Or play it before they imagine it? I suppose it is harder to imagine F# than C? – krowe Aug 31 '14 at 13:33
  • @MarkM In addition to what I've already said, you both seem to be missing the point (and this is probably why you are having trouble with my method). My method relys on nothing but stats. I could care less WHY C is more popular. It doesn't matter in the least for what we are doing here. The fact is that you've both been saying I'm wrong and then going on to show why that doesn't matter without even seeing it for yourselves. – krowe Aug 31 '14 at 13:33
  • 2
    @krowe, fine, but if you don't care WHY a key is more popular why do you keep asserting things like: "At the end of the day these keys are the most common because they sound better." That is a (unsupported) answer to the question WHY the key is more popular that you say you don't care about. –  Sep 01 '14 at 18:59
  • @MarkM See the comment you are referring to. My point was actually that you both taking things out of context. Much as you've done again. Reread what I said, "If you really want me to argue that...". – krowe Sep 01 '14 at 21:04
  • 3
    @krowe - I'm definitely on the side of JC and Mark. Those keys are most common because they are easier to read and write. A lot of instruments were designed around these keys, as early music was Modal and the use of #/b were not common or necessary. Other instruments are transposed and have certain tendencies, such as music written for horns having more b's than #'s. So more Jazz stuff is in flat keys and more rock stuff is in # keys (due to guitars). The piece of your argument (specific to the topic of keys) that is agreeable is that certain keys are more common but I'd say that is all. – Basstickler Sep 02 '14 at 12:49
  • @Basstickler Well I actually wrote both and to be perfectly honest, it really just depends on you definition of pleasant. The version I describe has more of a familiar sound. Parts of it almost sound like something you've heard before. The version I wrote which just substituted notes from other octaves was all over the place. Those highs and lows did give it it's own sound though. If you want, you download it and compile it and decide for yourself: https://github.com/krowe/MidiPi I stopped after I got just that far so it isn't tuned to any specific song or instrument. – krowe Sep 02 '14 at 17:00
  • @krowe Have you studied basic music theory? Reading your replies to us, it seems that you are not even understanding what we are trying to say to you. Your replies are either irrelevant to ours, or make little to no sense. – NPN328 Sep 03 '14 at 02:23
  • @JCPedroza Do you know how I know that you haven't tried the application I've made? Because you aren't apologizing for being wrong yet. It is only you and those who don't listen to the difference this type of note selection makes who don't understand this. – krowe Sep 03 '14 at 19:27
  • @krowe You have no clue of what you are talking about, so it'll be very hard for you to be "right". I recommend you to read some very basic music theory concepts, you'll soon notice how lost you were. It's interesting to see that you think that everyone else is wrong, given your obvious lack of understanding of the subject and concepts. If you really wanted to share your work you'll post links to audio instead of a link to a terribly documented C# code that not everyone knows how to interpret, compile, and run. – NPN328 Sep 04 '14 at 01:07
  • @JCPedroza Hmm, na. That's just no way to ask for a favor. I'm sure the OP is plenty capable of running it. If someone else asks me then maybe but not for you. Plus, I like the fact that no matter what you say there is a certain part of music theory that I clearly understand better than you right now. I did from the start and not only that so does anyone else with half a brain who can run my app. Maybe one day you'll get a better attitude and find a friend smarter than you who can do it or explain it to you. – krowe Sep 04 '14 at 02:31
  • @krowe I know C#, I was not talking about me in particular, but about the average reader. If you want to keep making a fool of yourself, so be it. Just wanted to point out how broken your answer and comments are to people that might be new to music theory and might get confused with this sea of nonsense. You were wrong and made mistakes, it is not a big deal. Not sure why you are taking it personal while hiding in so many layers of willful ignorance and nonsense. You are so lost you think you are not, and so ego filled and delusional that you'll stay there. – NPN328 Sep 04 '14 at 02:49
  • @JCPedroza Really? See you can't play the nice guy when nearly every sentence in your post is insulting and your tone from the beginning of this dialog has been hostile. Everything you've brought up has been off topic and you've only explained things not at all related to what this post is about. – krowe Sep 04 '14 at 03:06
  • @krowe Both your answer and comments are based on (and filled with) misconceptions, mistakes, and ignorance. The corrections are as on topic (and necessary) as it gets. If you are overly sensitive to corrections and peer review, maybe Q&A sites are not the place for you. – NPN328 Sep 04 '14 at 03:17
2

There's no reason you have to stay within one octave. You can use, for instance, C-D-E-F-G-A-B-c-d-e for your digits. So the first five notes are E-C-F-C-G-d, for example This has the advantage of being extremely intuitive to any musician, since you'd just be referring to scale degrees in C major (with 10 being 0). I can personally just sit there and read the notes and play them without thinking about it.

With the minor key you are using, you could also borrow from the major, ala the harmonic minor. Then you could use A-B-C-D-E-F-F#-G-G#-a. This isn't as intuitive, but it produces some interesting effects, without seeming completely chromatic. The first few notes become C-A-D-A-E-G#-B-F-E-C-E G-G#-F#-G#-C-B-C-G-D-F B-F-D-C-C-G-C-B-F#-G#-E-a. That last bit sounds like an actual cadence.

trlkly
  • 723
  • 3
  • 11
1

As a programmer, I love this idea and of course I thought about this as well already but didn't have any time yet to try this out :).

Basically, I believe your line with notes is incorrect. You should start by choosing a key in which you want to write it. I believe your key would be Am, or is it a coincidence? I would work with something like this:

    char notes[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G'};
    String pi = String.valueOf(Math.PI);
        for(int i = 0; i < pi.length(); i++) {
            char currentChar = pi.charAt(i);
            if(currentChar != '.') {//negate the decimal didigt
                System.out.println(currentChar);
                char currentNote = notes[(Integer.parseInt(currentChar + "") - 1) % notes.length];
                System.out.println(currentNote);
            }
        }

Note that this is Java.

EDIT: This code is designed so that if you have a number that is larger than the amount of notes provided, it will start from the first note again. So 8 would be back note 0 (A).

Dave
  • 17,721
  • 8
  • 59
  • 96
1

Other answers have suggested using different bases. For an event in the Physics department, I did play pi in quintal, and there is a video. The sheet was generated using a script and Lilypond.

Bonus: also in octal, but this one is not annotated.

Bob Broadley
  • 21,161
  • 6
  • 67
  • 121
Davidmh
  • 111
  • 3
0

Here's another idea, bizarre even by my standards. For those not familiar w/ the 12-tone composition rule (as originally stated; probably changed many times), it says you cannot repeat any tone until the other 11 have been played. Serially or in chords is allowed.

So here's the "12-tone pi" composition rule: For each digit of pi, you're allowed to skip that many tones in the next 12-cycle. E.g., first cycle only needs 9 (12-3) tones before repeating; the next cycle needs 11 (12-1) tones, and so on.

Bonus points if you can make the piece NOT sound like Webern or Berio :-)

Bob Broadley
  • 21,161
  • 6
  • 67
  • 121
Carl Witthoft
  • 14,656
  • 2
  • 18
  • 41
  • Dudes: downvoting sans reason is considered poor form. Other than perhaps allowing too much interpretability by the composer, what's wrong with this approach? – Carl Witthoft Sep 02 '14 at 14:47