Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 03:42 27 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 - adventures in sound

     Page 2 of 3    
Author Message
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6795
Posted: 03:21pm 29 Nov 2023
Copy link to clipboard 
Print this post

I've ordered one of the red boards, Peter. I'll see how well that works. :)

@ goc30
Just because the SD card socket is connected to the same SPI it doesn't necessarily mean that that socket will work. :)  A socket is only empty pins until you plug a card in.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 427
Posted: 05:23pm 29 Nov 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  
@ goc30
Just because the SD card socket is connected to the same SPI it doesn't necessarily mean that that socket will work. :)  A socket is only empty pins until you plug a card in.


of course, except that
1 - The topic makes you think that Pete tested his program before proposing it and therefore that the connections are correct
2 - the photo shows that Pete uses a specific card, where the SD reader is connected as standard
3 - to read an MP3 file it must be recorded on an SD card (card visible and inserted in the reader), so we are entitled to think that the VScard and the SDcard use the same SPI
4 - if there is a modification to the operation or wiring, we are likely to think that these modifications will be explained in this topic, specific to the use of the VSCcard, and not in the middle of the topic corresponding to updates picomite
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6795
Posted: 05:39pm 29 Nov 2023
Copy link to clipboard 
Print this post

While Peter is "playing" with the board I'd assume nothing. :)

If you see a RC (like this one) with "fully supported" mentioned about it together with a list of commands for it then that's when you can start to see the results of his experimenting. You probably won't see it in this thread though.

Although that board that he's using the VS1053 with in the photo has a SD card it may not be on the same SPI channel. Actually, a SD card on a PicoMite doesn't need a SDI port at all as they are handled in firmware.
Edited 2023-11-30 03:43 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 427
Posted: 06:00pm 29 Nov 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  
Although that board that he's using the VS1053 with in the photo has a SD card it may not be on the same SPI channel. Actually, a SD card on a PicoMite doesn't need a SDI port at all as they are handled in firmware.


As I have just explained to you, but perhaps I was not clear enough, I use the same cards as PETE, but the "MAKER PI PICO" card has an SD reader automatically wired to the GP10, GP11,GP12 pins. You cannot change them.
So the photo clearly indicates that the SPI port of the VScard and the SPI port of the SDcard use the same pins (SPI or non-SPI it doesn't matter).
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 427
Posted: 06:06pm 29 Nov 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  

If you see a RC (like this one) with "fully supported" mentioned about it together with a list of commands for it then that's when you can start to see the results of his experimenting. You probably won't see it in this thread though.


I don't come every day to see the new information on this forum, so I must have missed the corrections concerning the VSCard.
This is why it is more judicious to post the corrections in the corresponding topic (created by PETE himself for this) rather than to drown these corrections in 17 pages of updating a general firmware
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9307
Posted: 04:37am 30 Nov 2023
Copy link to clipboard 
Print this post

  matherp said  In addition I've got it supporting real-time midi. i.e. you can send it the various midi instructions (note on, note off, channel, etc.) and it will interpret them. The chip supports a maximum polyphony of 64, and the maximum sustained polyphony is 40.


This sounds like it might be a candidate for my home-made electric drum-kit idea, leaving the CODEC chip to do all the playback, and the MM just sends the commands.

I'm a bit late to this thread, but this is certainly an interesting little module and CODEC chip!  
Smoke makes things work. When the smoke gets out, it stops!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9120
Posted: 08:29am 30 Nov 2023
Copy link to clipboard 
Print this post

I modified Tom's "Entertainer" to PLAY MIDI rather than PLAY SOUND.
See here . Sorry about the sound quality, actually in real life it sounds pretty good.

Code changes
Option Base 0
Option Default None
Option Explicit On
Play midi 'enable real time midi
Play midi cmd &B11000001,10 'set the instrument for channel 1
Play midi cmd &B11000010,1 'set the instrument for channel 2
Option Break 4
On Key 3, on_break


' Plays the contents of the music%() array using interrupts.
Sub music.play()
Dim music_ptr% = Peek(VarAddr music%()) + 8
SetTick 200, music.play_interrupt, 1
Do While music_ptr% <> 0 : Loop
End Sub

' Interrupt routine playing a single half-beat (per channel) from the music%() array.
Sub music.play_interrupt()
Local i%, n%, halted% = 0
Static nlast%(NUM_CHANNELS%)
Local f!
For i% = 1 To NUM_CHANNELS%
n% = Peek(bp music_ptr%)
Select Case n%
 Case 0
'   Play Sound i%, B, O
  Play note off i%,nlast%(i%)
  nlast%(i%)=0
  Print Str$(i%) ": Rest"
 Case 1 To 254
  f!=440 * 2^((n% - 49) / 12.0)
  Print Str$(i%) ":" f! " hz",n%, nlast%(i%)
  If n%<>nlast%(i%) Then
    Play note off i%,nlast%(i%)
    Play note on i%,n%,80
  EndIf
  nlast%(i%)=n%
'   Play Sound i%, B, T, f!, 15
 Case 255
  Play note off 1,nlast%(i%)
'  Play Sound i%, B, O
  Print Str$(i%) ": Halted"
  Inc halted%
End Select
' Inc music_ptr%
Next
If halted% = NUM_CHANNELS% Then music_ptr% = 0 ' Halt
End Sub

Edited 2023-11-30 18:33 by matherp
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9307
Posted: 12:04am 01 Dec 2023
Copy link to clipboard 
Print this post

I've ordered a couple of modules to play about with during the Christmas break.
Smoke makes things work. When the smoke gets out, it stops!
 
crazycloud
Newbie

Joined: 20/08/2023
Location: United States
Posts: 37
Posted: 10:49pm 16 Dec 2023
Copy link to clipboard 
Print this post

what is meant by NB: ?


  matherp said  If anyone has got one of these here is some firmware to play with


PicoMite.zip

PLAY VS1053 XCSpin, XDCSpin, DREQpin, XRSTpin [, fname$ [,interrupt]]


NB: OPTION SYSTEM SPI must be set up and wired to the MISO, MOSI, and SCK pins on the module
NB: OPTION AUDIO does not need to be set to use the VS1053
NB: maximum CPU speed for this module is 252MHZ

modes of use:

File playback
PLAY VS1053 XCSpin, XDCSpin, DREQpin, XRSTpin , fname$ [,interrupt]
Plays the file fname$ in the background. This can be a FLAC, MP3, WAV or MIDI file.
NB: The MIDI file must be in format 0, i.e. all tracks interleaved.
Use the optional parameter interrupt to trigger an MMBasic interrupt when playback is complete.


Real time MIDI
PLAY VS1053 XCSpin, XDCSpin, DREQpin, XRSTpin
This opens the VS1053 in real time MIDI mode meaning it responds to MIDI commands. To support this use:
PLAY NOTE ON channel, note, velocity
PLAY NOTE OFF channel, note [,velocity]
PLAY CMD cmd, data1 [,data2]


Together these allow you to use all the channels, instruments and notes the VS1053 is capable off

Use PLAY STOP to exit this mode

Feedback appreciated
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9307
Posted: 10:54pm 16 Dec 2023
Copy link to clipboard 
Print this post

  crazycloud said  what is meant by NB: ?


Latin for Nota bene - which means note well, or in English just a kind of shorthand for "Please note" or just "Note".
Smoke makes things work. When the smoke gets out, it stops!
 
crazycloud
Newbie

Joined: 20/08/2023
Location: United States
Posts: 37
Posted: 11:58pm 16 Dec 2023
Copy link to clipboard 
Print this post

I'm trying to get a VS1053 running.  I'm confused as to what is required;
Homa posted am example where he included "option audio vs1053 GP2,GP3,GP4,GP9,GP8,GP7,GP6.  but your post says

PLAY VS1053 XCSpin, XDCSpin, DREQpin, XRSTpin [, fname$ [,interrupt]]
do I wire mso msi and sck to gp2,gp3,gp4 or do I wire them to option system SPI
GP10,Gp11,GP12?


  Grogster said  
  crazycloud said  what is meant by NB: ?


Latin for Nota bene - which means note well, or in English just a kind of shorthand for "Please note" or just "Note".
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 427
Posted: 03:37am 17 Dec 2023
Copy link to clipboard 
Print this post

  crazycloud said  I'm trying to get a VS1053 running.  I'm confused as to what is required;
Homa posted am example where he included "option audio vs1053 GP2,GP3,GP4,GP9,GP8,GP7,GP6.  but your post says

PLAY VS1053 XCSpin, XDCSpin, DREQpin, XRSTpin [, fname$ [,interrupt]]
do I wire mso msi and sck to gp2,gp3,gp4 or do I wire them to option system SPI
GP10,Gp11,GP12?



I give you my config and use
it is aviable with cytron maker pi pico (same as card use by Pete - see on top of this topic)
PicoMite MMBasic Version 5.07.08RC20
OPTION SYSTEM SPI GP10,GP11,GP12
OPTION SDCARD GP15
OPTION AUDIO VS1053 GP2,GP3,GP4,GP9,GP8,GP7,GP6', ON PWM CHANNEL 1
>
> play mp3 "b:track0002.mp3"


For VS1053, you need to use other SPI pins than system SPI (like SdCard)
And forget config and example of the first Pete's post, it is wrong because it uses the same SPI as the SPI System

the good connect pin's function is:
OPTION AUDIO VS1053 SPICLKpin, SPIMOSIpin, SPIMISOpin, CSpin, DCSpin, DREQpin, RESETpin
OPTION AUDIO VS1053 GP2,GP3,GP4,GP9,GP8,GP7,GP6
Edited 2023-12-17 13:49 by goc30
 
crazycloud
Newbie

Joined: 20/08/2023
Location: United States
Posts: 37
Posted: 11:51am 17 Dec 2023
Copy link to clipboard 
Print this post

thank you for the quick reply.

I tried this

WebMite MMBasic Version 5.08.00b5
OPTION WIFI NETGEAR57, **************, PICOE6616408437
OPTION TELNET CONSOLE ON
OPTION AUDIO VS1053 GP2,GP3,GP4,GP9,GP8,GP7,GP6', ON PWM CHANNEL 1

but it did not work.  I am watching all my pins with an oscilliscope. I get digital data on all the VS1053 lines, but only noise on the audio output. I have the audio
wired into the aux input of a bluetooth speaker.  I don't hear anything.
I uploaded a sample mp3 file of about 700K. I can tell its getting to the VS1053 because the embedded leds on my pico board show activiy.  I am using a pico carrier
board that doesn't have a built in SD card. I didn;t define option SPI GP10 GP11 Gp12
because of that.  Is that correct? I only need to define that if I have a 2nd SPI
device?
my wiring to the VS1053 is SPICLK=GP2  SPIMOSI GP3 SPIMISO GP4 CS GP9 DCS=GP8
DREQ = GP7  RESET = GP6.  In the past months I have gotten a camera hooked up and working with my pico. I got the speech synthesis board working too.  But this is much more confusing.
 
crazycloud
Newbie

Joined: 20/08/2023
Location: United States
Posts: 37
Posted: 12:18pm 17 Dec 2023
Copy link to clipboard 
Print this post

don't i need to define the SPI pins like in appendix D?

I/O Pins
Before an SPI interface can be used the I/O pins for the channel must be allocated using the following
commands. For the first channel (referred as SPI) it is:
SETPIN rx, tx, clk, SPI
Valid pins are RX: GP0, GP4, GP16 or GP20
TX: GP3, GP7 or GP19
CLK: GP2, GP6 or GP18

or is this taken care of when you define option audio VS1053?

I'm not defining the SPI pins 1st with the info in appendix D from the manual
 
crazycloud
Newbie

Joined: 20/08/2023
Location: United States
Posts: 37
Posted: 12:21pm 17 Dec 2023
Copy link to clipboard 
Print this post

I have 2 armmite F4s working with a LCD display.  I was wondering if the sound board
VS1053 will ever work with Armmite F4 boards.  I reall like the format of the armmite F4, and its very fast.
 
crazycloud
Newbie

Joined: 20/08/2023
Location: United States
Posts: 37
Posted: 01:01pm 17 Dec 2023
Copy link to clipboard 
Print this post

I just noticed that I don't have any digital data on GP8 which is the XDCS line.

I have a schematic of the VS1053 board.  according to the documentation XDCS is a chip select line and an active low signal. it should go low to activate the VS1053.
My pin GP8 is always high.  I wonder if I have a defective pico?

Does anyone else have a scope hooked up to their VS1053 board?
 
crazycloud
Newbie

Joined: 20/08/2023
Location: United States
Posts: 37
Posted: 02:28pm 17 Dec 2023
Copy link to clipboard 
Print this post

here is a schematic of the VS1053 board

VS1003-Schematic-Diagram.pdf
 
cosmic frog
Senior Member

Joined: 09/02/2012
Location: United Kingdom
Posts: 284
Posted: 04:36pm 17 Dec 2023
Copy link to clipboard 
Print this post

  crazycloud said  ...I have the audio
wired into the aux input of a bluetooth speaker.  I don't hear anything.


If you are using the VS1053 demo board (Aliexpress) you cannot connect it to powered speakers or amp as it causes a short.
You can only use the board with headphones. It must be modified to use an external amp.  See this site
It doesn't use a common ground, it uses something called GBUF which cannot be connected to ground. There is a circuit diagram on the above site that shows a workaround for this.

Dave.
Edited 2023-12-18 02:45 by cosmic frog
 
crazycloud
Newbie

Joined: 20/08/2023
Location: United States
Posts: 37
Posted: 04:47pm 17 Dec 2023
Copy link to clipboard 
Print this post

I have this board

https://www.aliexpress.us/item/3256805201102831.html?spm=a2g0o.order_list.order_list_main.29.412f18022vuP4L&gatewayAdapt=glo2usa

I also connected it to high impedance headphones. Still no sound.


 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 427
Posted: 04:49pm 17 Dec 2023
Copy link to clipboard 
Print this post

  crazycloud said  thank you for the quick reply.

I tried this

WebMite MMBasic Version 5.08.00b5
OPTION WIFI NETGEAR57, **************, PICOE6616408437
OPTION TELNET CONSOLE ON
OPTION AUDIO VS1053 GP2,GP3,GP4,GP9,GP8,GP7,GP6', ON PWM CHANNEL 1



With a webmite, you must also declare the SPI System pins
my configuration

WebMite MMBasic Version 5.07.08RC21
SPI SYSTEM OPTION GP10,GP11,GP12
AUTORUN ON OPTION
COLOURCODE OPTION ON
WIFI OPTION ******, ********************, PICOE6616408434
GP15 SDCARD OPTION
AUDIO OPTION VS1053 GP2,GP3,GP4,GP9,GP8,GP7,GP6', ON PWM CHANNEL 1
>

I tested with the code provided by Pete to listen to an internet radio
It works (for a while, then it stops). With French radios it also works but for less time
Option escape
Option explicit
Option default none
' create the request for the radio site (ClassicFM)
Dim a$="ice-the.musicradio.com"
Dim q$="GET "
Inc q$,"/ClassicFMMP3"
Inc q$," HTTP/1.1\r\n"
Inc q$,"Host: "
Inc q$,a$
Inc q$,"\r\nConnection: close\r\n\r\n"

'create a circular buffer for reading the internet stream and
'read and write pointers
Dim buff%(4095),w%,r%

' Configure the VS1053 and tell it to play from the circular buffer
Play vs1053 GP9, gp8, gp7, gp6, buff%(), r%, w%

' Open the internet radio site
WEB open tcp stream a$,80

' Send the request to start the stream using the circular buffer specified
WEB TCP CLIENT STREAM q$, buff%(), r%, w%

'sit back and listen
Do
Pause 500
Loop
 
     Page 2 of 3    
Print this page
© JAQ Software 2024