Page 1 of 4 123 ... LastLast
Results 1 to 10 of 37

Thread: Howto/Script: Cuesheet Splitter for Lossless Audio files

  1. #1
    Join Date
    Jul 2005
    Beans
    369

    Question Howto/Script: Cuesheet Splitter for Lossless Audio files, with GUI

    [Update: cue-splitter 0.2 re-written in python/pyGTK > GUI, Batch Processing]
    [2011/04: 0.2.3 added split-to-FLAC, simplified GUI]
    [2011/06: 0.2.4 added [File > Show the Log File] ]



    My use case


    Some time ago I started converting my CD collection to FLAC for playback in my Linux media center.

    I chose to rip my CDs to single FLAC files + cuesheets, in order to preserve the inter-track gaps (classical CDs can be rendered un-listenable without this).

    Every now and then, I upload a few of my CDs to my portable digital audio player. For this, I needed a practical tool to cut the single FLAC into Ogg & MP3 files.

    The tool I needed

    Since I am not a real geek, I wanted to use Nautilus' context menu for this. I also wanted my tool to handle FLAC, APE and Wavpack (wv) files, as some of my older rips were in those formats. What's more, I wanted the tool to ask me the output base folder, in which a sub-folder would be automatically created based on the Artist and Album names. A standard gnome filechooser dialog would be used for this.

    And pushing the boundaries even more, I wanted the ID3 tags in the generated MP3 files to be automatically filled-in based on the cuesheet file information, so my tiny new Sansa Clip player would be able to index the songs per album and per artist.

    The lossless audio file + cuesheet splitter script I wrote

    Unfortunately, I couldn't find any existing tool to suit my exact needs, so I wrote my own tool, which does all the above, and using the nautilus-scripts package, can be nicely integrated into nautilus.

    The cue-splitter script I wrote provides support for UTF and non-UTF-encoded cuesheet files, properly handling accented characters in filenames and songnames (tested with spanish and french accents), generating non-accented filenames for the mp3 cuts, but preserving the accents in the ID3 tags.

    Update: as a Python-learning exercise, I rewrote the original bash script in python/pyGTK, adding a GUI (pardon my total lack of GUI-designer skills), allowing easy selection of the output codec and quality, and also adding intuitive (or so I think) batch-processing functionality, allowing drag and drop of cuesheet files from Nautilus. Besides that, by using the neat python-mutagen library, the resulting MP3 files now have ID3v2 tags instead of ID3v1. Integration with Nautilus context menu using nautilus-scripts is still supported and practical but no longer mandatory. For new command line options, run "cue-splitter --help"

    I'm guessing there must be someone out there with similar needs to mine, so here's my script...



    Installation of Dependencies

    Code:
    sudo apt-get install shntool lame flac wavpack vorbis-tools nautilus-script-manager python-mutagen
    Download the script (attached to this post) and move it (or link it) to this folder in your home folder:

    Code:
    ~/.gnome2/nautilus-scripts
    To use it, use nautilus to navigate to the folder that contains the .cue and the lossless audio file, right-click on the .cue, and select Scripts > cue-splitter, then select the output base folder (a sub-folder will be automagically generated), and wait for the pulsating bar to disappear. Enjoy.

    This has been tested in Ubuntu 10.04 but should work in other variants and Linux distros as well, provided the dependencies are met.

    Please beware of my rusty coding style, and use at your own risk : ) The code is GPL'd. More info inside the script file.
    If you improve the script, fix bugs &c, feel free to post back the new code.





    -----------------------
    News:
    Version 0.2.4: added [File > Show the Log File] option in the menu
    Version 0.2.3: added split-to-FLAC support; simplified GUI (smaller footprint)
    Version 0.2.2: missing DATE in cuesheet no longer causes trouble with the cuesheet parser
    Version 0.2.1: major GUI improvements; better handling of long folder names for the splitted output (limits to 44 chars, which is what the Sansa Clip+ player can safely handle)
    Version 0.2.0: script completely rewritten in python/pyGTK, now with a GUI, batch processing and ID3v2.4 support
    Version 0.10: added some python code to support "REM GENRE" and "REM DATE" tag transfer from cuesheet to ogg track file (cuetag does not support "REM *" tags)
    Version 0.9: changed output to ogg vorbis quality 6 and added dependency to vorbis-tools; now converts the cuesheet to UTF-8 encoding
    Version 0.8: stopping the script by selecting "Cancel" in zenity's destination folder selection now works; better guessing of destination folder
    Version 0.7 - fixed issue with filenames with multiple dots - 20080914
    Version 0.6 - improves handling of accented song titles - 20080913
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by ariel; June 3rd, 2011 at 02:40 AM.

  2. #2
    Join Date
    Mar 2007
    Location
    Greensboro, NC, USA
    Beans
    71
    Distro
    Ubuntu

    Re: Howto/Script: Cuesheet Splitter for Lossless Audio files

    Hi ariel,

    First off, thanks! This looks like a great script and a tool that I'd use often. However, how do I get to the point where I can select it under scripts after right-clicking? What do I need to do to make cue-splitter accessible?

    Your help is much appreciated!

    Thanks,
    Aaron

  3. #3
    Join Date
    Mar 2007
    Location
    Greensboro, NC, USA
    Beans
    71
    Distro
    Ubuntu

    Re: Howto/Script: Cuesheet Splitter for Lossless Audio files

    Hi ariel,

    OK, I did some quick research and I've got the script working. Thanks again! It's a very useful tool. One question, however...

    Being a bit of an audio snob, I'd like to have my files split into a) individual FLAC files, b) 256 kbps or 320 kbps Ogg Vorbis files, or c) higher bit-rate mp3 files (256 or 320). Is there any way to do this?

    Thanks a lot!
    Aaron

  4. #4
    Join Date
    Jul 2005
    Beans
    369

    Re: Howto/Script: Cuesheet Splitter for Lossless Audio files

    Quote Originally Posted by atmartin50 View Post
    Hi ariel,

    OK, I did some quick research and I've got the script working. Thanks again! It's a very useful tool. One question, however...

    Being a bit of an audio snob, I'd like to have my files split into a) individual FLAC files, b) 256 kbps or 320 kbps Ogg Vorbis files, or c) higher bit-rate mp3 files (256 or 320). Is there any way to do this?

    Thanks a lot!
    Aaron

    Nice to know the script was useful for you. I just uploaded my newest version (0.6) which fixed problems handling non-english characters in song and album names much better than before.

    To answer your question, while it is certainly possible to change the output format to flac or ogg, I would have to rewrite the part of the script that handles the ID3 tagging and filters out the non-ascii chars in filenames etc. But changing the bit rate of the generated mp3s is quite easy, here's how:


    • Open the script with gedit
    • Locate the line that says:

    Code:
    shntool split -f "$1" -o 'cust ext=mp3 lame --quiet -b 192 - %f' -t "%n - %t" -d "$temp_folder" "$lossless_filename" \
    • Replace the part that says:

    Code:
    -b 192
    • With (e.g., for 320Kbps)

    Code:
    -b 320
    • Save the script, and do a new split of your lossless audio rip


    ... and enjoy your higher quality mp3s
    Last edited by ariel; September 13th, 2008 at 05:28 PM.

  5. #5
    Join Date
    Mar 2007
    Location
    Greensboro, NC, USA
    Beans
    71
    Distro
    Ubuntu

    Re: Howto/Script: Cuesheet Splitter for Lossless Audio files

    Hi ariel,

    Thanks a lot for your quick reply! This sounds easy enough. At the end of the day, a higher bit-rate means more to me than audio format (as long as it's not .wma). Thanks again!

    Aaron

  6. #6
    Join Date
    Aug 2008
    Location
    usa
    Beans
    45
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Howto/Script: Cuesheet Splitter for Lossless Audio files

    Ariel, I appreciate this very much, I'm glad I ran across it. I work with audio files a lot, as a hobby mostly, and like good nautilus-scripts too. I am recently coming from Windows, where at least there are tons of tools for doing this sort of thing. I've found all the command-line tools already, and was interested in learning some scripting myself, or taking up C here under Linux, which I have been working in over there.

    I will be studying your script and using it, probably only modifying the bitrate as shown, for now. So it is a helper for me all-round.

    There is a nice nautilus-script for doing conversions, although I haven't checked out that much of it, I think it transfers tags where possible. It does nothing with cuesheets however. I think it is called 'audio-convert'. I see a great deal of requests for splitting and tagging from cuesheets.

    Thanks again

    Bob

  7. #7
    Join Date
    May 2007
    Location
    Finland
    Beans
    10
    Distro
    Hardy Heron (Ubuntu Development)

    Re: Howto/Script: Cuesheet Splitter for Lossless Audio files

    Thank you for the script! It did exactly what I wanted to do.

  8. #8
    Join Date
    May 2008
    Beans
    112

    Re: Howto/Script: Cuesheet Splitter for Lossless Audio files

    thanks, works great for me and does just what i wanted!

  9. #9
    Join Date
    Mar 2007
    Location
    NY
    Beans
    476
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Howto/Script: Cuesheet Splitter for Lossless Audio files

    im sure im not doing anything wrong. it just doesnt work. i select the 'base folder' and nothing happens... the folder it says its going to create is created but other than that... nothing

  10. #10
    Join Date
    Jul 2005
    Beans
    369

    Re: Howto/Script: Cuesheet Splitter for Lossless Audio files

    Quote Originally Posted by dannymichel View Post
    im sure im not doing anything wrong. it just doesnt work. i select the 'base folder' and nothing happens... the folder it says its going to create is created but other than that... nothing

    I've run into that sort of behavior a few times and AFAIR all issues were related to malformed cuesheets. Cuesheets have a very simple structure and you can quickly spot whether there is something wrong with it. For example, sometimes the cuesheet has a FILE entry that points to a .wav file instead of a flac or ape (BTW, to handle monkey's audio, you need a special library installed, this is described inside the script).

    Other times, cuesheets contain many FILE entries. Other times the TITLE is not surrounded by quotes and so on. I've used the script literally hundreds of times and it seems to do the job well. If one day I have the time I'd like to rewrite it in Python.

Page 1 of 4 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •