bugDenemo - Bugs: bug #32384, Allow (d-SaveAs) to take a...


bug #32384: Allow (d-SaveAs) to take a filename parameter.

Submitted by:  jgillis <jgillis>
Submitted on:  Tue 08 Feb 2011 10:26:18 AM UTC  
Category:  Feature request Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  Jeremiah Benham <jjbenham>
Open/Closed:  Closed

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sat 12 Feb 2011 10:45:14 PM UTC, comment #4: 

Thank you very much for implementing my suggestion. I tested this succesfully.

My workflow goes very smooth now:
I have a directory of denemo files which I regularly update.
A simple 'make' command in this directory will now automatically do the denemo -> mid -> wav -> mp3 conversion process for any modified denemo files, so that I can instantly have my updated music on an mp3 player.

FWIW, here's the two files I use for that process:

---- denemo2mid.sh
echo "$1 -> $2"
echo "(d-ExportMIDI \"filename=$2\0\")(d-Close)" > temp.scm
denemo -i temp.scm $1 > /dev/null
rm temp.scm

---- Makefile
DEN=$(shell ls *.denemo)

all: $(MP3)
cp *.mp3 /home/gatewayhost/music/cabus

$(MP3): %.mp3 : %.denemo
./denemo2mid.sh $< $(@:.mp3=.mid)
timidity -Ow $(@:.mp3=.mid)
lame $(@:.mp3=.wav) $@
rm $(@:.mp3=.mid) $(@:.mp3=.wav)

jgillis <jgillis>
Fri 11 Feb 2011 09:09:47 PM UTC, comment #3: 

I applied this patch. Please test it. You can no longer save midi with d-SaveAs you have to use d-ExportMidi.

Thanks for contributing.

Jeremiah Benham <jjbenham>
Project AdministratorIn charge of this item.
Tue 08 Feb 2011 01:42:54 PM UTC, comment #2: 

Hi Richard,

Thanks for your quick reply. Actually, I was happily surprised at how readable the denemo source code was. It took me about to file this bug report after my first encouter with the source code.

"I suspect that your patch will result in the score being associated with a MIDI file on Save"

Not true as far as I can tell; filesel_save accepts a third argument that controls this behaviour. If you make it SAVE_COPY, like in the patch, the denemo retains its filename after the saveas operation. This is arguably bad, because (d-SaveAs) without the argument does overwrite the current filename. Hence, I made the semantics inconsistent. Please comment on this.
If you think this is tolerable, then I would be happy to see the patch make it into trunk.

I could add the same functionality to the export commands, too. Should (d-ExportMIDI) then warn the user if he supplied an extension that is not .mid? Else, (d-ExportMIDI) would do exactly the same as the suggested (d-SaveAs).

I'm not so much interested in parsing command-line arguments from within scheme. Rather the opposite: read in scheme command from command line. Instead of creating a file, like in 'denemo -i myfile.scm', it would be nice if denemo could read from STDIN: 'denemo < myfile.scm'.

Thanks for your time...

jgillis <jgillis>
Tue 08 Feb 2011 01:13:03 PM UTC, comment #1: 

That is very impressive - that parameter passing convention is not the most pleasant of code to follow:)
You may have been overtaken by events - Jeremiah has just been creating specific export commands for midi, pdf, png and lily.
I suspect that your patch will result in the score being associated with a MIDI file on Save, which was a strange feature in Denemo, as reloading is not possible generally.
So I have looked at the new code, and, unfortunately it, too, needs the same sort of work d-ExportMIDI will not currently respond to a parameter, but could.
Worse, I see that the functions

export_*_action() are all in print.c when they should be in file.c

and they would need to pass the DenemoScriptParam on to the file_export() function which then needs the GET_1PARAM treatment.

Having said all that, your if your patch works against the current git and you don't want to be doing the above I will happily apply the patch, it makes something possible that can't be done at the moment.
BTW we are ready to do command-line processing from a scheme script - if you or anyone else wants to do batch processing please shout. It just needs some switch to be installed.

Richard Shann <rshann>
Project Administrator
Tue 08 Feb 2011 10:26:18 AM UTC, original submission:  

Batch exporting denemo files to midi files would suddenly be feasible if only there existed a scripting command to save to a particular filename. I propose the use of a 'filename' argument for (d-SaveAs), similar to these changes:

I created a small patch that works on my system, so that the command (d-SaveAs "filename=music/cabus/test.mid\0") exports a midi file automatically, without gui interaction required from the user.

jgillis <jgillis>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #22624:  0001-Allow-d-SaveAs-to-take-a-filename-parameter.patch added by jgillis (1KiB - text/x-patch - my first patch file ever)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by jjbenham (Updated the item)
  • -email is unavailable- added by rshann (Posted a comment)
  • -email is unavailable- added by jgillis (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-02-26 jjbenham Open/ClosedOpen => Closed
    2011-02-11 jjbenham StatusNeed Info => Fixed
    2011-02-08 jjbenham Assigned toNone => jjbenham
    2011-02-08 rshann StatusNone => Need Info
    2011-02-08 jgillis Attached File- => Added 0001-Allow-d-SaveAs-to-take-a-filename-parameter.patch, #22624

    Back to the top

    Powered by Savane 3.5