# Code for a Bell Tone

How would I make the Nyquist Code for a bell tone? Like the kind on an old fashioned phone, such as the one in this attachment? I wonder if it would be the same as generating a fire alarm tone, like this attachment?

The jetway alarm is a bit like banging on a bowl. It has a dominant tone, generally the resonance of the bowl with additional tones coming from different dimensions since it’s not perfectly spherical.

The telephone tone is two different metal bells and one alternating clapper. The intent was to make a dissonance recognizable and difficult to ignore. It worked. I don’t think many people have ever slept through a ringing deskset.

As a side note, the 48 volt battery (51v at my house) would leap up to 70 volts AC during ring. It is not prudent to be holding the two wires during a ring.

My analysis has the two tones at 1255 Hz and 3281 Hz (at least that phone). That would make sense because they’re odd harmonics and 3281 is the same pitch as the more modern tone called “baby screaming on a jet.”

I don’t know if there is anything magic about the tone repetition. Probably. They analyzed everything down to the colors. The trick is to get all the additional sloppy sounds in there.

I don’t know about generating that with Nyquist. That’s a lot of sloppy resonances and sympathetic vibrations. At least one of those tones is the sound of banging on the rotary dial. The cartoon version of a ringing phone has the phone vibrating off the table until someone answered it. It’s not that vigorous, but the whole phone body got into the act.

Koz

A simplified approximation, based on the peaks in the spectrum of the “Telephone Bell Ring 2.mp3” file:

``````(abs-env
(let ((env1 (pwlv 1 0.9 1 1 0 2 0))
(env2 (pwev 1 1 1 2 0.01)))
(mult
(sum 0.7
(mult -0.3 env1
(stretch-abs 2.0 (hzosc 19.6 *saw-table*))))
env2
(stretch-abs 2.0
(sim
(mult (db-to-linear -22) (hzosc 1250))
(mult (db-to-linear -15) (hzosc 3290))
(mult (db-to-linear -26) (hzosc 5890))
(mult (db-to-linear -23) (hzosc 9000))
(mult (db-to-linear -20) (hzosc 12500)))))))
``````

Banging on a bowl? I’m confused! Would the same tone be generated from this attachment?

I can’t listen right this second.

I was just making the point that the jetway bell is almost certainly one single bell and the telephone was intentionally designed to be two. So any code would have to take that into consideration.

Koz

A quick word on how to apply that Nyquist post?

Would this be a good time to find out what the actual job is? Is this a sound production you can copy and paste an actual phone bell clip instead of generating it from scratch?

Because of the inter-dependencies and odd resonances, I don’t think this is going to be a simple job—at least not likely to give a realistic answer.

That super-simple sound clip I posted is just whipping back and forth between the two dominant tones. Real bells would have a strike attack as the clapper hits and a decay until the next hit, alternating with the strike and decay and odd harmonics of the other bell. That’s why a phone sounds like a phone. If you’ve ever heard a phone with one of the two bells broken or disabled, it sounds most strange.

But this is me watching.

Koz

I tried putting all that in the Nyquist Generate Prompt, but there’s only room for 10 lines of code. What do I do next?

Which version of Audacity are you using, and what operating system?

I had a different problem. I’m in Audacity 2.1.3. Nyquist Prompt is not available with a blank window, and the code seems to do nothing if I apply it to one minute of silence.

I kind of follow the code, but what is expected?

Koz

It generates a 2 second “ringing bell” type sound.

Audacity 2.1.3 with Windows 7 64 Bit.

It generates a 2 second “ringing bell” type sound.

How do you expect that to play, given neither of us could get it to work?

I don’t seem to have Generate > Nyquist. If I give the appearance of being clue-free, it’s only because I am. And no, I don’t think it’s a code problem.

Koz

@ Annabelle3985
The Nyquist Prompt effect in Audacity 2.1.3 allows more than 10 lines.
When more than 10 lines are entered, a scroll bar appears.

It should be possible to just copy and paste the code from the forum into the Nyquist Prompt text box, though I have just discovered that there are problems copying the text in Firefox, Chrome and Microsoft Edge. Internet Explorer appears to be OK in this respect.

The Nyquist Prompt has been written as a “process” type effect (aka an “Effect”), which is why it appears in the “Effect” menu.
Ideally, it should be a “Tool / Utility” type effect, but Audacity does not have a menu for that, so we are stuck with it as a “process” effect, even though it can work as a process (Effect), Generate, or Analyze type effect. A consequence of this is that there must be an audio selection before you can access the Nyquist Prompt.

Once the Nyquist Prompt is open, then it can produce any type (process, generate or analyze) of effect. In this case, the Nyquist Prompt produces a “generate” type of effect.

If Nyquist code does not behave as expected, the first thing to do is to run it with the “Debug” button and see if any errors are reported.
Nyquist error messages can be difficult to interpret - that’s one reason for having this forum board.

Illegal characters galore after pasting into the Nyquist prompt. Tried with the latest Chrome, Vivaldi 1.8.770.56 and the most recent Safari for Mavericks. All the same.

Telephone code working for me : Iron browser, Audacity 2.1.3, on Windows Vista …

On Mac?

I’ve also noticed multiple problems with copy and paste on Windows and Linux: https://forum.audacityteam.org/t/copy-from-code-text/45539/1
Nyquist code needs to be plain ASCII text. If a browser substitutes some other character encoding, the script won’t work (illegal character errors).