![]() |
Forum Index : Microcontroller and PC projects : mp3 player
Page 1 of 2 ![]() ![]() |
|||||
Author | Message | ||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2540 |
anyone used this device for sound out as alternative to filter circuit? https://www.aliexpress.com/item/1005007240103433.html?pdp_npi=4%40dis%21GBP%215.10%210.80%21%21%216.27%210.98%21%402101646317317673356745769d10c8%2112000039917955536%21affd%21%21%21&dp=CjwKCAiAmrS7BhBJEiwAei59i7yRKd1RM5E1JWil_pHVeBJ1gUCVegRf3zX3ccgRdTWZCFZcLvE5vBoClM0QAvD_BwE%7C0AAAAAC5ena3FXAKD8ShAEgZpnn2URfFYM%7CCj4KCAiA9667BhA4Ei4Ar11gnoMxdTMEE133MyF-JBfLCRks67bKKfVgL_AMyHo5y55kDSlOWNHuRJakGgIgKg%7Cv1&aff_fcid=78ba27af7b654d2b85b3eda377dd2680-1735251311340-09716&aff_fsk&aff_platform=api-new-product-query&sk&aff_trace_key=78ba27af7b654d2b85b3eda377dd2680-1735251311340-09716&terminal_id=84cb6456fbbb40b5af37b158c6c66799&afSmartRedirect=y or anything and what/where is the codec and how to load it. regards, stan. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7869 |
I've used a couple of different VS1053 boards and they were both fine. MMBasic doesn't support audio input though, so the MIC input doesn't work. It does support VS1053 as an output device. The audio output is NOT common to GND, it's designed for headphones only. There is a way round this. Sound quality is good. ------------------ If you are trying to get a line output without filter components then this module is not for you. Try the DAC chip instead, that can use a simple RC filter but there is still DC on the output that may need a further capacitor and bleed resistor. Edited 2024-12-27 08:54 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2540 |
so it does the same as the filter but plays mp3 as well? what's the codec about. is it in the device or a file to load? sorry thick. will I have the pins using hdmi usb? pins left spi. cheers. can I use the sd card reader as a normal sd card reader, that would be great, worth the board price alone. Edited 2024-12-27 09:15 by stanleyella |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7869 |
It's documented in the manual. OPTION AUDIO VS1053 ... Needs quite a lot of pins that you can't share with anything else. The "codec" is firmware in the VS1053. It has several codecs for different types of audio. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2540 |
maybe if I didn't use option sd card and option audio then the card could use those pins and do audio and sdcard |
||||
Bill.b![]() Senior Member ![]() Joined: 25/06/2011 Location: AustraliaPosts: 235 |
Depending on what you want the audio for, I use a DFPlayer MP3 to play selected tracks on the SD card in the player. Below is the program for a Christmas train use in my lights display. The track consist of several stream train sounds that can be selected by the program. 'xmas Train control for the picomite '28/01/2024 'Bill Brown Option colourcode on Option autorun on Option DEFAULT NONE Dim aa$ Dim integer c(4),x,y,z,Tspeed,loop1 dim integer CMD1,arg dim integer manloop SetPin GP22, Dout setpin gp5, dout 'Light setpin gp6, dout 'smoke setpin gp14, din ' local start setpin gp15, din 'hall effect switch - Station Stop SetPin GP12, pwm6A 'Forward contol PWM output pin(gp7) = 1 SetPin GP21, Gp20, com2 'sound output Open "com2:9600" As #2 cmd1 = &h09 'Set SD card arg = 0002 send cmd1 = &h06 'Set volume arg = 30 send Do if pin(GP14) = 0 then TrainFWD end if Loop '****************Train Forward ******************* sub TrainFWD pin(GP6) = 1 pin(GP5) = 1 cmd1 = &h12 'Play 0004.mp3 rain Starting arg = 0004 send for loop1 = 10 to 100 PWM 6,500,loop1 'pwm output to motor FWD pause 150 next loop1 cmd1 = &h12 'Play 0001.mp3 arg = 0001 send do loop until pin(GP15) = 0 pause 5000 station end sub '************************** Stop Train ************************ Sub stoptrain for loop1 = 90 to 10 step -1 PWM 6,500,loop1 'pwm output to motor FWD pause 20 next loop1 PWM 6, 500,0 cmd1 = &h12 'Play 0002.mp3 Train Stopped At station arg = 0002 send end sub sub Station manloop = 1 stoptrain do manloop = manloop + 1 pause 100 loop until manloop > 150 TrainFWD end sub '-------------------send to mp3 module --------------------------- sub send print #2, Chr$(&h7E) + Chr$(&hFF) + Chr$(&h06) + Chr$(cmd1) + Chr$(0) + Chr$(0) + Chr$(arg) + Chr$(&hEF); pause 100 arg = 0 end sub Bill In the interests of the environment, this post has been constructed entirely from recycled electrons. |
||||
Bill.b![]() Senior Member ![]() Joined: 25/06/2011 Location: AustraliaPosts: 235 |
Depending on what you want the audio for, I use a DFPlayer MP3 to play selected tracks on the SD card in the player. Below is the program for a Christmas train use in my lights display. The track consist of several stream train sounds that can be selected by the program. 'xmas Train control for the picomite '28/01/2024 'Bill Brown Option colourcode on Option autorun on Option DEFAULT NONE Dim aa$ Dim integer c(4),x,y,z,Tspeed,loop1 dim integer CMD1,arg dim integer manloop SetPin GP22, Dout setpin gp5, dout 'Light setpin gp6, dout 'smoke setpin gp14, din ' local start setpin gp15, din 'hall effect switch - Station Stop SetPin GP12, pwm6A 'Forward contol PWM output pin(gp7) = 1 SetPin GP21, Gp20, com2 'sound output Open "com2:9600" As #2 cmd1 = &h09 'Set SD card arg = 0002 send cmd1 = &h06 'Set volume arg = 30 send Do if pin(GP14) = 0 then TrainFWD end if Loop '****************Train Forward ******************* sub TrainFWD pin(GP6) = 1 pin(GP5) = 1 cmd1 = &h12 'Play 0004.mp3 rain Starting arg = 0004 send for loop1 = 10 to 100 PWM 6,500,loop1 'pwm output to motor FWD pause 150 next loop1 cmd1 = &h12 'Play 0001.mp3 arg = 0001 send do loop until pin(GP15) = 0 pause 5000 station end sub '************************** Stop Train ************************ Sub stoptrain for loop1 = 90 to 10 step -1 PWM 6,500,loop1 'pwm output to motor FWD pause 20 next loop1 PWM 6, 500,0 cmd1 = &h12 'Play 0002.mp3 Train Stopped At station arg = 0002 send end sub sub Station manloop = 1 stoptrain do manloop = manloop + 1 pause 100 loop until manloop > 150 TrainFWD end sub '-------------------send to mp3 module --------------------------- sub send print #2, Chr$(&h7E) + Chr$(&hFF) + Chr$(&h06) + Chr$(cmd1) + Chr$(0) + Chr$(0) + Chr$(arg) + Chr$(&hEF); pause 100 arg = 0 end sub Bill In the interests of the environment, this post has been constructed entirely from recycled electrons. |
||||
Bill.b![]() Senior Member ![]() Joined: 25/06/2011 Location: AustraliaPosts: 235 |
ooops must have hit the post button twice . In the interests of the environment, this post has been constructed entirely from recycled electrons. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7869 |
A lower pin count alternative is to use a Pico 2 in combination with a DAC. Pico 2 supports PLAY MP3 and the output from the DAC doesn't need much filtering (RC then an isolating cap and anti-thump bleeder resistor). The DAC needs 3 SPI pins, CS, SCK and MOSI (the MISO pin isn't used). Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2540 |
"Pico 2 supports PLAY MP3". without extra hardware? will try a mp3 file. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7869 |
It's still PWM output so you should use the usual filter, but otherwise yes - it can do the MP3 decoding. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2540 |
I get an error B: > FILES B:/ <DIR> SYSTEM 01:37 01-01-2000 0 bootcount 19:26 01-08-2024 68506 RISsound.mod 16:48 30-08-2024 44556 sfx-bg.mod 22:39 29-03-2023 55342378 t1.wav 21:11 02-04-2023 65642368 t2.wav 23:05 09-04-2023 0 t3.mp3 22:03 09-04-2023 22763937 t4.flac 1 directory, 7 files > PLAY MP3 "t3" Error : Mp3 init |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2540 |
@Bill.b, I got a sd card mp3 player from picaxe. works with arduino, serial. it was gonna be a "robot vehicle face" with voice from Audacity https://www.youtube.com/watch?v=4LnerMCgeNU I couldn't play an mp3 file > option list PicoMiteHDMI MMBasic USB RP2350A Edition V6.00.01RC4 OPTION SERIAL CONSOLE COM2,GP8,GP9 OPTION AUTORUN ON OPTION FLASH SIZE 4194304 OPTION COLOURCODE ON OPTION KEYBOARD UK, 0, 0, 600, 150 OPTION CPUSPEED (KHz) 315000 OPTION SDCARD GP22, GP6, GP7, GP4 OPTION AUDIO GP0,GP1', ON PWM CHANNEL 0 > |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10244 |
I wonder why? How big is the file t3.mp3? Could that be the issue? |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2540 |
Yes boss you right, I didn't see it was duff file these work, sound fine, nice feature pico 2 thanks > b: > files B:/ 19:05 28-07-2020 8802830 adele,tupac,eminem.mp3 21:07 29-09-2024 67081508 adele,tupac,eminem.wav 17:38 28-07-2020 8444268 Biggie,Adele,Tupac.mp3 21:08 29-09-2024 65642084 Biggie,Adele,Tupac.wav 22:16 28-07-2020 5338459 biggie.johnny cash.mp3 21:08 29-09-2024 39577644 biggie.johnny cash.wav 22:54 23-09-2024 138982 fatlib.bmp 16:48 30-08-2024 44556 sfx-bg.mod 20:35 20-03-2020 49501189 THENOT~1.MP3 21:11 29-09-2024 363818330 THENOT~1.WAV 18:49 28-07-2020 7598885 tupac,eminem.mp3 21:11 29-09-2024 54718580 tupac,eminem.wav 0 directories, 12 files > play mp3 "tupac,eminem" |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2540 |
in the "manual" the differences between 2040 and 2350 like you can play mp3 with 2350 and the other differences should be mentioned if not already but the manual is not finalised yet. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7869 |
They are mentioned, but you have to read the whole manual. The Pico and Pico2, including the Webmite etc. are all in the same manual. It would be silly to try to point out every single change that has been made on every platform. :) Note that you can play MP3s whether you have a RP2350 or not. Page 133 PLAY MP3 file$ [, interrupt] Will play a MP3 file on the sound output (RP2350 ONLY). 'file$' is the MP3file to play (the extension of .mp3 will be appended if missing). The sample rate can be up to 48kHz. The MP3 file is played in the background. 'interrupt' is optional and is the name of a subroutine which will be called when the file has finished playing. If file$ is a directory the Pico will play all of the files in that directory in turn. Page 134 VS1053 specific PLAY commands PLAY MP3 file$ [, interrupt] Will play a MP3 file on the sound output. 'file$' is the MP3 file to play (the extension of .mp3 will be appended if missing). The sample rate should be 44100Hz stereo. The MP3 file is played in the background. 'interrupt' is optional and is the name of a subroutine which will be called when the file has finished playing. If file$ is a directory the Pico will play all of the files in that directory in turn. . Edited 2024-12-28 08:51 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2540 |
the fact that 2350 pico 2 plays mp3 files as is... with filter is good, I was gonna buy device but no need. that's pretty cool. and the pico 2 does hdmi and 2040 don't. sort of slipped under the radar. we don't want everyone upgrading. I got 4 pico 2's |
||||
Bill.b![]() Senior Member ![]() Joined: 25/06/2011 Location: AustraliaPosts: 235 |
The MP3 player i use is the same as the one supplied by picaxe and plays the MP3 files OK. They need to be in a MP3 sub directory on the sd card and numbered 001 to 999.mp3 Bill In the interests of the environment, this post has been constructed entirely from recycled electrons. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7869 |
What you use depends on what you want: Pico 2 - most CPU load as the decoding is done in firmware. The Pico 2 is efficient though, which is what makes it possible on this chip. VS1053 - decoding is fast and you gain other things (like MIDI), but SPI adds an appreciable CPU load. Probably not too bad a load on a Pico 2 though. Hardware module - a little restricted in what it can do, but has zero CPU load There is no right way for all cases. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Page 1 of 2 ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |