- you forgot to separate your parameters via comma
- the closing $ for end is missing in the src attribute
- you broke the src attribute by trying to use quotes within quotes, which you don't want or need
I'd also put the audio file first as it is the main element being specified by the macro and possibly the only parameter to be never left out. In other words, you may not need or want to specify any time frame at all. I don't see a need for a default for any of those parameters. Keep it simple!
So that already yields a much simpler:
\define audio(file, start, end)
<audio src="$file$#t=$start$,$end$" controls="controls"/>
\end
To make start or end optional, you could do...
\define audio(file, start, end)
<$reveal type="match" text="$end$" default="">
<audio src="$file$#t=$start$" controls="controls"/>
</$reveal>
<$reveal type="nomatch" text="$end$" default="">
<audio src="$file$#t=$start$,$end$" controls="controls"/>
</$reveal>
\end
As for urls, I would not assume anything.
After all, you might just wish to point to a file on a relative path.
To simplify handling of urls, you can however make use of some form of a base url, e.g.:
\define audio-embed(base, file, start, end)
<$reveal type="match" text="$end$" default="">
<audio src="$base$$file$#t=$start$" controls="controls"/>
</$reveal>
<$reveal type="nomatch" text="$end$" default="">
<audio src="$base$$file$#t=$start$,$end$" controls="controls"/>
</$reveal>
\end
\define audio(file, start, end)
<$macrocall $name="audio-embed" base=<<audio-base>> file="$file$" start="$start$" end="$end$"/>
\end
example:
You can declare this "audio-base" variable in a global macro to define it once throughout the wiki, instead of per tiddler. You could also declare for the scope of the current tiddler as a macro definition, rather than using the
SetWidget or the
VarsWidget e.g.:
Don't be afraid to experiment. But you got to experiment! Meaning: test your code! So start simply, test, modify, test, modify, test, etc... testing is the most crucial bit. Without it, you never know and won't get there. Don't be afraid to do it wrong but you've got to check. Trial and error, we all do.