[SOLVED] Help with car's USB Music Player - copying MP3 files in order

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
User avatar
alan2001
Level 2
Level 2
Posts: 57
Joined: Thu Feb 02, 2012 6:30 am
Location: Scotland

[SOLVED] Help with car's USB Music Player - copying MP3 files in order

Post by alan2001 »

Hi folks. I'm having a bit of a trivial but irritating issue with my car's onboard USB music player. This is a 2011 Honda CR-V. Inside the glove compartment there is a USB input socket, where you can just plug in a memory stick and it'll play music.

I copied over about 8GB of music (1100 tracks) and immediately noticed that the car was playing tracks within folders in a seemingly random order. My first thought was obviously I've got it set to random play, duh... but I hadn't. Everything is named and tagged correctly.

I had a look at the owner's manual (see attached page; the section highlighted in red) and was amazed to discover that "files are played in the order stored in USB flash memory device". So this means that when I drag and drop a folder full of tracks in one go, it plays those tracks in the order that the files finished copying to the device. Which is insane.
USB Playback.jpg
I can get round this by laboriously copying each track one at a time, in order. I've tested it and they play in order perfectly. But that is as tedious and time-consuming as you would expect. So now for the question!

Is there any way to copy tracks en masse to the device, so that they will be copied in order, e.g. so that track #2 doesn't even start copying before track #1 has completed?

Cheers! :D
Last edited by LockBot on Sat Jul 29, 2023 10:00 pm, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
kato181
Level 9
Level 9
Posts: 2577
Joined: Fri Mar 24, 2017 12:33 am
Location: Frederickton NSW

Re: Help with car's USB Music Player - copying MP3 files in order

Post by kato181 »

This really has nothing to do with LM. Check with your vehicle manufacturer.
If you want to play music from the first track to the last then don't put them in folders. Vehicle play songs best MP3 format, I have a 32gb full of MP3 songs, and when I copied them to the usb I had them as as Ascending order. Mine are song/artist and you can do that in any file manager.
User avatar
alan2001
Level 2
Level 2
Posts: 57
Joined: Thu Feb 02, 2012 6:30 am
Location: Scotland

Re: Help with car's USB Music Player - copying MP3 files in order

Post by alan2001 »

kato181 wrote: Sun Jan 29, 2023 7:55 am This really has nothing to do with LM. Check with your vehicle manufacturer.
If you want to play music from the first track to the last then don't put them in folders. Vehicle play songs best MP3 format, I have a 32gb full of MP3 songs, and when I copied them to the usb I had them as as Ascending order. Mine are song/artist and you can do that in any file manager.
I think you're misunderstanding the question. No offence. I've posted what the user manual says, and it explains the behaviour. Assuming I can't get Honda UK to somehow change the software for me, this is a computer issue, not a car issue.

I want to have the music stored in folders so I can easily navigate between them. If you don't know the answer, that's fine. Perhaps others do.
ringshellfish
Level 2
Level 2
Posts: 83
Joined: Wed Jan 04, 2023 8:25 pm

Re: Help with car's USB Music Player - copying MP3 files in order

Post by ringshellfish »

It would be interesting how the music player gets the information in which order the files were copied. My guess would be, it uses the file creation timestamp. If that is the case it would be possible to write a script that modifies the timestamps in a way that they are sorted how you would like it.
User avatar
alan2001
Level 2
Level 2
Posts: 57
Joined: Thu Feb 02, 2012 6:30 am
Location: Scotland

Re: Help with car's USB Music Player - copying MP3 files in order

Post by alan2001 »

We can actually take the car completely out of the question here. It's not massively relevant, it's just mentioned as a bit of background.

To simplify things, the question just needs to be:

Is there a way to drag and drop multiple files, so that they will copy one after the other in alphabetical order? :mrgreen:

I am not much good in the terminal btw. And I have no idea how to write scripts... :oops:

Edited to add:
ringshellfish wrote: Sun Jan 29, 2023 8:08 am It would be interesting how the music player gets the information in which order the files were copied. My guess would be, it uses the file creation timestamp. If that is the case it would be possible to write a script that modifies the timestamps in a way that they are sorted how you would like it.
I did have a look at that by showing the "date created" column in Nemo, but it's blank for all the files I've copied...
User avatar
kato181
Level 9
Level 9
Posts: 2577
Joined: Fri Mar 24, 2017 12:33 am
Location: Frederickton NSW

Re: Help with car's USB Music Player - copying MP3 files in order

Post by kato181 »

alan2001 wrote: Sun Jan 29, 2023 8:01 am
kato181 wrote: Sun Jan 29, 2023 7:55 am This really has nothing to do with LM. Check with your vehicle manufacturer.
If you want to play music from the first track to the last then don't put them in folders. Vehicle play songs best MP3 format, I have a 32gb full of MP3 songs, and when I copied them to the usb I had them as as Ascending order. Mine are song/artist and you can do that in any file manager.
I think you're misunderstanding the question. No offence. I've posted what the user manual says, and it explains the behaviour. Assuming I can't get Honda UK to somehow change the software for me, this is a computer issue, not a car issue.

I want to have the music stored in folders so I can easily navigate between them. If you don't know the answer, that's fine. Perhaps others do.
I already told you the answer, usb players on motor vehicles don't like folders. They will not play a song in the order you want. The easiest way to do that is what I suggested. I have done music for people for years to play on their vehicle. It's up to you to take on board what I said, or just plod along and not achieving what you want.
User avatar
alan2001
Level 2
Level 2
Posts: 57
Joined: Thu Feb 02, 2012 6:30 am
Location: Scotland

Re: Help with car's USB Music Player - copying MP3 files in order

Post by alan2001 »

My car handles folders just fine. It can navigate between them without any issues. It seems like you're suggesting I just dump the whole 1100 tracks over to the root of the USB and just put up with it. That is not happening lol.
User avatar
kato181
Level 9
Level 9
Posts: 2577
Joined: Fri Mar 24, 2017 12:33 am
Location: Frederickton NSW

Re: Help with car's USB Music Player - copying MP3 files in order

Post by kato181 »

I had them as Ascending order Have you tried that?
It seems like you're suggesting I just dump the whole 1100 tracks over to the root of the USB Never said that either.
I'm done..Good luck.
User avatar
alan2001
Level 2
Level 2
Posts: 57
Joined: Thu Feb 02, 2012 6:30 am
Location: Scotland

Re: Help with car's USB Music Player - copying MP3 files in order

Post by alan2001 »

Thanks anyway kato181.

I'm gonna try and narrow this down even further: in addition to this not being a car issue at heart, it's not even about USB or MP3s either. It's simply a question about file operations.

I thought describing the reason for this question would help, perhaps not haha. :D
sanmig
Level 5
Level 5
Posts: 536
Joined: Tue Dec 04, 2018 8:27 am

Re: Help with car's USB Music Player - copying MP3 files in order

Post by sanmig »

Column “Date Created” is unknown to exFAT file system, look at ”Date Modified”, I’d guess is it the same as in the source but doesn’t matter to the player.
It will depend on the location in the file system.
However, I (n00b) don’t know how to write a (very slow) 1:1 transfer/copy script, sorry.
There is a forum section for scripts: viewforum.php?f=213
User avatar
alan2001
Level 2
Level 2
Posts: 57
Joined: Thu Feb 02, 2012 6:30 am
Location: Scotland

Re: Help with car's USB Music Player - copying MP3 files in order

Post by alan2001 »

sanmig wrote: Sun Jan 29, 2023 8:48 am Column “Date Created” is unknown to exFAT file system, look at ”Date Modified”, I’d guess is it the same as in the source but doesn’t matter to the player.
It will depend on the location in the file system.
However, I (n00b) don’t know how to write a (very slow) 1:1 transfer/copy script, sorry.
There is a forum section for scripts: viewforum.php?f=213
So I've just done some testing. I dragged and dropped a folder with 14 tracks, all in one go.

