Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: how to create non-embedded cue for flac with foobar2000? (Read 1943 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: how to create non-embedded cue for flac with foobar2000?

Reply #25
Generally > is > even in Windows CMD, and and | is | even in Windows CMD.
High Voltage socket-nose-avatar

Re: how to create non-embedded cue for flac with foobar2000?

Reply #26
you're saying that you're tagging multi-disk albums as a single disc? It's not just CUETools that doesn't like that, it's ALL tagging programs too!
i have not run into any issues doing this since... 2003? well ok: tbh i am running into issues now XD.
Apologies I didn't make myself clear, I meant specifically the metadata scraping element of tagging programs, as they use the disc structure (frames and track numbers) to perform a lookup to match them to an item in their database. Having said that, I've just tried it in foobar and you can perform a textual (album name and album artist) lookup and it will match your one disc to however many there are in the release so that's actually not as important as I thought it was.


in any case this is what i have now, it would be a lot of work to change the tags back to reassemble a tag structure dictated by a dead format. plus: many of my albums where released as vinyl first - would you also argue i keep the disc structure of the lp then? cd never did that...
and anyway, i really want to keep the tags as they are now. i think its much more convinient this way and i gain nothing from the knowledge that once the tracks where released on multiple cd while the chance i ever burn the files on cd are about as high as me recording them on a  casette.
It's not replicating the format that's important, it's compatibility. I use MinimServer now, but I've tried a lot of other DLNA servers in the past and I haven't come across any decent ones (I bet the likes of Kodi/Plex probably could, but I don't count those as decent) that could handle that FLAC/CUE format, and I know Roon and most of the new wireless speaker protocols couldn't either. To be honest FLAC/CUE is more of a dead format than CD, nowadays it's just one file per track as it's all streaming/downloads, but I understand that you've already moved in that direction so apologies if you felt I was bashing your approach.


If you had wsl installed you could have run something like the following...
on windows i think | has to be replaced by > and / by \ but yes it should work somehow. not sure how to get the data from the flac on windows tho, but writing the data to the cue should be easy.
tho: i doubt typing the command into the shell is less work then renaming and fixing the cue. most of it can be copy pasted, but file names still had to be fixed.
edit: nvm, wildcards should do the trick.
You wouldn't have to run the command everytime, you'd just configure foo_run with it, and from then on you'd just need to press Alt+1 (or whatever you want it to be) and it'll do the rest for you.

Re: how to create non-embedded cue for flac with foobar2000?

Reply #27
Question though:
Can the player do WavPack with embedded cuesheet?
High Voltage socket-nose-avatar

Re: how to create non-embedded cue for flac with foobar2000?

Reply #28
Question though:
Can the player do WavPack with embedded cuesheet?
Can the player do WavPack with embedded cuesheet?
no, no WV, no embecdded cue

...as they use the disc structure (frames and track numbers) to perform a lookup to match them to an item in their database.

sure, but i only would need that to get tags if my records did not have them. i sometimes try to use these databases. my experience is, whenever i do need them, the tag quality is just awful. usually when i get files that have bad tags, the tags on the databases are also bad. happens a lot with classical music, i guess its older folks that do them and they have sometimes really strange ideas what data to put into the "artist" field.

Quote
You wouldn't have to run the command everytime, you'd just configure foo_run

ah yeah. tbh ive given up on foo_run. it shows up in my component list as installed, but i just cant figure out how to use it. it does not show up anywhere in foobar it seems.

Re: how to create non-embedded cue for flac with foobar2000?

Reply #29
sure, but i only would need that to get tags if my records did not have them. i sometimes try to use these databases. my experience is, whenever i do need them, the tag quality is just awful. usually when i get files that have bad tags, the tags on the databases are also bad. happens a lot with classical music, i guess its older folks that do them and they have sometimes really strange ideas what data to put into the "artist" field.
The music server I use (MinimServer) was developed with classical music in mind, and a lot of the users on that forum seem to use SongKong which apparently does a good job with that genre of music. I haven't used it myself as I don't have an classical music and musicbrainz suffices for me, but I know classical tagging is a whole world of complexity/pain.


You wouldn't have to run the command everytime, you'd just configure foo_run

ah yeah. tbh ive given up on foo_run. it shows up in my component list as installed, but i just cant figure out how to use it. it does not show up anywhere in foobar it seems.
To configure it, go to Preferences > Tools > Run Services, click Add, give it a label and paste the following into the Path "https://www.discogs.com/search/?type=master&title=$replace(%album%, ,+,$char(38),$char(37)26)&artist=$replace(%album artist%, ,+,$char(38),$char(37)26)"

Then to use it, select a song from foobar that contains albumartist and album (as that's what I've set that link up to use) then right click, select Run Service and select the action you just created.
In this example it should open a browser and search for your album artist and album within Discogs.

I use it in my tagging workflow to verify my rips with CUETools, lookup metadata on the web, get album art and run some final cleanup scripts.

Re: how to create non-embedded cue for flac with foobar2000?

