Cue import/export

Hey all -

I know that adding an option to create/import/export .cue files has been a pretty big feature request for Audacity. Anyway, I’ve created a Java program to convert .txt Audactiy label files to .cue files.

The program is available here - http://sourceforge.net/projects/label2cue.

The main portion of the code is the following:

public static void createCueFile() throws IOException
	{
		String filename_final_truncated = "";
		
	    try
	    {
	    	  filename_final_truncated = filename_final.substring(0,filename_final.length()-4);
	    }
	    
	    catch (StringIndexOutOfBoundsException h)
	    {
	    	dir.setText("Please select a file first");
	    }	
	    
	    BufferedWriter output = new BufferedWriter(new FileWriter(filename_final_truncated + ".cue"));	    
	    BufferedReader getData = new BufferedReader(new FileReader(dir_final+"/"+filename_final));
	    
	    ArrayList dataList = new ArrayList();
	    
	    String str=null;
	 			 		 	
	 	while((str = getData.readLine()) != null) 	
	 		dataList.add(str);	
	 	 
	 	String tempString = null;	 	 	
	 
	 	output.write("FILE "" + filename_final_truncated + """ + " BINARY");
	 	output.newLine();  	
	 	
	 	// Commented out areas could be useful for debugging
	 	
	 	for(int x=0;x<dataList.size();x++)
	 	{
	 		String temp = getCue(dataList, x);	 
	 		
	 		if(x<=8)
	 		{
	 			System.out.println("  TRACK 0"+(x+1)+" AUDIO");
	 			output.write("  TRACK 0"+(x+1)+" AUDIO");
	 			output.newLine();  	
	 		}	 		
	 		
	 		else 	 
	 		{
	 			System.out.println("  TRACK "+(x+1)+" AUDIO");
	 			output.write("  TRACK "+(x+1)+" AUDIO");
	 			output.newLine();  
	 		}	
	 		
	 		if(prefix.equals(""))
	 		{
	 			prefix = Double.toString(tok1);
	 		}
	 			 		
	 		System.out.println("    TITLE "" + prefix + """);
	 		output.write("    TITLE "" + prefix + """);
	 		output.newLine();  		 		 
	 		System.out.print("    INDEX 01 " +  temp);
	 		output.write("    INDEX 01 " + temp);
	 		
	 		if((x+1)<dataList.size())
	 		{
	 			output.newLine();
	 			System.out.println();
	 		}	 		 				
	 	}	
	 	
	 	output.close();	
	    dir.setText("File converted and saved in " + dir_final);	 	
				
	}
	
	public static String getCue(ArrayList data, int index)
	{						
			String cueFinal = "";
			String trackadd = "";
			String lAdd_min = "";
			String lAdd_sec = "";
			String lAdd_frame = "";
			
			StringTokenizer Tok = new StringTokenizer((String)data.get(index),"	");			 	
	 		
	 		tok1 = Double.parseDouble(Tok.nextToken()); 
	 		
	 	
	 		prefix = "";
	 		
	 		
	 		try
	 		{
	 			prefix = Tok.nextToken();
	 		}
	 		catch (NoSuchElementException e)
	 		{
	 			
	 		}	
	 		
	 		
	 		if(Tok.hasMoreTokens())
	 		prefix = Tok.nextToken();
	 					 			
			double secs=tok1;				
			
			String temps2 = "";
			
			int roundMin = (int)Math.floor(tok1/60); //4
			double fracSec = tok1/60 - roundMin; //.314
			int roundSec = (int)Math.floor(fracSec * 60); //18			
			double tempFrame = fracSec*60 - roundSec; //.84			
			int frame = (int)Math.floor(tempFrame/0.0133333333);	
			
			if(frame>=75)
			{
				roundSec++;
				frame = 0;
			}
						
			if(roundMin<=9)
			{
				lAdd_min = "0";
			}
			
			if(roundSec<=9)
			{
				lAdd_sec = "0";
			}
			
			if(frame<=9)
			{
				lAdd_frame = "0";
			}	
			
				
			cueFinal = lAdd_min + roundMin + ":" + lAdd_sec + roundSec + ":" + lAdd_frame + frame;	
						
			
			return cueFinal;	
	}

I was wondering three things.

(1) Where in the world would I start adding code to the Audacity source code to convert label files to cue files? (What header files, C source files, etc). Need some general direction here.

(2) If accepted, which would be better in your opinion - converting .txt to .cue or natively creating a .cue file? .txt to .cue would certainly be easier, in my opinion.

