-
Beep or Click?
Is there a way to generate a short beep or click (as in the old OPL command "beep")?
It's for the metronome in my Musician app - it's all very well being able to summon up MID or WAV or MP3 sound files, but the very act of calling them is going to mess up the split second timing of the program.
Surely there's a simple way (or hack) to sound something like the built-in system keyclick noise? Or a simple beep?
Thanks
Steve Litchfield
-
Re: Beep or Click?
[QUOTE=slitchfield]Is there a way to generate a short beep or click (as in the old OPL command "beep")?
[/QUOTE]
"User::Beep" (see SDK documentation), you could add this e.g. to "audio" but you would need to do C/C++ coding.
-
Re: Beep or Click?
Just try playing a short WAV sample with the audio module and see if it's good enough.
-
Re: Beep or Click?
[QUOTE=jplauril]Just try playing a short WAV sample with the audio module and see if it's good enough.[/QUOTE]
After optimising the WAV file and doing all I can in the code, it's just about good enough, together with a fudge factor or two. The beat's still irregular though, I suspect a degree of inefficiency in terms of caching the sound file etc.
A built-in 'click' or beep function would be far more likely to work quick enough, though. No other ideas?
Cheers
Steve Litchfield
-
Re: Beep or Click?
You could try playing the file from the RAM disk (D: ). I don't know if it makes any difference, but it's easy to try.
-
Re: Beep or Click?
[QUOTE=jplauril]You could try playing the file from the RAM disk (D: ). I don't know if it makes any difference, but it's easy to try.[/QUOTE]
Hmm.... e32 is already imported. I use:
file_copy("D:\\metronome.wav","E:\\metronome.wav")
but Python tells me that global name file_copy is not defined. Any ideas? Is this a misprint in the PDF docs?
Steve Litchfield
-
Re: Beep or Click?
If you said "import e32" you need to say e32.file_copy.
-
Re: Beep or Click?
[QUOTE=jplauril]If you said "import e32" you need to say e32.file_copy.[/QUOTE]
Wayhay! Thanks. And playing from RAM disk (D:) make a big difference, I think the metronome's sorted now!
Thanks again
Steve Litchfield
-
Re: Beep or Click?
Hello ,
You can also generate a beep with a midi file !
Korakot has modified a [b]"smidi"[/b] library and showed usage in [b]Snippet PyS60 Generate and play midi on mobile phone.[/b].
links references :
smidi library : [url]http://larndham.net/service/pys60/smidi.py[/url]
Generate and play midi on mobile phone. : [url]http://www.bigbold.com/snippets/posts/show/572[/url]
-
Re: Beep or Click?
[QUOTE=cyke64]Hello , You can also generate a beep with a midi file ![/QUOTE]
Yes, but I suspect there's similar overhead to playing a WAV file. Anyway, the digitised metronome sound is fine from RAM disk and sounds great in Musician 1.5, if I say so myself 8-)
BTW, the tuning notes in the program are MID files....
Steve
-
Re: Beep or Click?
[quote]Is there a way to generate a short beep or click (as in the old OPL command "beep")? [/quote]
Now you can emit a beep with this free library and use it in a next Musician version ;-)
There music.loudest() function and music.tone(freq,duration,volume) function.
You find there source and sis file for you phone. [url]http://csg.csail.mit.edu/IAP06/pyext.zip[/url]
Curious but in my 6600 Nokia phone It doesn't work :-(
-
Re: Beep or Click?
It doesn't work on my 6600 either.
(That's why I haven't written a snippet about it.)
-
Re: Beep or Click?
[QUOTE=cyke64;191249]Now you can emit a beep with this free library and use it in a next Musician version ;-)
There music.loudest() function and music.tone(freq,duration,volume) function.
You find there source and sis file for you phone. [url]http://csg.csail.mit.edu/IAP06/pyext.zip[/url]
Curious but in my 6600 Nokia phone It doesn't work :-([/QUOTE]
has this module been updated in last months?
I'd need to produce some tones at 19000 Hz for very short durations (400 to 2000 microseconds, i.e. 0.4 to 2.0 milliseconds)