Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:46 26 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 : play simple midi notes

     Page 2 of 2    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9115
Posted: 03:05pm 30 Dec 2023
Copy link to clipboard 
Print this post

  Quote  I'll be spending some of my coffee money on one of those boards.


Things to note about the VS1053.

1.  It uses a lot of time in an interrupt routine to send the data as the SPI speed is limited to a maximum of 6MHz so for a 48000Hz stereo WAV file = 1.536Mbits/second over 1/4 of CPU time is taken by SPI transmission alone. Add in the disk read/ packaging overhead and there is little left. MP3 isn't quite so bad. MOD files are sent as WAV so high overhead

2. It uses a lot of pins (7) and an SPI port different from SYSTEM SPI/SDcard

3. Initialising the VS1053 takes a lot of time so it isn't possible in games to play short snippets of sound

4. HOWEVER, it does things other audio mechanisms can't so for sound applications it is the dog's ....
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4039
Posted: 05:16pm 30 Dec 2023
Copy link to clipboard 
Print this post

  matherp said  How many tones in an octave?  


Good point, so whilst you may have cloth ears I have Christmas cake for brains .

Thanks for the other observations on the VS1053, I guess I won't be putting one in the Game2Mite.

Best wishes,

Tom
Edited 2023-12-31 04:31 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
al18
Senior Member

Joined: 06/07/2019
Location: United States
Posts: 205
Posted: 03:05am 31 Dec 2023
Copy link to clipboard 
Print this post

Crazycloud,
Thanks for the words of warning regarding isolating the audio ground using the audio isolators. I will order  the audio isolator.
 
Grogster

Admin Group

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

I'm kinda surprised that the audio output is NOT ground-referenced.
That is pretty much the default standard for every audio connection I have ever seen.
But yes - good to know that now, before I also have a tinker with this module.
Smoke makes things work. When the smoke gets out, it stops!
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6787
Posted: 09:51am 31 Dec 2023
Copy link to clipboard 
Print this post

It's very easy to use it ground-referenced. Basically, put isolating caps inline. There is a small RC filter recommended as well to get a line output. I think the ability to drive 35R headphones directly at a reasonable volume is pretty cool personally. :)
Mick

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

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4039
Posted: 09:55am 31 Dec 2023
Copy link to clipboard 
Print this post

Could anyone provide an explanation suitable for idiots of what you are talking about regarding "ground" with this module ? I may have cobbled the Game*Mite together but I freely admit it was a cargo-cult job.

Best wishes,

Tom
Edited 2023-12-31 20:03 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6787
Posted: 10:10am 31 Dec 2023
Copy link to clipboard 
Print this post

Sure.

The VS1053 produces a "virtual ground" at half supply voltage. The common of the headphones goes to this and the "signal" ends go directly to the outputs of the VS1053. Those outputs produce a signal that is relative to half supply voltage (swinging towards supply and gnd on each half of the waveform). As the headphones common is at half supply voltage there is no DC across them when there is no signal so there is no need to fit DC isolating capacitors. These would normally be relatively big, at least 100uF to get decent bass even into 35R headphones.

Hope this helps...
Edited 2023-12-31 20:12 by Mixtel90
Mick

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

Joined: 18/11/2011
Location: United Kingdom
Posts: 3801
Posted: 11:46am 31 Dec 2023
Copy link to clipboard 
Print this post

So when crazycloud warned not to connect to anything with a ground he means with a ground also connected back to ground on the VS1053 board? (i.e. avoid shorting the centre reference to ground - have I got this?)

(Which headphones don't do, of course.)

John
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6787
Posted: 11:58am 31 Dec 2023
Copy link to clipboard 
Print this post

Yep. You must never connect the virtual ground to true ground. It's probably generated at the junction between two MOSFETs, so you would be shorting out the lower one. They say it's protected against this, but it's still not a good idea to rely on protection. The virtual ground is just that - a common point for headphones.

The Land R signals are still swinging between GND and supply, so the signal is there. It's just that it's superimposed on a 1.6V DC level. You could use common ground headphones but you'd have to put 100uF capacitors to isolate each channel. If you think about it, it's just the same as using an op-amp (or anything else with a push-pull output) on a single rail supply.
Mick

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

Joined: 17/05/2016
Location: United States
Posts: 3150
Posted: 03:10pm 31 Dec 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  If you think about it ...


If I think about it, I don't know enough to understand it (but thanks for the explanations). That's why the cargo-cult method works for me (except when it doesn't, and I have to go looking for help).
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
crazycloud
Newbie

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

  matherp said  
  Quote  I'll be spending some of my coffee money on one of those boards.


Things to note about the VS1053.

1.  It uses a lot of time in an interrupt routine to send the data as the SPI speed is limited to a maximum of 6MHz so for a 48000Hz stereo WAV file = 1.536Mbits/second over 1/4 of CPU time is taken by SPI transmission alone. Add in the disk read/ packaging overhead and there is little left. MP3 isn't quite so bad. MOD files are sent as WAV so high overhead

2. It uses a lot of pins (7) and an SPI port different from SYSTEM SPI/SDcard

3. Initialising the VS1053 takes a lot of time so it isn't possible in games to play short snippets of sound

4. HOWEVER, it does things other audio mechanisms can't so for sound applications it is the dog's ....


I was wondering if the Armmite F4 basic will ever have commands to run the VS1053?

It is faster and has many more I/O pins.  I built 2 of these with the matching display.  I had to remove a few pins from the ends of the processor board in order not to short out the 3.6 volts.  they work great with this mod.  

here is a marked up image showing the virtual ground on the VS1053 board.


I spent the morning playing with the internet radio program, It's really a breeze to run, and great quality.  I have the output coupled to an audio transformer. The other end goes into a bluetooth transmitter so I can listen with bluetooth headphones.

I'm re posting the program here if its all right.  

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%
PLAY STREAM 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
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6787
Posted: 05:19pm 31 Dec 2023
Copy link to clipboard 
Print this post

For those who would like a Line Out:


L or R                 +
VS1053 ---- 470R --+----| |------+----- out
                  !     10uF    |
                 ---            |
                 --- 33n       100K
                  !             |
  GND ------------+-------------+------ Sgnd


Simply tap the L & R off the back of the headphone skt & pick up GND from the VS1053 board. Sgnd is your *output* ground.

Don't connect anything to GBUF (the ground terminal of the headphone socket).
Mick

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

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6787
Posted: 02:11pm 01 Jan 2024
Copy link to clipboard 
Print this post

The red version of the VS1053 board has now passed the PLAY TONE and PLAY FLAC tests with flying colours. :)
Volume on 32R headphones is uncomfortably loud if you don't use PLAY VOLUME to turn it down! Sound quality is very good.

EDIT:
It's just passed the "The Entertainer" test too. :)
Edited 2024-01-02 00:28 by Mixtel90
Mick

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

Joined: 20/08/2023
Location: United States
Posts: 37
Posted: 02:40pm 01 Jan 2024
Copy link to clipboard 
Print this post

Mick

thanks for the update.  I just ordered 2 from aliexpress.  

Best Regards

Jim
 
cosmic frog
Senior Member

Joined: 09/02/2012
Location: United Kingdom
Posts: 284
Posted: 11:32am 13 Mar 2024
Copy link to clipboard 
Print this post

Just started playing with one of these (Had some for some time but not had chance to try them) and noticed it plays MP3's in "slow motion" and sometime gets a read error. If I change the CPU speed down to 48000 it works fine, but when I change the CPU speed higher the MP3 plays slow.
Has anyone else come across this problem? I'm thinking it may be a wiring problem as I'm using header pins connected using those Dupont type connectors and I've had problems with these things before.

PicoMite MMBasic Version 5.09.00b6
OPTION CPUSPEED  48000 'KHz
OPTION SDCARD GP13, GP10, GP11, GP12
OPTION AUDIO VS1053 GP18,GP19,GP20,GP21,GP22,GP0,GP1', ON PWM CHANNEL 1

Thanks.

Dave.
 
cosmic frog
Senior Member

Joined: 09/02/2012
Location: United Kingdom
Posts: 284
Posted: 12:54pm 13 Mar 2024
Copy link to clipboard 
Print this post

Just been reading another thread about something similar, where putting a 100pf cap across XCS and ground fixes a Read failure problem.
I tried a 220pf cap and it has fixed the "slow motion" problem at high CPU speeds.
It's now working great!

Dave.
 
     Page 2 of 2    
Print this page


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

© JAQ Software 2024