(3) Is anybody else interested in helping me out here? If somebody else likes my code and decides to actually use it, PLEASE give me credit. It’d be nice (=

Thanks!

Hi AndrewTheArt,

I like this contribution for audacity as it is exactly what I need for creating cue files for my mix collection.
Unfortunately the downloadlinks didn’t work anymore.
Is it possible to release this neat program at some other place or can you send it to me per pm.

Best Regards,
tekknokrat

Hi AndrewTheArt,
Your Script seems to be attracting some attention at the moment, but unfortunately does not seem to be available.
If you would like somewhere to upload it, PM me and I’ll sort a bit of web space out for you.

Re. integrating with Audacity - I’ve been looking into Nyquist plug-ins recently and I think it could be done quite easily with nyquist. Unfortunately there does not seem to be any way to read label tracks into nyquist plug-ins, but this leaves two other options open: (1) the rather ugly workaround of exporting the label track as a text file, then reading it into nyquist and finally saving as a cue file, or (2) creating the cue file directly.

Hello

I would really like to use this script to master a number of CD recordings. I can’t seem to find the label2cue file on Andrew’s website or anywhere.

Does anyone have a copy of the label2cue.zip package that they might be willing to make available or send?

Any assistance would be much appreciated!

Thank you.

Pipps

See attachment
Label2CueConvertor.zip (22 KB)

You are a hero! :smiley:

Thank you! :slight_smile:

Not me - it’s AndrewTheArt that deserves the thanks :wink:
Let us know how you get on with it (I don’t use cue sheets, so I’ve not tried it myself).

You’re right - And I wish I could thank Andrew, if only his website was working! :nerd:

You don’t use cue sheets? :astonished:

They are wonderfully convenient. I hope you get the chance to enjoy them one day! :smiley:

No, I just use K3B or Nero and let the computer do all the work :wink:

Some time ago I spoke with Andrew about the possibility of collaborating on a Nyquist plug-in for exporting cue sheets from Audacity. At the time, he was interested, but rather too busy. Right now, I’m rather busy too, but if you find yourself still loitering round the forum in a month or two, perhaps I could pick your brains and we could see if we can come up with something. (I’m gradually getting to know how to do things in Nyquist, but I know nothing about cue sheets, so that’d be your part of the job :slight_smile:

I would be delighted to assist!

Allow me to send you a PM with my contact details.

It will be great to collaborate with you when you have some free time to undertake this project. It would make Audacity even more superior to other audio editing suites!

I’ve got your PM and sent a reply. I’ll be in touch :wink: (it could be in a month or two).

Sorry guys, my website is experiencing some downtime at the moment. I’m using a free web host (rather economical :wink: ), and you just can’t rely on it at times.

Here’s another link to the program –

http://www.mediafire.com/file/wznznnieq5y/Label2CueConvertor.zip

I’m still really busy, but I might be able to help you guys. I’m not up to speed with Niquest at all, so I’d have to hack around with it. I’d love to collaborate with you guys though. Keep me in the e-mail loop –

Is it possible to implement this feature?
I want to import .cue in 2.0.5 version. As i recognize it is not possible. Tool and script from wiki also can’t help. I must to use another program.

The Wiki page http://wiki.audacityteam.org/wiki/Cue_sheets has the correct instructions as far as I know. Andrew keeps that page updated.

Otherwise yes I’ll add a “vote” that you would like built-in cue sheet support.

Gale

I am not aware of any issues with label2cue. “Doesn’t work” is unfortunately not helpful information.

I do update that page; however, the “main download link” link at the top was out of date. I have updated it. Should be downloaded from http://sourceforge.net/projects/label2cue/

I’m talking about cue to label conversion. This can do only a web tool created by Grimblefritz. I’ve added a comment abut this (error during import label) in https://forum.audacityteam.org/t/convert-label-to-cue-sheet-and-cue-sheet-to-label/19925/1 but my comment have not reviewed yet.

Current status is that the on-line tool is operational.
Your post in the other topic has been moderator approved and replied to: Convert label to cue sheet, and cue sheet to label - #7 by Gale_Andrews

Unfortunately not. See “I have yet to find labels generated by Audacity 1.3 or later that will not convert.” With Audacity 2.0.5 version this tool does not work.

I don’t see anything there after my post back in 2011.


Gale

@igogo, “does not work” will not help fix anything that may need fixing.

Did you see on http://grimblefritz.com/audacity/:

The cue2lbl conversion is rather finicky. It examines only three field (record) types: FILE, TITLE and INDEX. The order that these appear in is important. The easiest way to see the CUE sheet format this tool knows how to parse, is to convert some labels first and look at the resulting CUE sheet output.

I don’t know where your post has gone, but I suggest you repost in Convert label to cue sheet, and cue sheet to label being as specific as possible. I’ve removed you from moderation.

Gale