(34C) Musical Notes (Original by J.M. Bowsher)
|
02-09-2019, 12:11 PM
(This post was last modified: 02-09-2019 12:12 PM by Hans Brueggemann.)
Post: #1
|
|||
|
|||
(34C) Musical Notes (Original by J.M. Bowsher)
one of my favourite programs for the HP-34C is the "Calculator Program For Musical Notes", originally written for the HP-29C by J.M. Bowsher, published in the "Journal of The Audio Engineering Society", 1980 June, Volume 28, Number 6, Page 437.
the program lets you convert tonal frequencies into their corresponding musical notation and vice versa, by simply entering either the frequency in Hz or a musical notation in the form of an integer number that represents the notation in the following way: Code:
this is the transcript of Bowsher's program for the HP-34C: Code:
enjoy! |
|||
02-10-2019, 01:26 PM
Post: #2
|
|||
|
|||
RE: (34C) Musical Notes (Original by J.M. Bowsher)
(02-09-2019 12:11 PM)Hans Brueggemann Wrote: the program lets you convert tonal frequencies into their corresponding musical notation and vice versa, by simply entering either the frequency in Hz or a musical notation in the form of an integer number that represents the notation in the following way: Fine. But how does it work? There are no instructions. How does the program determine which way the conversion between tone and frequency is done? Could you please explain how the program is supposed to be used, and maybe you can also give some examples. I also wonder what all the constants in the program are for. Can you say a bit about the way the program works? I have tried a similar conversion in Excel, and here only a single reference frequency is required. Dieter |
|||
02-10-2019, 03:28 PM
Post: #3
|
|||
|
|||
RE: (34C) Musical Notes (Original by J.M. Bowsher)
(02-10-2019 01:26 PM)Dieter Wrote: Fine. But how does it work? There are no instructions. How does the program determine which way the conversion between tone and frequency is done?Input smaller than 11.9495 is considered a musical notation. A frequency higher than 16264 is considered invalid. Quote:Could you please explain how the program is supposed to be used, and maybe you can also give some examples. Examples: 441 A 9.404 R/S 441.0 Quote:I also wonder what all the constants in the program are for. \(15.88609958 = \frac{440}{2^\frac{115}{24}}\) Quote:Can you say a bit about the way the program works? These two programs for the HP-42S may miss the fancy output but are probably easier to follow. Frequency → Note Code: 00 { 30-Byte Prgm } Examples: 450 XEQ "F→N" y: 4.00 x: 9.39 A4 + 39¢ 4698.63 XEQ "F→N" y: 8.00 x: 2.00 D8 Note → Frequency Code: 00 { 27-Byte Prgm } Example: G6 6 ENTER 7 XEQ "N→F" x: 1567.98 Cheers Thomas |
|||
02-10-2019, 04:37 PM
(This post was last modified: 02-10-2019 07:57 PM by Dieter.)
Post: #4
|
|||
|
|||
RE: (34C) Musical Notes (Original by J.M. Bowsher)
(02-10-2019 03:28 PM)Thomas Klemm Wrote: Input smaller than 11.9495 is considered a musical notation. OK, but the 34C has two label keys A and B so that this kind of trick is not required. (02-10-2019 03:28 PM)Thomas Klemm Wrote: \(15.88609958 = \frac{440}{2^\frac{115}{24}}\) I now have a program for the HP67 that is based on a slightly different constant and returns the output in the same way as the original program. Both conversions fit into not much more than 67 steps. 450 [A] => 9,439 4698,63 [A] => 2,800 7,6 [B] => 1568,0 Changing the input/output the way you did allows even more compact code, as you have shown. I think it even makes more sense to have the octave and then the tone plus cents. So instead of 9,439 I think that 4 and 9,39 are more intuitive. Edit: Here is an HP-34C version of your program. Since there is no two-line display the octave is displayed with "PAUSE". In either case the octave is returned/entered in Y and the note in X. Code: 001 LBL A 450 [A] => "4" 9,39 6 [ENTER] 7 [B] => 1568,0 Dieter |
|||
02-10-2019, 06:15 PM
Post: #5
|
|||
|
|||
RE: (34C) Musical Notes (Original by J.M. Bowsher)
We could also use 55 with 1.75 instead of 440 with 4.75.
Which makes it a bit shorter. Or then only use: \(16.3515978313=\frac{440}{2^{4.75}}\) Similar to the original program. I must admit that I still don't really understand why it shifts by an additional 50¢. Interestingly a search for just 15.88609958 using Google brings up a link to JAES Volume 28 Issue 6; June 1980. This is in accordance with: (02-09-2019 12:11 PM)Hans Brueggemann Wrote: published in the "Journal of The Audio Engineering Society", 1980 June, Volume 28, Number 6, Page 437. But unfortunately that paper is hidden behind a paywall: Quote:This paper costs $33 for non-members and is free for AES members and E-Library subscribers. Cheers Thomas |
|||
02-11-2019, 07:49 PM
(This post was last modified: 02-11-2019 07:52 PM by Dieter.)
Post: #6
|
|||
|
|||
RE: (34C) Musical Notes (Original by J.M. Bowsher)
(02-10-2019 06:15 PM)Thomas Klemm Wrote: We could also use 55 with 1.75 instead of 440 with 4.75. That's what I used for the mentioned HP67 program: 55/4 · √√2. (02-10-2019 06:15 PM)Thomas Klemm Wrote: I must admit that I still don't really understand why it shifts by an additional 50¢. Take a look at line 67 and 121 ff. respectively of the original program. This seems to add or subtract 50 cents. Other calculations still remain unclear to me. For instance line 017 ff. Here a tiny value of 1E–15 is added. ?!? Then both the sum and its absolute value are stored separately. Can this be negative at all? Later both (073 ff.) values are divided, so this returns the sign of that number. And there is a second occurence of a sign calculation starting at line 127. What is the purpose of that? I also wonder why line 084 ff. calculate ex · ln 2 instead of a simple 2x. Maybe Hans can shed some light on this. Dieter |
|||
02-11-2019, 10:26 PM
Post: #7
|
|||
|
|||
RE: (34C) Musical Notes (Original by J.M. Bowsher)
(02-11-2019 07:49 PM)Dieter Wrote: That's what I used for the mentioned HP67 program: 55/4 · √√2. With the HP-42S using this expression is one byte smaller: \(\frac{55}{\sqrt{\sqrt{128}}}\) Code: 00 { 12-Byte Prgm } Code: 00 { 11-Byte Prgm } This leads to the following programs: Code: 00 { 30-Byte Prgm } Code: 00 { 27-Byte Prgm } Or then you simply store that value in a register: 55 ENTER 128 SQRT SQRT ÷ STO 00 16.3515978313 And end up with: Code: 00 { 22-Byte Prgm } Code: 00 { 19-Byte Prgm } Quote:Take a look at line 67 and 121 ff. respectively of the original program. This seems to add or subtract 50 cents. This led me to the definition of the constant 15.88609958 in the first place. Still I don't grok the benefit of doing it. Quote:Maybe Hans can shed some light on this. 1+ Cheers Thomas |
|||
02-11-2019, 11:04 PM
Post: #8
|
|||
|
|||
RE: (34C) Musical Notes (Original by J.M. Bowsher)
If we don't care about using registers we can use the exponential regression model with:
EXPF CLΣ 55 ENTER 1.75 Σ+ 440 ENTER 4.75 Σ+ And then let the forecast functions do the heavy lifting: Code: 00 { 16-Byte Prgm } Code: 00 { 14-Byte Prgm } Cheers Thomas |
|||
02-13-2019, 10:28 PM
Post: #9
|
|||
|
|||
RE: (34C) Musical Notes (Original by J.M. Bowsher)
(02-11-2019 10:26 PM)Thomas Klemm Wrote: Still I don't grok the benefit of doing it. For those of you who want to give the HP-29C a try here's the original program: Data Code: 00: 1200 Program Code: 01: 15 13 00 : LBL 0 Examples Code: 440 9.400 (A4 exactly) Thanks to the examples I understand now that the difference in cents to a pure note must be between –50¢ and 50¢. A negative value is indicated by a negative sign. Though I can see that this is a reasonable convention I'm still not convinced to enter the data in this peculiar way. Furthermore I get -9.400 for the 440Hz of the first example. Quote:We are left with the problem of displaying the number of cents by which the note is sharper or flatter than the nominal note of the scale. It would be most elegant to use the exponential part of the display to carry this information. The author has studied this problem but has concluded, regretfully, that this is impossible to execute on a reasonably simple calculator, as a great number of steps are required to handle the computations. Thus we are forced to use the next two digits of the display to handle the number of cents. The real problem is to distinguish for instance B0 + 23¢ from C#1 + 24¢. Both entries 11.0e23 and 1.1e24 lead to the same number: 1.1 24 Cheers Thomas |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)