Jump to content
TechCoder

_SoundPlay - getting 'no sound' songs?

Recommended Posts

TechCoder

After years of wanting a replacement for 'Media Player' as a background player (and suffering the last time with it picking the same 'random' songs over and over...) - I decided to make something in AutoIt as a 'relaxing' project.

Within about an hour I had a nice working start and was playing music, thanks to _SoundPlay, FileOperations.au3 and gui tools.  I now play truly random songs from my folder and NEVER repeat until the list has been gone through completely (should have done this LONG ago!)

However, I'm getting the occasional song that comes up with no sound.

I've checked the file, works fine in MP as well as re-running it in my program (as the only selected song).

Code is simple - needs a lot of work to be 'releasable' (including some code to reload the files and/or {more likely} a database... - hey, it is 0.0.0.1!), but it suits my purpose well, for now (I've got about 300 hours of songs, so a bit of time before worrying about that).

But, these 'silent' songs are driving me crazy!  Any ideas welcome!

  • Like 1

Share this post


Link to post
Share on other sites
Melba23

TechCoder,

This has been reported now and again - the main culprit seems to be corrupted ID3 tags in the files, in particular any album art. I suggest you strip all tags from the "silent" files and retag them - that has always worked for me. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
TechCoder

I'll look at that.

I'm not using the ID3 for anything (unless _SoundPlayer looks at them, etc), so never considered that.

Haven't had any 'silent' ones in awhile (and didn't write down the culprits earlier as I thought it was my code...), so I will be sure to check on the next one.

Thanks for the tip.

Share this post


Link to post
Share on other sites
TechCoder

Just had another one.

1. Copied the file to a temp folder

2. Stopped the player (still going in SciTE as I am looking for ConsoleWrite stuff to try catching this - sadly, nothing interesting...)

3. Restarted the player in SciTE (so exact code) 

4. Selected the temp folder (which then loaded only the one file)

Played correctly.

Because of that, I feel like an ID3 change is really not going to help on this one.  I didn't do anything to the file other than copy/paste to the other location.

Other thoughts?  Any way I can put some tracking in to figure it out?

I would rather it be BROKEN and/or at least duplicatable - I hate intermittent problems!

Share this post


Link to post
Share on other sites
Melba23

TechCoder,

I can see nothing in the code you posted that would cause such a problem. Although I wonder why you brute force the song end - why not use _SoundStatus to let the file tell you it is ended rather then just waiting for a fixed time? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
TechCoder

just learning the UDF (as well as AutoIt), so 'brute force' is sometimes the only way I know how to do things - learning more as I go, in fact, I just put in 

 If _SoundPos($aSound, 2) >= _SoundLength($aSound, 2) Then

as I found that in the help file.

I'll go look into _SoundStatus

Share this post


Link to post
Share on other sites
TechCoder

Not fully tested yet, but I think the 'silent' songs are gone!

I put in a label to constantly show  _SoundStatus and was always getting 'stopped' as a result, even with the song playing.  That took me a while to figure out - stupid mistake, I was looking at the filename instead of the handle returned by _SoundOpen........  (i.e, RTFM)

Once I figured that out and re-sorted the code around, etc., I was able to get the proper status of 'playing' and then, was able to do the check for 'stopped' instead of the 'brute force' timeout method.

So far, no more 'silent' songs (which, btw, before I put in the check for 'stopped', were showing NO status).

End result - I believe it was a RACE CONDITION caused by using timing instead of reading _SoundStatus (I believe - more testing will prove that out, but I'm feeling very good about it - couple dozens songs played with no problem instead of every few songs being 'silent')

So if you are seeing 'silent' songs, be very careful on the coding - and use the features of the UDF !  o:)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×