Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:49 29 Nov 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 : PicoMite: Another PLAY SOUND bug ?

     Page 1 of 2    
Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 03:17pm 26 Mar 2023
Copy link to clipboard 
Print this post

Hi Peter,

I assume I'm just having some sort of mental breakdown, but with b28:

Option Base 0
Option Explicit On
Option Default None

' Why (if uncommented) does this do nothing ?
'Play Sound 1,B,S,256,25
'Do : Pause 1000 : Loop

' But this play Middle-C ?
Do
Play Sound 1,B,S,256,25
Pause 1000
Loop


Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9139
Posted: 03:27pm 26 Mar 2023
Copy link to clipboard 
Print this post

Works for me
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 03:37pm 26 Mar 2023
Copy link to clipboard 
Print this post

Seriously,

I can see on the scope that it's doing nothing:

Play Sound 1,B,S,256,25
Do : Pause 1000 : Loop


> option list
PicoMite MMBasic Version 5.07.07b28
OPTION SYSTEM SPI GP18,GP19,GP16
OPTION CPUSPEED (KHz) 252000
OPTION LCDPANEL ILI9341, RLANDSCAPE,GP20,GP21,GP17
OPTION SDCARD GP22
OPTION AUDIO GP6,GP7, ON PWM CHANNEL 3


Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
hitsware2

Guru

Joined: 03/08/2019
Location: United States
Posts: 713
Posted: 04:15pm 26 Mar 2023
Copy link to clipboard 
Print this post

Doesn't

Do : Pause 1000 : Loop


Simply loop the pause 1000 ?
my site
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 04:20pm 26 Mar 2023
Copy link to clipboard 
Print this post

  hitsware2 said  Doesn't

Do : Pause 1000 : Loop


Simply loop the pause 1000 ?


Yes it does, I'm just doing something so the program doesn't end. The behaviour is the same (no tone) with just DO : LOOP after the PLAY SOUND.

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9139
Posted: 04:29pm 26 Mar 2023
Copy link to clipboard 
Print this post

PicoMite.zip
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 04:52pm 26 Mar 2023
Copy link to clipboard 
Print this post

  matherp said  PicoMite.zip


Quick test ... same nothing.

Will try again later or tomorrow, but my free time has expired for the moment, need to feed the troops.

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9139
Posted: 05:53pm 26 Mar 2023
Copy link to clipboard 
Print this post

Oops - sorry, wrong version


PicoMite.zip
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 08:11pm 26 Mar 2023
Copy link to clipboard 
Print this post

Thanks Peter, that fixes the issue .

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
mozzie
Regular Member

Joined: 15/06/2020
Location: Australia
Posts: 68
Posted: 02:06pm 27 Mar 2023
Copy link to clipboard 
Print this post

G'day Peter
I may be asking a bit much from the play sound function, but if I attempt to run two white noise sources:
>Play Sound 1,b,n,1
>Play Sound 2,b,n,2
The Pico locks up / requires power cycle.

Also 3 tones plus white noise source:
>Play Sound 1,b,n,1
>Play Sound 2,b,t,420
>Play Sound 3,b,t,525
>Play Sound 4,b,t,740
The Pico locks up / requires power cycle.

If only the left channel is used it functions as normal.

Only require 2 white noise sources to increase output modulation, am I correct in thinking the output is 25% for 1 sound, 50% for 2, 75% for 3 and 100% for all 4?

I imagine there is a fair bit going on in the background to get 8 signals across 2 channels (4x2) simultaneously at 44Khz PWM, including all the lookup table calls etc.
Not surprising the processor load is fairly high    

Can you please also advise if you think inverting the 2nd channel:
Poke Short &h40050000,&h09
Is likely to cause any problems.

Running PicoMite 5.070729 but also 5.070728 is the same.

Regards,
Lyle.
Edited 2023-03-28 00:10 by mozzie
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9139
Posted: 02:52pm 27 Mar 2023
Copy link to clipboard 
Print this post

Mozzie - what happens at 252MHz CPU speed?
 
mozzie
Regular Member

Joined: 15/06/2020
Location: Australia
Posts: 68
Posted: 09:14am 28 Mar 2023
Copy link to clipboard 
Print this post

Cheers Peter,
Can confirm at 252MHz 3 white noise sources in parallel or 1 white noise plus 3 sine or triangle.
Also tried 315MHz and 4 white noise or any combination of types.

The answer should have been "jumping off the screen" but couldn't see the woods for the trees  

Thanks again for the excellent work .

Regards,
Lyle.

P.S. so far using Poke Short &h40050000,&h09 to invert the output is working ok but I'll keep testing.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9139
Posted: 09:17am 28 Mar 2023
Copy link to clipboard 
Print this post

  Quote  Can confirm at 252MHz 3 white noise sources in parallel or 1 white noise plus 3 sine or triangle.
Also tried 315MHz and 4 white noise or any combination of types.


Have found a fix at normal clock speed 4*noise now works fine on both channels. Watch for b29 being posted
 
mozzie
Regular Member

Joined: 15/06/2020
Location: Australia
Posts: 68
Posted: 09:32am 28 Mar 2023
Copy link to clipboard 
Print this post

Cheers Peter,

Maybe a thought / suggestion for a later time...
The ability to allow a single Play Sound output at 100% modulation to match play tone, I realise this may take significant work to ensure that if more than 1 sound is running the output is not overdriven, I currently run 1-3 in parallel so not really needed but would be handy.

Thanks again.
Regards,
Lyle.
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2141
Posted: 11:37am 28 Mar 2023
Copy link to clipboard 
Print this post

"so far using Poke Short &h40050000,&h09 to invert the output is working ok"

@mozzie
Also works with beta 10.
Are other phase shifts possible? If so it could also be useful for non-audio applications.
A variable speed inverter for a split-phase motor would need 90 deg. An open delta inverter for a 3 phase motor would need 60 deg.

Even if it is only possible to get 180 deg. it would still be handy for a single phase unit.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9139
Posted: 11:42am 28 Mar 2023
Copy link to clipboard 
Print this post

  Quote  Are other phase shifts possible? If so it could also be useful for non-audio applications.
A variable speed inverter for a split-phase motor would need 90 deg. An open delta inverter for a 3 phase motor would need 60 deg.

Even if it is only possible to get 180 deg. it would still be handy for a single phase unit.


This is all already covered in enhancements to the PWM command in the 7.07.07 betas.

  Quote  The PWM command is modified as follows:

PWM channel, frequency, [dutyA] [,dutyB] [,phase] [,deferredstart]

Phase is a new parameter that causes the waveforms to be centred such that a wave form with a shorter duty cycle starts and ends equal times from a longer one. Use 1 to enable this mode and 0 (or omit) to run as normal

The new parameter "deferredstart" when set to 1 prepares the PWM channels as before but does not start the output running. This is to avoid any undesirable startup artefacts

There is a new sub command

PWM SYNC [channel0offset] [,channel1offset] .......[channel7offset]

This initiates the PWM on channels where a deferred start was defined or just syncs exisitng running channels. However, the power comes in the ability to offset the channels one to another (defined as a percentage of the time period as per the duty cycle - can be a float)
You can use an offset of -1 to omit a channel from the synch
Using a negative value for the duty cycle will invert the signal

Edited 2023-03-28 21:58 by matherp
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2141
Posted: 12:14pm 28 Mar 2023
Copy link to clipboard 
Print this post

Yes it is, and thankyou for that.
It is excellent for modified square wave inverters of all types. Play Tone makes sine wave inverters a piece of cake. Output feedback goes to Play Volume. The 180 deg. trick makes H-bridge driving easier.
More phase shifts would open up more possibilities so was interested to know if Poking other values would work. If not I don't expect you to modify the code. Very few people would use it.

PS. Thanks for the Library. That will be useful to many people.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3816
Posted: 02:09pm 28 Mar 2023
Copy link to clipboard 
Print this post

&h40050000 is (in C) 0x40050000 which is PWM_BASE in RP2040 datasheet

See 4.5.3 for the registers.

The web has comments on using the registers, too, e.g. search on
Pico 0x40050000
or
RP2040 0x40050000

John
Edited 2023-03-29 00:10 by JohnS
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2134
Posted: 03:29pm 28 Mar 2023
Copy link to clipboard 
Print this post

4.7mH inductors arrived today so built the low pass filter and tried play tone 1000,500,2000
it worked!
Check the photos of the ebay £14 stereo, runs off battery/usb, rechargable. Womans voice says blue tooth mode when turned on then pressing mode says fm mode, pressing again says a u x mode which I'm using, next says u s b mode. Great for the price.
I didn't have the caps for the filter so
68nF was 47nF + 22nF in parallel.
33nF was 22nF + 10nF in parallel,
2.7nF was 2.2nF+ (1nF + 1nF in series) in parallel,
would have been simpler with the right caps... see the photo
but sounds seem ok, I'm happy my soldering with my vision it worked.



 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4256
Posted: 03:57pm 28 Mar 2023
Copy link to clipboard 
Print this post

Copy some cd music to the sd card. You'll be surprised of the sound quality of this 4 dollar pico.

Volhout
PicomiteVGA PETSCII ROBOTS
 
     Page 1 of 2    
Print this page
© JAQ Software 2024