Jump to content

Unexpected behavior in integer-to-pitch


Recommended Posts

Hi,

   It's likely I'm not fully understanding the integer-to-pitch function in this case, so any help is much appreciated.

I have an arbitrary integer sequence with no repeated elements:
(setf test-seq '(13 80 61 81 74 72 46 64 31 47 77 22 19 69 7 2 26 71 33 73 59 55 3 39 62 5 65 44 38 49 14 4 52 53 66 57 29 21 6 78 35 10 41 88 76 9 28 8 15 17 43 25 58 42 12 67 70 20 82 87 63 18 56 16 30 34 86 50 27 84 24 45 51 40 75 85 37 36 23 32 60 68 83 11 54 79 48 1))

; all the notes on the piano

 

; I can see that the elements are unique:
(equalp (length test-seq) (length (remove-duplicates test-seq)))
t

 

; Here's what I'm failing to understand -- (integer-to-pitch test-seq) should not have any duplicates, but it does:

(sort-asc (integer-to-pitch *my-log-seq* :quantize 1/2))
(cs4 d4 eb4 e4 f4 fs4 g4 gs4 a4 bb4 b4 c5 cs5 d5 eb5 e5 f5 fs5 g5 gs5 a5 bb5 b5 c6 cs6 d6 eb6 e6 f6 fs6 g6 gs6 a6 bb6 b6 c7 cs7 d7 eb7 e7 f7 fs7 g7 gs7 a7 bb7 b7 c8 c8 c8 cs8 cs8 cs8 d8 d8 d8 eb8 eb8 eb8 e8 e8 e8 f8 f8 fs8 fs8 g8 g8 gs8 gs8 gs8 a8 a8 a8 bb8 bb8 bb8 b8 b8 b8 c9 cs9 d9 eb9 e9 f9 fs9 g9)

 

Perhaps I'm not fully understanding integer-to-pitch. Is there a better function I can use to map an integer to a unique pitch?

 

Many Thanks,

Paul Marquardt

 

 

Link to comment
Share on other sites

First, you don't need :quantize here, the values are not frequencies (floats) or ratios.

 

(setf test-seq '(13 80 61 81 74 72 46 64 31 47 77 22 19 69 7 2 26 71 33 73
                 59 55 3 39 62 5 65 44 38 49 14 4 52 53 66 57 29 21 6 78
                 35 10 41 88 76 9 28 8 15 17 43 25 58 42 12 67 70 20 82 87
                 63 18 56 16 30 34 86 50 27 84 24 45 51 40 75 85 37 36 23
                 32 60 68 83 11 54 79 48 1))

 

As you can see many of the values in the sequence are outside the piano range:

 

(ambitus-instrument 'piano)
=> (-39 48)

 

If the integer values fall outside the specified range (default is piano), they will be transposed. If transposition cannot resolve the issue, the values will be inverted.

 

Maybe your values are midi values:

 

(midi-to-pitch test-seq)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy