Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:39 08 Jul 2025 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 : Problem with "PLAY MP3"

Author Message
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 946
Posted: 01:51pm 28 May 2025
Copy link to clipboard 
Print this post

Hello to all!

I have a PicoMite HDMI/USB with I2S and have a problem with "PLAY MP3".

My options are:
PicoMiteHDMI MMBasic USB RP2350B Edition V6.00.02RC18
OPTION SERIAL CONSOLE COM2,GP8,GP9
OPTION SYSTEM I2C GP20,GP21
OPTION FLASH SIZE 16777216
OPTION COLOURCODE ON
OPTION KEYBOARD GR, 0, 0, 250, 25
OPTION PICO OFF
OPTION CPUSPEED (KHz) 252000
OPTION RESOLUTION 640x480
OPTION HDMI PINS  1, 3, 5, 7
OPTION SDCARD GP29, GP30, GP31, GP32
OPTION KEYBOARD REPEAT 250,25
OPTION AUDIO I2S GP10,GP22', ON PWM CHANNEL 11
OPTION RTC AUTO ENABLE
OPTION COUNT GP0,GP1,GP2,GP3
OPTION MODBUFF ENABLE  512
OPTION PLATFORM FM
OPTION PSRAM PIN GP47
OPTION HEARTBEAT PIN GP25

I have problems with this program:
Rem Test of PLAY MP3 file
file$ = "b:\mp3\"
Play VOLUME 10,10
Play MP3 file$
Print "Type in PLAY STOP to stop playing music."

When I start the program with F2 from the editor, it works perfectly. “PLAY NEXT” also works as expected.
However, when I start it with RUN, I simply hear nothing at all, but I don't get an error message either.

When I enter PLAY NEXT, I get the error message “Error : Nothing to play”.
The program only works if I start it from the editor with F2! WHY? What am I doing wrong?  

Frank
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10223
Posted: 02:16pm 28 May 2025
Copy link to clipboard 
Print this post

Try
Rem Test of PLAY MP3 file
drive "b:"
file$ = "b:\mp3\"
Play VOLUME 10,10
Play MP3 file$
Print "Type in PLAY STOP to stop playing music."
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 946
Posted: 05:42pm 28 May 2025
Copy link to clipboard 
Print this post

Unfortunately, that doesn't help. It is the same as before.

Frank
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4036
Posted: 06:02pm 28 May 2025
Copy link to clipboard 
Print this post

Maybe put a (long) PAUSE at the end?

Or an INPUT?

John
Edited 2025-05-29 04:02 by JohnS
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 946
Posted: 06:11pm 28 May 2025
Copy link to clipboard 
Print this post

@JohnS:

What exactly do you mean?

Frank
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4036
Posted: 10:34pm 28 May 2025
Copy link to clipboard 
Print this post

I was wondering if you need to keep the program doing something rather than it exiting.

John
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 946
Posted: 05:20am 29 May 2025
Copy link to clipboard 
Print this post

Strangely enough, the program works when I start it from the editor...

Frank
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 946
Posted: 07:29am 29 May 2025
Copy link to clipboard 
Print this post

@JohnS:

Your guess was right! If I attach a "INPUT A$", the MP3 runs until I press RETURN. However, if I start it from the editor with F2, the MP3 continues to run even after RETURN. That's still very strange.

Thanks for your tip!

Frank
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4036
Posted: 08:07am 29 May 2025
Copy link to clipboard 
Print this post

It is probably to do with which part of MMBasic is doing what, in terms of waiting for input.

A bit odd, but at least it works!

John
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10223
Posted: 02:54pm 29 May 2025
Copy link to clipboard 
Print this post

I've investigated this and the behaviour when run with "RUN" is correct. Audio is automatically cancelled when a program exits and because this program exits immediately the audio stops (before it really has a chance to start)

The behaviour after running from EDIT is wrong but happens because EDIT is run from the command line and the program returns to the EDIT command after it terminates rather than existing normally. If you put an explicit END command in the program it would behave the same in both cases.

The current situation is benign so I may leave it as is or may change it to be the same as "RUN" in both cases
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 946
Posted: 04:44pm 29 May 2025
Copy link to clipboard 
Print this post

Thank you for investigating this. The program is not mine and I was just wondering why it doesn't work with RUN and there are no problems when it is started from the editor. It might not be wrong to mention the behavior in the manual...

Frank
 
Print this page


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

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025