This is what it looks like on the PC, sorted by name (which matches the order shown when sorting by "Date Accessed":
Sorted by Name (same as Date Accessed).png
This is what it looks like when sorted by "Date Modified":
Sorted by Date Modified.png
... and here is the order they actually play in:
03 ERNIE
13 You Said
06 On the Beat Pete
11 Overdone
04 Close Escape
07 Solid Gone
05 Not Home Today
14 The Return of the Los Palmas 7
08 Take it or Leave It
02 Embarrassment
10 Disappear
01 Baggy Trousers
12 In the Rain
09 Shadow of Fear
So they are playing in an order that I can't actually see anywhere. Which puts me back to square one and it seems Honda have described the behaviour correctly; they are playing in the order they were copied to the USB.

Dunno if any of that helps. :mrgreen:
sanmig
Level 5
Level 5
Posts: 536
Joined: Tue Dec 04, 2018 8:27 am

Re: Help with car's USB Music Player - copying MP3 files in order

Post by sanmig »

alan2001 wrote: Sun Jan 29, 2023 9:51 am Dunno if any of that helps.
Um, in part, because as you assumed, you need a script that reads directories and files sorted by “Name” and writes one after the other to the drive, without invoking any cache, be it in the OS or the drive, probably taking 1+ sec for each file, depending on the stick. I do’t know if there is a command to “write now”, flash sticks tend to wait because they’d prefer to write in bulk. The target partition should be (manually) formatted first to start from scratch.
I guess you “only” need that script now …
User avatar
alan2001
Level 2
Level 2
Posts: 57
Joined: Thu Feb 02, 2012 6:30 am
Location: Scotland

Re: Help with car's USB Music Player - copying MP3 files in order

Post by alan2001 »

sanmig wrote: Sun Jan 29, 2023 10:33 am
alan2001 wrote: Sun Jan 29, 2023 9:51 am Dunno if any of that helps.
Um, in part, because as you assumed, you need a script that reads directories and files sorted by “Name” and writes one after the other to the drive, without invoking any cache, be it in the OS or the drive, probably taking 1+ sec for each file, depending on the stick. I do’t know if there is a command to “write now”, flash sticks tend to wait because they’d prefer to write in bulk. The target partition should be (manually) formatted first to start from scratch.
I guess you “only” need that script now …
^ That sounds great, please come round to my house and get it started lol.

I've looked into it a bit deeper. As I suspected, I am not the first person to have this issue!

There is a utility in the Software Manager called "FATSORT" that addresses this behaviour:

https://fatsort.sourceforge.io/fatsort.1.html

All done in the terminal so no doubt I would find it extremely fiddly and frustrating. There also seems to be a GUI version of that, which I am now going to investigate:

https://ubuntuforums.org/archive/index. ... 72062.html

I honestly thought this would be a simple thing to figure out! :? Ah well. Thanks folks.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Help with car's USB Music Player - copying MP3 files in order

Post by rene »

FWIW -- you have found the right answer. Your player plays in physical order of the directory entries; ls -U while in a directory on the stick would supposedly show the same order as what the player picks.

According to http://unixetc.co.uk/2011/09/24/sorting ... le-system/ usage of fatsort is going to be easy. If you don't know what to specify in place of /dev/sdb1: with the stick inserted/mounted identify its device from the output of mount, say /dev/sdb1, then (close any GUI windows keeping it busy and) umount /dev/sdb1, then sudo fatsort -c /dev/sdb1.
User avatar
alan2001
Level 2
Level 2
Posts: 57
Joined: Thu Feb 02, 2012 6:30 am
Location: Scotland

Re: Help with car's USB Music Player - copying MP3 files in order

Post by alan2001 »

^^ That's a really great link, thanks very much!
User avatar
Peter Linu
Level 7
Level 7
Posts: 1883
Joined: Sun Nov 11, 2018 8:24 pm
Location: Sinny, Straya

Re: Help with car's USB Music Player - copying MP3 files in order

Post by Peter Linu »

alan2001,
You can't fight city hall. Any computer,USB stick, etc play by the same rules. Folders don't and never will work.
If you want a strict order, you will need to number each file and even better, observe which file system to use; best is exFat. I have bin doing this for my car and giving music to friends for years.
Cinnamon 21.3 Thinkcentre M920q + 2 Thinkpad T440p (modded) + Lenovo Y50-70 (all have VBs) + 2 PC NAS drives w XFCE21.2 + Q4OS-32bit on ASUS Atom (2011) + Asus UX305F-64bit+ 10yo Lenovo NAS for backup
ThaCrip
Level 5
Level 5
Posts: 988
Joined: Sat Dec 07, 2019 12:13 pm

Re: Help with car's USB Music Player - copying MP3 files in order

Post by ThaCrip »

I suggest using fatsort as that cured my issue with my cheap/generic MP3 player (one of those cheap China made ones that are more old school, like 2000's MP3 players, but support much higher capacity MicroSD cards and runs on a single AAA battery of which I use NiMh rechargeable) not listing files in proper order from the MicroSD card etc.

Code: Select all

umount /dev/sdx
then...

Code: Select all

sudo fatsort -n /dev/sdx
once I do that things are listed in proper order then. like how you would expect them to be. that "-n" is 'Natural order sorting'.

p.s. they must have used a slightly newer version of fatsort in Mint 21.x vs Mint 20.x because when I would run that same command on Mint 20.x it would basically have to rescan the all of the MP3 files where as on Mint 21.x when doing the same thing, it seems to be able to detect only the changed files which makes the entire process much quicker.
MainPC: i5-3550 (undervolted by -0.120v (CPU runs 12c cooler) /w stock i3-2120 hs/fan) | 1050 Ti 4GB | 16GB (2x 8GB) DDR3 1600Mhz RAM | Backups: AMD E-300 CPU (8GB RAM) / Athlon X2 3600+ CPU (@2.3GHz@1.35v) (4GB RAM) | All /w Mint 21.x-Xfce
User avatar
alan2001
Level 2
Level 2
Posts: 57
Joined: Thu Feb 02, 2012 6:30 am
Location: Scotland

Re: Help with car's USB Music Player - copying MP3 files in order

Post by alan2001 »

^^ Cheers!

A quick update: I got this to work with fatsort without any issues. :mrgreen: Folders work perfectly, despite what a couple of people have said.

I've been using:

Code: Select all

sudo fatsort -c /dev/sdx
... which did what I wanted it to do. For any people finding this who are worse in Terminal than myself, find out the device/partition name of your USB drive first (use the "Disks" app for that) then type that in the code above. For example, my USB drive is called "/dev/sde1", so I had to type:

Code: Select all

sudo fatsort -c /dev/sde1
This is making me wonder what on earth Windows users would do to resolve the issue...?

Anyway, thanks for all the help. I am very happy with the outcome. 8) p.s. hello to any Linux-using Honda CRV owners from the future lol.
Hawaiihemd
Level 4
Level 4
Posts: 409
Joined: Fri Sep 25, 2020 12:42 pm

Re: Help with car's USB Music Player - copying MP3 files in order

Post by Hawaiihemd »

alan2001 wrote: ...
I've looked into it a bit deeper. As I suspected, I am not the first person to have this issue!

There is a utility in the Software Manager called "FATSORT" that addresses this behaviour:

https://fatsort.sourceforge.io/fatsort.1.html
...
Wow, what a great find! This issue has been bugging me for months now with my cheap-o-china car stereo.

I tried to tackle the problem by finding out how I could write the files to my SDcard one at a time by could not find a solution by searching the web. Maybe my search terms were off...

And today I stumble across this marvel of a post!
Many thanks!
User avatar
Coggy
Level 5
Level 5
Posts: 639
Joined: Thu Mar 31, 2022 10:34 am

Re: [SOLVED] Help with car's USB Music Player - copying MP3 files in order

Post by Coggy »

fatsort looks good. I didn't know that existed before now.

If it's of any interest, I wrote something similar a while ago for my mp3 player - same problem. Mine works with any filesystem, must be mounted. It works by moving all the files to a temporary directory and then moving them back in the desired order. It's missing some of the options that fatsort has though. I was careful that it sorts files with numbers numbers into 1,2,3 not 1,10,11...2,21,22.
I'll try to attach it here in case it's of interest to anyone. Nope. Can't attach it. I'll just post the content (I called the file dir-reorder and put it in ~/bin):

Code: Select all

#!/usr/bin/env python3

# This little ditty re-orders the files in a directory by moving them to a temporary directory
# and then moving them back in the preferred order. This means my music player should then list
# (and play) the files in my preferred order (it seems to do them in the order they are
# written into the directory with no attempt at sorting them).

import os, sys


def vsort(strings, ignore_case):
    kvpairs = []
    for val in strings:
        v2 = s.upper() if ignore_case else val
        chunks = re.findall(r'\d+|\D+', v2)
        key = [int(chunk) if chunk.isdigit() else chunk for chunk in chunks]
        kvpairs.append([key, val])
    return [kv[1] for kv in sorted(kvpairs)]


def sortDir(d, ignoreCase, recursive):
    # Sort the ordering in a directory

    files = os.listdir(d)
    sfiles = vsort(files, ignoreCase)
    # Don't bother if they're already in the right order
    if files != sfiles:
        # Make a temporary directory
        tmpdir = os.path.join(d, "_-sort-_.tmp")
        os.mkdir(tmpdir)
        # Move all the files to the temp directory
        moved = []
        subdirs = []
        for f in sfiles:
            original = os.path.join(d, f)
            stashed = os.path.join(tmpdir, f)
            os.rename(original, stashed)
            moved.append((original, stashed))
        # Replace all the files
        for original, stashed in moved:
            os.rename(stashed, original)
        # Remove the temporary directory again
        os.rmdir(tmpdir)
    # If recursive, reorder the content directories
    if recursive:
        for f in sfiles:
            subdir = os.path.join(d, f)
            if os.path.isdir(subdir):
                sortDir(subdir, ignoreCase, recursive)

def printhelp():
    print("Re-order directory contents.")
    print("usage: %s [-i] [-r] directory" % sys.argv[0])
    print("    -i : case insensitive ordering")
    print("    -r : recursively reorder subdirectories")
    sys.exit(0)

if __name__ == "__main__":
    if len(sys.argv) < 2:
        printhelp()

    ignoreCase = False
    recursive = False
    for arg in sys.argv[1:]:
        if arg == "-i":
            ignoreCase = True
            continue
        if arg == "-r":
            recursive = True
            continue
        if arg == "-h":
            printhelp()
        if os.path.isdir(arg):
            sortDir(arg, ignoreCase, recursive)
        else:
            print(arg, "is not a directory.")

#-
---------------------------------------------------------------------
Locked

Return to “Software & Applications”