Regarding matters where the intent is not for the pleasantness of song, and there is in them neither joy nor mourning nor sensuality, but rather merely to produce a sound—even if the sound is loud, such as the shamash who strikes with a mallet upon the walls to call to the beit knesset, or one who strikes with a forceful object upon the bimah and the like, and even if it rings like a bell, which has some pleasantness like the bells on a Sefer Torah and on the parokhet or the bells on a door as I have written—since the intent is not for the sake of pleasantness but merely to produce a sound, this is not a matter to forbid on account of a musical instrument. And so too those who play with nuts, where one nut strikes the second nut, even though it produces a sound, it is nothing (Gemara), and only on the ground is it forbidden on account of leveling pits, as will be explained. Therefore, it is permitted to set up from Erev Shabbat a device that rings for the hours, which they call a "zeiger," which they arrange and prepare while it is still day by means of a weight so that it will ring every hour throughout the day of Shabbat, for this is not the sound of a musical instrument, as the intent is not for the sake of pleasantness but rather to know and hear what hour it is now. Therefore, even though it rings pleasantly, it is permitted, and it is all for the reason that has been explained: since the intent is not for song but merely to produce a sound. And there is one who wishes to forbid this for some reason, but it is not the primary view (see Taz, subsection 2); our teacher, the Beit Yosef, ruled accordingly in section 3, see there. And it is implied from this that to set up a musical instrument from Erev Shabbat so that it will play by itself on Shabbat is also forbidden, and this stands to reason, for since the prohibition is lest one repair a musical instrument, if so, what does it matter to me if it plays by his hand or by itself? Ultimately, there is a concern that when he sees it is not playing well, he will repair it (and to set it up on Shabbat is forbidden on account of repairing a vessel).
ובדברים שאין הכונה לנעימות השיר, ואין בהם לא שמחה ולא אבל ולא עגבים אלא להשמיע קול בעלמא, אפילו הקול חזק כמו השמש המקשקש בקורנס על הכתלים לקרא לבית הכנסת או שמכה בדבר חזק על הבימה וכיוצא בזה, ואפילו אם מקשקש כמו זוג, שיש בזה איזה נעימות כמו הזגין שבספר תורה ובפרוכת או הזגין שעל הדלת כמו שכתבתי, כיון שאין הכונה בשביל נעימות אלא להשמיע קול בעלמא - אין זה ענין לאסור משום כלי שיר. וכן המשחקים באגוזים, שאגוז זה יכה אגוז השני, אף על גב שמשמיע קול - אין זה כלום (גמרא), ורק בקרקע - אסור משום אשוויי גומות כמו שיתבאר. ולכן מותר להעמיד מערב שבת כלי המקשקש לשעות שקורין זייגע"ר, שמערכים ומכינים אותו מבעוד יום על ידי משקולת שיקשקש בכל שעה כל יום השבת, דאין זה קול כלי שיר, דאין הכוונה משום הנעימות אלא כדי לידע ולשמוע איזה שעה כעת, ולכן אף שמקשקש בנעימות – מותר, והכל מטעם שנתבאר, כיון שאין הכונה לשיר אלא להשמיע קול בעלמא. ויש מי שרוצה לאסור בזה מאיזה טעם, ואינו עיקר (עיין ט"ז סק"ב), כן פסק רבינו הב"י בסעיף ג' ע"ש. ומשמע מזה דלהעמיד כלי שיר מערב שבת שישיר מעצמו בשבת - גם כן אסור, והכי מסתברא, דכיון דהאיסור הוא שמא יתקן כלי שיר, אם כן מה לי אם מנגן על ידו או מעצמו, סוף סוף יש חשש כשיראה שאינו מנגן יפה יתקננו (ולהעמידו בשבת אסור משום מתקן מנא).