Reply #30
classical tagging is a whole world of complexity/pain.
absolutely! i dont have the highest requirements, but still... there is just so much more data and the tag quality usually is SO bad and very coften even inconsistent between the volumes of a single release. i certainly will bookmark songkong and give it a  try. even if i have a somewhat individual way of messing up my own data, its MUCH more easy to mess up something working then to fix something broken first.

To configure it, go to Preferences > Tools > Run Services....
aah! now i get it. i think. thank you!

Re: how to create non-embedded cue for flac with foobar2000?

Reply #31
So I did get it working, sort of. It was actually reasonably easy to get an equivalent powershell command working, but then I couldn't get it to work being called directly from foo_run, so I had to create a batch script to call it.

You need to create a batch script somewhere on your pc (just create a text file and rename the extension to bat), and paste in the following code:
Code: [Select]
@echo off

SET filepath=%~1
SET filename=%~2

powershell -command "(& 'C:\Program Files\_personalInstalls\_portable\encoders\flac\metaflac.exe' --show-tag CUESHEET --no-utf8-convert '%filepath%\%filename%.flac' | ? {$_.trim() -ne '' }).replace('cuesheet=', '').replace('CDImage.wav', '%filename%.flac') | Set-Content '%filepath%\%filename%.cue'"
Making sure the path to metaflac is correct. If you don't have it installed it comes from the official FLAC download here.


Then all you need to do is to configure foo_run with:
Code: [Select]
"C:\Windows\sysnative\cmd.exe" /c "D:\MUSIC.conversion\FLAC\exportCUESheet.bat "$directory_path(%path%)" "$filename(%path%)""
Make sure you replace "D:\MUSIC.conversion\FLAC\exportCUESheet.bat" with wherever you've created your batch file.
The first [ "$directory_path(%path%)" ] and second [ "$filename(%path%)" ] parameters represent the path and file name (excluding extension) to the single flac file that's been created.
The parameters I've included above will work if you've opened the large single flac file in foobar, right clicked and chosen Run Services > (your label). If you want to run this straight after you've performed the conversion (when it's still one file per track in foobar), then you'll need to modify these to whatever you've configured as part of the Conversion destination.

Hope that makes sense?

Re: how to create non-embedded cue for flac with foobar2000?

Reply #32
Hope that makes sense?

you sir, are a hero, it works!
its not as if i know nothing about scripting, but indeed i know very little about scripting and i dont think i would have ever been able to create this command myself.

thank you so much!

edit:

i have a minor issue with the encoding. i have one cue sheet that contains a lot of é. if i use the bat to convert it, it gets replaced by "+®", if i remove "--no-utf8-conver", it will replace the character with "Ú",
now i tried to figure out what endoding to use that both preserves the correct character and is readable in my player (because it wont recognize a cue sheet just copied out of f2k using utilities/edit cue sheet that contains said é).
i used notepad++ and when i convert the cue to "utf-8-bom" it preserves the character and it will also be readable and displayed correctly in my dap.

i googled the command for metaflac to convert to utf-8-bom, but all i found where requests to remove the bom. do you by chance know the correct parameter to do this? if not its a minor issue really. in these cases i always can create the cue manually by copying it and then fix it with notepad++.

Re: how to create non-embedded cue for flac with foobar2000?

Reply #33
i have a minor issue with the encoding. i have one cue sheet that contains a lot of é. if i use the bat to convert it, it gets replaced by "+®", if i remove "--no-utf8-conver", it will replace the character with "Ú",

i used notepad++ and when i convert the cue to "utf-8-bom" it preserves the character and it will also be readable and displayed correctly in my dap.
I think it's actually powershell that's mangling the encoding, and I've had a quick look and there's no obvious way of changing the session encoding default, however, if you create the cue with metaflac first, then use powershell to do the replacements and set the output encoding to utf8 it creates a utf8 file with a BOM.

The modification I've made to the batch file is:
Code: [Select]
"C:\Program Files\_personalInstalls\_portable\encoders\flac\metaflac.exe" --show-tag CUESHEET "%filepath%\%filename%.flac" > "%filepath%\%filename%.cue"
powershell -command "((gc '%filepath%\%filename%.cue') | ? {$_.trim() -ne '' }).replace('cuesheet=', '').replace('CDImage.wav', '%filename%.flac') | set-content -Encoding UTF8 -Path '%filepath%\%filename%.cue'"

Re: how to create non-embedded cue for flac with foobar2000?

Reply #34
whoa. now it really works perfect. i cant thank you enough for this, i would never have been able to figure out this command myslef ♥

Re: how to create non-embedded cue for flac with foobar2000?

Reply #35
whoa. now it really works perfect. i cant thank you enough for this, i would never have been able to figure out this command myslef ♥
And I'd have never been able to do it without stackoverflow :-)

Re: how to create non-embedded cue for flac with foobar2000?

Reply #36
so i found a reason to further refine the script:
some of my files do have embedded cue sheets, and some of them have *a* file name at the "CDImage.wav" position which often does not match the file name. in this case the script will fail.
i fixed that so that it will now always works regardless what file name is present at "FILE "*" WAVE :

