7
$\begingroup$

While doing some signal processing research my aesthetic feelings were heavily struck by following output:
Sound object with very long caption not displayed in full size
The problem here is that 211.96 s label is partially covered by buttons. I can manually resize the object output in an individual case, but I also want to be able to make it programmatically, but unfortunately I could not find any ImageSize or similar options in the Sound documentation and nothing like Style[sound, Larger] works. So the question is:

How to programatically resize the output of a Sound object?

The most naive approach I've tried is to use
Usage of Magnify on a Sound object output
but it magnifies the font size as well. I'm fine with it for now, but in case anyone knows better solution I appreciate your answers a lot! Thank you.

$\endgroup$
6
$\begingroup$

It doesn't seem to be available with Options so let's edit this manually. So you can inspect the output or use ToBoxes to know what needs to be changed. And change it:

sound = Sound[{SoundNote["C"], SoundNote["G"]}]

ToBoxes[
   sound
] /. GraphicsBox[gr_, opts___, ImageSize -> _, opts2___
  ] :> GraphicsBox[gr, opts, opts2, ImageSize -> 500
] // RawBoxes

enter image description here

Learned from John Fultz's answer: MouseAppearance and cursor problems

$\endgroup$
2
  • $\begingroup$ Wow, that's an impressive low level code :) Thank you! I have no idea what this all box stuff is. $\endgroup$
    – Dan Oak
    Apr 29 '16 at 14:30
  • $\begingroup$ And thank you for learning link! $\endgroup$
    – Dan Oak
    Apr 30 '16 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.