[Home]

Summary:ASTERISK-04329: [patch] Playtones to allow for midi notes as well as Hz freqs
Reporter:Jason Parker (jparker)Labels:
Date Opened:2005-06-02 23:13:58Date Closed:2008-01-15 15:38:26.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) asterisk-midiindications.patch.txt
( 1) indications-20050602-2035-head.diff
Description:ok, this isn't something that everybody is going to use, and it is more of a novelty then anything, but it'd be very useful for the people who do use it (me, for one).

Here's the way it works now.  You take (up to) two Hz frequencies, along with a length, string a bunch together, and you get a bunch of tones.  440+480/2000,0/4000 for example.

My patch still (of course) allows for the above method, which will be used everywhere, but it also allows for something like - M76+M71/428,M71+M68/214.  M stands for "use midi note for this instance".  The patch will convert the "midi notes" to the proper Hz frequencies in ast_playtones_start().

See http://www.borg.com/~jglatt/tutr/notefreq.htm for more details.

****** ADDITIONAL INFORMATION ******

Disclaimer on file under A.K.A. North Antara.


The old way, after a very tedius conversion (this is my rendition of Tetris - Theme A, in case anybody cares):
659+494/428,494+415/214,523+440/214,587+494/214,659+494/107,587+494/107,
523+440/214,494+415/214,330+440/428,330+440/214,523+440/214,659+523/428,
587+494/214,523+440/214,494+415/214,494+440/214,494+415/214,523+440/214,
587+494/428,659+523/428,523+440/428,330+440/428,330+440/857,0/214,
587+349/428,698+440/214,880+523/214,880+523/107,880+523/107,784+494/214,
698+440/214,659+392/642,523+330/214,659+392/214,659+440/107,659+392/107,
587+349/214,523+330/214,494+415/214,494+330/214,494+415/214,523+440/214,
587+494/214,587+415/214,659+523/214,659+415/214,523+440/214,523+330/214,
440+330/428,440+330/428,0/428,330+262/857,262+220/857,294+247/857,
247+208/857,262+220/857,220+165/857,208+165/857,247+208/428,0/428,
330+262/857,262+220/857,294+247/857,208+165/857,262+220/428,330+262/428,
440+330/857,415+294/857,0/857

The new way, with my patch (same thing as above, except with midi notes instead of Hz):
M76+M71/428,M71+M68/214,M72+M69/214,M74+M71/214,M76+M71/107,M74+M71/107,
M72+M69/214,M71+M68/214,M69+M64/428,M69+M64/214,M72+M69/214,M76+M72/428,
M74+M71/214,M72+M69/214,M71+M68/214,M71+M64/214,M71+M68/214,M72+M69/214,
M74+M71/428,M76+M72/428,M72+M69/428,M69+M64/428,M69+M64/857,0/214,
M74+M65/428,M77+M69/214,M81+M72/214,M81+M72/107,M81+M72/107,M79+M71/214,
M77+M69/214,M76+M67/642,M72+M64/214,M76+M67/214,M76+M69/107,M76+M67/107,
M74+M65/214,M72+M64/214,M71+M68/214,M71+M64/214,M71+M68/214,M72+M69/214,
M74+M71/214,M74+M68/214,M76+M72/214,M76+M68/214,M72+M69/214,M72+M64/214,
M69+M64/428,M69+M64/428,0/428,M64+M60/857,M60+M57/857,M62+M59/857,
M59+M56/857,M60+M57/857,M57+M52/857,M56+M52/857,M59+M56/428,0/428,
M64+M60/857,M60+M57/857,M62+M59/857,M59+M56/857,M60+M57/428,M64+M60/428,
M69+M64/857,M68+M62/857,0/857

To hear the above, I've setup a temporary IAX2 guest account.  IAX2/guest@24.50.66.194/s  This is using the second one with the midi tones.
Comments:By: Michael Jerris (mikej) 2005-06-02 23:18:57

way way too much time on your hands...

By: Gordon JC Pearce (gordonjcp) 2005-06-03 12:05:58

You may also generate lists of note/frequency pairs from Nokia RTTTL ringtones.  Have a look at http://www.gjcp.net/rtttl/NokiaRTTTL-0.3.tar.gz and follow the instructions in the readme

By: Anthony Minessale (anthm) 2005-06-03 16:14:28

neat!

By: Kevin P. Fleming (kpfleming) 2005-06-03 16:25:12

Can you make this happen in res_indications at load time, rather than in ast_playtones_start(), since that requires this floating-point math to be done every time the indication tones are played?

By: Jason Parker (jparker) 2005-06-03 16:53:26