Code: [Select]
"C:\ProgramData\flac\metaflac.exe" --show-tag CUESHEET "%filepath%\%filename%.flac" > "%filepath%\%filename%.cue"
powershell -command "((gc '%filepath%\%filename%.cue') | ? {$_.trim() -ne '' }).replace('cuesheet=', '')-replace('FILE.*WAVE', 'FILE """%filename%.flac""" WAVE') | set-content -Encoding UTF8 -Path '%filepath%\%filename%.cue'"

i had to change .replace to -replace, and i also had to use """%filename%.flac""" to make the " show up (this one drove me nuts)

anyway, these changes seem to work so far and make a nice improvement.

Re: how to create non-embedded cue for flac with foobar2000?

Reply #37
i fixed that so that it will now always works regardless what file name is present at "FILE "*" WAVE :
Glad you're finding more ways to make use of it.

i had to change .replace to -replace, and i also had to use """%filename%.flac""" to make the " show up (this one drove me nuts)
-replace (as opposed to .replace) allows you to use regular expressions in the match/replace rather than literal strings, which you've used to good effect.

In regex you can use the escape character / for situations where you don't want a character parsed by the engine, so """%filename%.flac""" becomes /"%filename%.flac/" (it tells the engine to treat " as a literal).

As unlikely as you are to have a song that contains FILE followed by WAVE, it's also good practise to anchor the regex where possible to the beginning and end of the line so 'FILE.*WAVE' becomes '^FILE.*WAVE$' (^matches the beginning of the line and $ matches the end) so the whole line must match rather than just a portion of it.

Gotta love foobar and its components!

Re: how to create non-embedded cue for flac with foobar2000?

Reply #38
nice, thank you! so i changed the script to:

Code: [Select]
"C:\ProgramData\flac\metaflac.exe" --show-tag CUESHEET "%filepath%\%filename%.flac" > "%filepath%\%filename%.cue"
powershell -command "((gc '%filepath%\%filename%.cue') | ? {$_.trim() -ne '' })-replace('cuesheet=', '')-replace('^FILE.*WAVE$', 'FILE \"%filename%.flac\" WAVE') | set-content -Encoding UTF8 -Path '%filepath%\%filename%.cue'"

it seems to work as well as before. i had to use \ instead of / though.  i dont understand why it works, however: in this: \"%filename%.flac\"  i would expect the " to be interpreted as open brackets, not to be printed. i would think it should be \"%filename%.flac"\,  so \\ includes both ", but  it does not work but would print FILE "filename.flac\ WAVE
edit: nvm i thin i now get it, \ will only affect the character directly following the \

i have one issue though: if my filename contains  & (likely other chars like $ as well) the script will fail. i had this issue before and tried for a good long time to fix it without success. after reading your post i hoped that using \ would offer a solution, alas, it did not.
edit: so is there a way to make sure the content of %filename% will not be interpreted as command but parsed as a text string?

Re: how to create non-embedded cue for flac with foobar2000?

Reply #39
it seems to work as well as before. i had to use \ instead of / though.
That's my fault, I typed it incorrectly into the post.


edit: nvm i thin i now get it, \ will only affect the character directly following the \
Exactly, it just escapes the following single character.


i have one issue though: if my filename contains  & (likely other chars like $ as well) the script will fail. i had this issue before and tried for a good long time to fix it without success. after reading your post i hoped that using \ would offer a solution, alas, it did not.
edit: so is there a way to make sure the content of %filename% will not be interpreted as command but parsed as a text string?
I've had a quick look but I haven't managed that myself yet, and I'm going to be busy for the next day or so, so I thought I'd share what I've changed hoping that maybe you can finish it off ;-)

In batch %~1 strips the surrounding quotes from the first paramater passed in (%~2 would be the second etc) but if that parameter contains & it causes a problem, so instead of doing it upfront (using SET filepath= e.t.c), just use it in the commands as you'll be quoting the result anyway. e.g.
Code: [Select]
"C:\Program Files\_personalInstalls\_portable\encoders\flac\metaflac.exe" --show-tag CUESHEET "%~1\%~2.flac" > "%~1\%~2.cue"
powershell -command "((gc '%~1\%~2.cue') | ? {$_.trim() -ne '' }).replace('cuesheet=', '')-replace('^FILE.*WAVE$', 'FILE \"%~2.flac\" WAVE') | set-content -Encoding UTF8 -Path '%~1\%~2.cue'"

I haven't been able to get the filename (%~2) masked in the regular expressions yet though, but there is a method ([Regex]::Escape()) that looks like it should do it here, but with all the quoting that's going on already I haven't been able to get it to work.

 

Re: how to create non-embedded cue for flac with foobar2000?

Reply #40

I've had a quick look but I haven't managed that myself yet, and I'm going to be busy for the next day or so... with all the quoting that's going on already I haven't been able to get it to work.

no problem, you have my eternal gratitude for all the work and help you have ofered me already. you gave me a good starting point, a big problem for me in finding a solution was that i could simply not put something sharp enough into google, so my search results where trash. i will try again, and if i do fail, its not a big issue. though & is surprisingly common in song or band names, these cases are still rare enough that its not a big deal to fix these files manually.