Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 07:43 14 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : TONE command on MicroMite ?

Author Message
f1fco

Senior Member

Joined: 18/03/2012
Location: France
Posts: 154
Posted: 04:37am 29 Aug 2015
Copy link to clipboard 
Print this post

hello,
TONE command exist on Maximite software
output is a "pure" sinus

I make DTMF tones : 2 simultaneous frequencies (not exactly the same level : I mix the right and left level in a 10Koms potentiometer)
combination of frequencies 697, 770, 852, 941 and 1209, 1336, 1447, 1633 Hz

is it possible to have the same function on the Micromite ?
the PWM command is a square wave

a CFunction perhaps ?

or make a "strong" filter for the square wave ? what components ?

thank you for help

Pierre
73s de F1FCO
 
f1fco

Senior Member

Joined: 18/03/2012
Location: France
Posts: 154
Posted: 04:38am 29 Aug 2015
Copy link to clipboard 
Print this post

what is the "precision" in frequency with PWM command ?
with TONE command, 1 Hz is possible (on the DTMF frequencies)

73s de F1FCO
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 05:05am 29 Aug 2015
Copy link to clipboard 
Print this post

Yes, the TONE command is not in the Micromite and I doubt that a CFunction could be used to replicate the function.

It may be something that could be added to the firmware but it will take some research. At the least it would share the same output pins as PWM 1A and 1B.

Does anyone else have a need for this function? Is it an urgent need?

Geoff
Geoff Graham - http://geoffg.net
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 05:39am 29 Aug 2015
Copy link to clipboard 
Print this post

TONE (or BEEP) with as many of the following parameters: Freq, Duration, Volume; this would be a 'nice to have' for my requirements
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
cosmic frog
Senior Member

Joined: 09/02/2012
Location: United Kingdom
Posts: 278
Posted: 06:53am 29 Aug 2015
Copy link to clipboard 
Print this post

Yes Tone with volume would be great!
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 06:58am 29 Aug 2015
Copy link to clipboard 
Print this post

Slight modification based upon what used to be common on 80's home computers:

TONE channel,freq,duration,volume

I know the MM+ is NOT a home computer - just suggesting this for consideration if ever Geoff does implement a TONE type command.

