Forum.

 

Need help or have a question? Join the conversation in our community topics and share your ideas, tips, or challenges—we’d love to hear from you! Before posting, be sure to check our

 

?

MP3 Player in Word ...
 
Notifiche
Cancella tutti

[Risolto] MP3 Player in Word Block editor: How to play a specific file?

12 Post
2 Utenti
1 Reactions
6,673 Visualizzazioni
AgentKnopf
(@agentknopf)
Eminent Member
Registrato: 3 anni fa
Post: 27
Topic starter  

You can upload songs to the SD card of the MP3 player but it seems i am unable to select and play a specific song from the MP3 player? In the player specific options (btw: I see its only icons now - i thought the text descriptions were pretty helpful 🙂 - not sure why they were removed?) I cant seem to select a specific track? Is it in a different menu - not MP3?

Thank you



   
Citazione
Camilo
(@cparrapa)
Developer Admin
Registrato: 3 anni fa
Post: 112
 

Hi @agentknopf when uploading mp3 files you need to make sure to name them with numbers at the beginning 001, 002 etc... we will add a new block to select the number of the track to play.

We will add the text descriptions too thanks for the input.



   
RispondiCitazione
AgentKnopf
(@agentknopf)
Eminent Member
Registrato: 3 anni fa
Post: 27
Topic starter  

Thank you Camilo, any update here? Looking forward to this one :) 



   
RispondiCitazione
Camilo
(@cparrapa)
Developer Admin
Registrato: 3 anni fa
Post: 112
 

Working on it now @agentknopf :D



   
RispondiCitazione
Camilo
(@cparrapa)
Developer Admin
Registrato: 3 anni fa
Post: 112
 

Hi @agentknopf

Good news! A new "play track block" has been added, you just need to input the number of the track accordingly to the mp3 file, remember for all new mp3 songs in the root folder (similar as they came from the factory)

You do not need to update libraries, just hard refresh your browser (ctrl+f5).

Happy block coding!



   
RispondiCitazione
AgentKnopf
(@agentknopf)
Eminent Member
Registrato: 3 anni fa
Post: 27
Topic starter  

@cparrapa I seem to be running into some kind of funny issue. So i have 29 tracks on my SD card - they are numbered 0001 to 0029, an ew examples:

  • 0018Worms Song.mp3
  • ...
  • 0023going-right.mp3
  • ...
  • 0027hi_there.mp3

I have set the MP3 Player to Port 3 and I use the MP3 track block to play a specific track, however what happens now is the following:

  • track is set to #15 > plays track #10
  • track is set to #18 > plays track #13
  • track is set to #22 > plays track #17
  • track is set to #27 > plays track #24
  • track is set to #28 > plays track #25

I am trying to wrap my head around what's going wrong here :) something is not ok but i am not sure what it is ... Any ideas would be appreciated.



   
RispondiCitazione
Camilo
(@cparrapa)
Developer Admin
Registrato: 3 anni fa
Post: 112
 

@agentknopf 

Maybe is indexing the mp3 files by size or something else than the name. Did this happen to you when they mp3 was connected to the default connector #2?

1. Try numbering them with 3 digits instead of 4

2. Try putting all files inside a new mp3 folder (not the root)

3. Format the SD card and paste the files at the same time again.

 



   
RispondiCitazione
AgentKnopf
(@agentknopf)
Eminent Member
Registrato: 3 anni fa
Post: 27
Topic starter  

@cparrapa So i tried the following:

  • Switching to connector 2 > no change
  • Removed all files and only copied over 3, changing the names to 001, 002 and 003 - it seems though this didn't take at all, the SD card was still playing files i had deleted - which was odd (I verified the files with my computer's SD Card reader)
  • I then formatted the SD card (MS-DOS Fat) and copied the mp3 folder back over with the three files mentioned above and now it played as follows (only 3 files were on the freshly formatted disk, folder structure is: /mp3/001|002|003) on connector 2 (i don't think the connector makes a difference, it did not before)
    • track set to play #1 > plays 1 = correct
    • track set to play #2 > plays nothing = wrong
    • track set to play #3 > plays 2 = wrong

I am thoroughly confused 🤣 - any way i can debug this? I attached the wordblocks. So the components connected are: LED Matrix in 3, MP3 in 2 and Proximity Sensor in 1. All the components work - sorta - i mean except for the behaviour of the MP3 :) 



   
RispondiCitazione
Camilo
(@cparrapa)
Developer Admin
Registrato: 3 anni fa
Post: 112
 

@agentknopf in my case for example I had and offset of the number file by 1 because of the 0000.mp3 was counting as the first file to play but then this is strange. I will try mine with your code



   
RispondiCitazione
AgentKnopf
(@agentknopf)
Eminent Member
Registrato: 3 anni fa
Post: 27
Topic starter  

@cparrapa did you have your files in the root or in the mp3 folder? Not sure it should matter though but I will give it a try as well. Thank you for your help, I will report back after playing with this a bit more.



   
RispondiCitazione
AgentKnopf
(@agentknopf)
Eminent Member
Registrato: 3 anni fa
Post: 27
Topic starter  

Apologies for the double post but when I click "Edit" on a forum post here, the wait spinner appears and I never actually get into edit mode - not sure why 🤔 . So here we go - small update:

  • I tried moving the three mp3 files to the root folder - it still plays one wrong and one track isnt played at all
  • I renamed the files removing the leading zeros (files are still in the root folder), so filenames are now: 1,2,3 - no change

In terms of debugging the only way to make some headway is to use Arduino I suppose, since while I can see the python code in the editor it's read-only so adding debug statement wont work. It would be kinda cool to have a fourth editor: Micropython directly :)) 



   
Camilo reacted
RispondiCitazione
Camilo
(@cparrapa)
Developer Admin
Registrato: 3 anni fa
Post: 112
 

Hi 

You can edit the code if you switch yo micropython mode, to directly edit the text. Alternately there are also plenty of 3rd party IDEs for programming in Micropython, as we recommended here Easy code Otto with Micropython



   
RispondiCitazione
Torna in alto
Saranno disponibili dopo il lancio del prodotto.