Yeah, I'm taking a look at doing that right now.  There is a case though, where they can do a Playtones(somedata) from the dialplan, and it would still have to parse that at run time.

Any recommendations on that scenario?

By: Anthony Minessale (anthm) 2005-06-03 17:05:13

how bout aliases you can have too that let you predifine chords or notes as a symbol

then use em with X like:

XC#m7+XGmaj+XFmaj

By: Matthew Simpson (matthewsimpson) 2005-06-10 14:13:19

nuts, I just tried to call the demo and wasn't able to get through. :(

By: Jason Parker (jparker) 2005-06-10 14:16:17

Matthew, the demo is gsm only.

Jun 10 12:12:14 NOTICE[31432]: chan_iax2.c:6704 socket_read: Rejected connect attempt from xx.xxx.xxx.xxx, requested/capability 0x4/0xf804 incompatible with our capability 0xf802.

By: James Golovich (jamesgolovich) 2005-06-11 14:10:48

Just uploaded asterisk_midiindications.patch.txt that contains north's patch, but I pre calculated all the midi notes and stuck them in an array.

I love this patch, for the geek in all of us

By: Jason Parker (jparker) 2005-06-11 23:46:06

You know...I was working on something, and I was delaying uploading it, because I suck at string manipulation...your method is probably better then the one I was going with.

I'll verify that the array is correct tomorrow night.  Anybody willing to review this new patch?

James, do you have a disclaimer on file?

By: James Golovich (jamesgolovich) 2005-06-12 00:02:34

The array should be correct based on the code from your patch.  I just through that code in a for loop and had it print it out, a little bit of hand formatting and it was good to go.  I tested it out before and after with the tetris music (awesome btw) and it sounded the same.

Yes I've got a disclaimer on file

By: Jason Parker (jparker) 2005-06-12 01:50:27

I'm definitely satisfied with the latest patch - thank you James.  kpfleming, does this satisfy your recommendation?

Just for fun, I'll add another one (this is the one that is currently running on the demo I've setup).  Anybody care to guess what this one is? :)

M62/269,0/8,M64+M61/269,0/8,M66+M60/269,0/8,M67+M59/269,0/8,M69+M60/269,0/8,
M70+M61/269,0/8,M71+M62/133,0/8,M71+M62/133,0/8,M71+M62/181,0/93,M71+M64/181,
0/93,M71+M65/542,0/144,M67/133,0/8,M76+M67/815,0/8,M75+M66/815,0/8,M76+M67/815,
0/144,M67/133,0/8,M69/133,0/8,M71/133,0/8,M72/133,0/8,M74/133,0/8,M76+M67/815,
0/8,M75+M66/542,0/8,M77+M69/269,0/8,M76+M67/815,0/688,M67/133,0/8,M74+M65/815,
0/8,M73+M64/815,0/8,M74+M65/815,0/144,M67/133,0/8,M69/133,0/8,M71/133,0/8,
M72/133,0/8,M73/133,0/8,M74+M65/815,0/8,M67+M59/542,0/8,M77+M69/269,0/8,
M76+M67/815,0/688,M67/133,0/8,M79+M76/815,0/8,M79+M74/815,0/8,M79+M73/815,
0/8,M79/269,0/8,M81/269,0/144,M79/133,0/8,M77+M74/815,0/8,M77+M73/815,0/8,
M77+M72/815,0/8,M77/269,0/8,M79/269,0/144,M77/133,0/8,M76+M60/815,0/8,
M69+M65/269,0/8,M71+M67/269,0/8,M77+M71/269,0/8,M76+M71/133,0/8,M76+M71/133,
0/8,M76+M71/269,0/144,M71+M65/133,0/8,M72+M64/815,0/8



By: Matthew Simpson (matthewsimpson) 2005-06-16 16:19:21

did you turn off the demo?  :(

By: Matthew Simpson (matthewsimpson) 2005-06-16 16:20:57

the reason your demo is so popular is that everyone in the office here has taken to doing the "838 bomb".  838 is the extension we assigned to dial your demo, so one dials 838 and blind transfers it over to other extensions around the office, or to coworker's cell phones, etc...

mindless fun



By: Mark Spencer (markster) 2005-06-17 10:24:59

Added to CVS head, now all we need is musiconhold in midi format.

By: Michael Jerris (mikej) 2005-06-20 23:09:53

new feature, not in 1.0.

By: Digium Subversion (svnbot) 2008-01-15 15:38:26.000-0600

Repository: asterisk
Revision: 5928

U   trunk/indications.c

------------------------------------------------------------------------
r5928 | markster | 2008-01-15 15:38:26 -0600 (Tue, 15 Jan 2008) | 2 lines

Merge midi changes (bug ASTERISK-4329)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=5928