In the above, Channel represents Left, Right or Both (i.e. stereo).
With this command it was possible to create some great music for integrating into programs (not quite polyphonic, but certainly better than just a standard 'beep'.

WW


For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
Justplayin

Guru

Joined: 31/01/2014
Location: United States
Posts: 311
Posted: 08:30am 29 Aug 2015
Copy link to clipboard 
Print this post

Yes! Being able to output even some simple sounds would be great. I have been thinking about building a MicroMite powered "pill-minder" to remind my mother to take her various medications on time.


--Curtis
I am not a Mad Scientist...  It makes me happy inventing new ways to take over the world!!
 
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 09:58am 29 Aug 2015
Copy link to clipboard 
Print this post

PWM is very usefull for audio output.
(As implied by initial post)

Edited by hitsware 2015-08-30
 
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 10:04am 29 Aug 2015
Copy link to clipboard 
Print this post

  WhiteWizzard said   Slight modification based upon what used to be common on 80's home computers:

TONE channel,freq,duration,volume

I know the MM+ is NOT a home computer - just suggesting this for consideration if ever Geoff does implement a TONE type command.

In the above, Channel represents Left, Right or Both (i.e. stereo).
With this command it was possible to create some great music for integrating into programs (not quite polyphonic, but certainly better than just a standard 'beep'.

WW


That 'TONE' was usually a squarewave...
 
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 10:06am 29 Aug 2015
Copy link to clipboard 
Print this post

  Geoffg said   Yes, the TONE command is not in the Micromite and I doubt that a CFunction could be used to replicate the function.

It may be something that could be added to the firmware but it will take some research. At the least it would share the same output pins as PWM 1A and 1B.

Does anyone else have a need for this function? Is it an urgent need?

Geoff

No urgency at all, but it's nice the way TONE will sweep so smoothly .
 
Chris Roper
Senior Member

Joined: 19/05/2015
Location: South Africa
Posts: 280
Posted: 10:34am 29 Aug 2015
Copy link to clipboard 
Print this post

Here is a Program I wrote a couple of years ago on the Original MicroMite on the MX150 Chip, it should work on the MM Mk2 as well.

It scans a 1 Octave Keyboard and outputs 2 Tones on the 2 PWM Channels.
I was emulating an electric Organ so the code is set up specifically to generate harmonic effects by mixing the two outputs.

It made some very pleasant music, or should I say it could if I was actually musically inclined. With a Suitable Amp, I used powerd PC speakers, it makes a passable church organ effect.

[code]

Keypad KeyCode, KP_Int, 21, 22, 23, 3, 18, 25, 2, 7 ' 1 Octave keyboard

setpin 6, AIN ' Gate Duration
setpin 9, DOUT ' Mode LED1
setpin 10, DOUT ' Mode LED2
setpin 14, DOUT ' Mode LED3
setpin 15, DOUT ' LFO
PIN(15) = 1


LFO_F = 0 ' LFO1 Off
LFO_D = 50 ' LFO1 Default Pulse Width
Duty = 50 ' Osc2 Default Pulse Width
Chorus = 1 ' Chorus Effect Off (Osc2 tracks Osc1)
Octave = 4 ' Keyboard range 261.63Hz - 523.25Hz (Middle C)

Do

SETTICK 200, LFO_Int, 3 ' Low Frequancy Oscillator

' Map keyboard to musical notes
IF KeyCode = 3 then MyNote = 1 ' C
IF KeyCode = 2 then MyNote = 2 ' C#
IF KeyCode = 1 then MyNote = 3 ' D
IF KeyCode = 20 then MyNote = 4 ' D#
IF KeyCode = 9 then MyNote = 5 ' E
IF KeyCode = 6 then MyNote = 6 ' F
IF KeyCode = 5 then MyNote = 7 ' F#
IF KeyCode = 4 then MyNote = 8 ' G
IF KeyCode = 21 then MyNote = 9 ' G#
IF KeyCode = 22 then MyNote = 10 ' A
IF KeyCode = 8 then MyNote = 11 ' A#
IF KeyCode = 7 then MyNote = 12 ' B
IF KeyCode = 11 then MyNote = 13 ' C

if MyNote > 0 then ' Note Key Played

if Trigger then

'Start the Gate
Gate = 250 * PIN(6) + 10
' Turn off Trigger
Trigger = 0
' Send Debug info once per Note
? "note1" Freq1 " Chorus" Chorus " Chord" Chord " Octave" Octave " Duty" Duty " Gate" Gate

endif

if Gate > 0 then ' Note is currently Playing

freq2 = 30.87 * ((2^(1/12)) ^ (MyNote + Chord * 12)) * 2^(Octave - 1)
freq1 = 30.87 * ((2^(1/12)) ^ MyNote) * 2^(Octave - 1)

if freq2 > 20 then pwm 2, freq2 * Chorus, Duty
if freq1 > 20 then pwm 1, freq1, 50

Gate = Gate - 1

Else ' Gate is Closed, Stop the Note

pwm 1, STOP
PWM 2, STOP
MyNote = 0

endif

endif

Loop

LFO_Int:
PULSE 15, 100
IRETURN

KP_Int: ' a key press has been detected

Trigger = 1

IF KeyCode = 23 then
if shift = 1 then
Chorus = Chorus - 0.0025
elseif shift = 2 then
Duty = Duty - 5
elseif shift = 3 then
Chord = Chord - 1
else
Octave = Octave - 1
if Octave < 0 then Octave = 0
endif
Trigger = 0
endif

IF KeyCode = 10 then
if shift = 1 then
Chorus = Chorus + 0.0025
elseif shift = 2 then
Duty = Duty + 5
elseif shift = 3 then
Chord = Chord + 1
else
Octave = Octave + 1
if Octave > 7 then Octave = 7
endif
Trigger = 0
endif

IF KeyCode = 0 then
shift = shift + 1
if shift > 7 then shift = 0
port(9,2,14,1) = shift
Trigger = 0
endif

IRETURN
[/code]

You may be able to use my Tone Functions from that.

Cheers
Chris

http://caroper.blogspot.com/
 
f1fco

Senior Member

Joined: 18/03/2012
Location: France
Posts: 154
Posted: 11:22am 29 Aug 2015
Copy link to clipboard 
Print this post

thank you to all for answers
I have the real answer but I hope...
if Geoff can add the TONE command, I can wait... a (long) time

to make a "syntesizer", the code of Chris Roper is very useful
square wave is an advantage for harmonics effects

finally, can you help me for values of a filter ?
R and C to quasi transform sqare in sinus (a low pass filter)

Pierre
73s de F1FCO
 
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 12:25pm 29 Aug 2015
Copy link to clipboard 
Print this post

Here Ya Go ....
 
skyv
Newbie

Joined: 14/03/2015
Location: Australia
Posts: 14
Posted: 10:51pm 29 Aug 2015
Copy link to clipboard 
Print this post

Hi hitsware

The link doesn't appear to be working for me.
Could you please check.

Thanks
skyv
 
Chris Roper
Senior Member

Joined: 19/05/2015
Location: South Africa
Posts: 280
Posted: 10:53pm 29 Aug 2015
Copy link to clipboard 
Print this post

  skyv said   Hi hitsware

The link doesn't appear to be working for me.
Could you please check.

Thanks
skyv


Works fine for me

Cheers
Chris

p.s.

Talking of links here is a good description of generating pure Sine Waves with a PIC Micro. It will give you a good idea of what is involved and how to filter it.

You may even end up with a useful tool :)

http://www.romanblack.com/onesec/Sine1kHz.htmEdited by Chris Roper 2015-08-31
http://caroper.blogspot.com/
 
skyv
Newbie

Joined: 14/03/2015
Location: Australia
Posts: 14
Posted: 10:57pm 29 Aug 2015
Copy link to clipboard 
Print this post

Thanks Chris

I'll check my computer settings


skyv
 
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 03:20am 30 Aug 2015
Copy link to clipboard 
Print this post

http://www.learningaboutelectronics.com/Articles/Low-pass-filter-calculator.php
 
f1fco

Senior Member

Joined: 18/03/2012
Location: France
Posts: 154
Posted: 03:48am 30 Aug 2015
Copy link to clipboard 
Print this post

thank you for links
I have forget my electronics laws...

I will try with 1OOO or 820 ohms and 100nF and see the result on my scope

Pierre
73s de F1FCO
 
jimbotron
Regular Member

Joined: 27/11/2013
Location: Australia
Posts: 46
Posted: 04:54am 30 Aug 2015
Copy link to clipboard 
Print this post

Hi Pierre,
Try using different filters for the different pins. One of the pins will be generating signals under 1KHz and the other will be higher. Use a lower cutoff frequency for the low frequency pin to get better sine waves.
 
f1fco

Senior Member

Joined: 18/03/2012
Location: France
Posts: 154
Posted: 10:33am 30 Aug 2015
Copy link to clipboard 
Print this post

hi Jimbotron,
judicious suggestion, you are right, I try it

thank you,
PierreEdited by f1fco 2015-08-31
73s de F1FCO
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024